X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=tests%2Fbasic;h=f38c9ac89119b15006cfd44d0d29e89c366e6e8a;hb=06d5d37ffe25f4f66b58bbf1e4e51fa276ba4996;hp=f76a265ea43bd388ea3fff022ca16b8f50fdd112;hpb=55d985e807f1cbc859fc859ab099eced10356ce4;p=monkeysphere.git diff --git a/tests/basic b/tests/basic index f76a265..f38c9ac 100755 --- a/tests/basic +++ b/tests/basic @@ -28,6 +28,14 @@ source "$TESTDIR"/common ## test has *more* requirements than plain ol' monkeysphere: which socat >/dev/null || { echo "You must have socat installed to run this test." ; exit 1; } +perl -MCrypt::OpenSSL::RSA -e 1 2>/dev/null || { echo "You must have the perl module Crypt::OpenSSL::RSA installed to run this test. +On debian-derived systems, you can set this up with: + apt-get install libcrypt-openssl-rsa-perl" ; exit 1; } + + +perl -MDigest::SHA1 -e 1 2>/dev/null || { echo "You must have the perl module Digest::SHA1 installed to run this test. +On debian-derived systems, you can set this up with: + apt-get install libdigest-sha1-perl" ; exit 1; } ## FIXME: other checks? @@ -43,6 +51,8 @@ gpgadmin() { # test ssh connection # first argument is expected return code from ssh connection ssh_test() { + local RETURN=0 + umask 0077 CODE=${1:-0} @@ -57,20 +67,16 @@ ssh_test() { sleep 1 done - set +e - # make a client connection to the socket echo "##### starting ssh client..." ssh-agent bash -c \ - "monkeysphere subkey-to-ssh-agent && ssh -F $TEMPDIR/testuser/.ssh/config testhost true" - RETURN="$?" + "monkeysphere subkey-to-ssh-agent && ssh -F $TEMPDIR/testuser/.ssh/config testhost true" \ + || RETURN="$?" # kill the sshd process if it's still running kill "$SSHD_PID" SSHD_PID= - set -e - echo "##### return $RETURN" if [ "$RETURN" = "$CODE" ] ; then echo "##### ssh connection test returned as desired" @@ -106,7 +112,7 @@ TEMPDIR=$(mktemp -d "${TMPDIR:-$TESTDIR/tmp}/monkeyspheretest.XXXXXXX") # Use the local copy of executables first, instead of system ones. # This should help us test without installing. -export PATH="$TESTDIR"/../src:"$TESTDIR"/../src/keytrans:"$PATH" +export PATH="$TESTDIR"/../src:"$PATH" export MONKEYSPHERE_SYSDATADIR="$TEMPDIR" export MONKEYSPHERE_SYSCONFIGDIR="$TEMPDIR" @@ -123,6 +129,10 @@ export MONKEYSPHERE_LOG_LEVEL=DEBUG export MONKEYSPHERE_CORE_KEYLENGTH=1024 export MONKEYSPHERE_PROMPT=false +# unset SUBKEYS_FOR_AGENT variable which, if set, would confuse the +# into trying to use the user's key, instead of the testuser's key +unset MONKEYSPHERE_SUBKEYS_FOR_AGENT + export SSHD_CONFIG="$TEMPDIR"/sshd_config export SOCKET="$TEMPDIR"/ssh-socket @@ -132,22 +142,6 @@ export SOCKET="$TEMPDIR"/ssh-socket # *anything* with any running X11 session. export DISPLAY=monkeys -## make sure that the version number matches the debian changelog -## (don't bother if this is being run from the tests). - -if [ -f "$TESTDIR"/../packaging/debian/changelog ]; then - echo - echo "##################################################" - echo "### checking version string match..." - repver=$(monkeysphere version) - debver=$(head -n1 "$TESTDIR"/../packaging/debian/changelog | sed 's/.*(\([^-]*\)-.*/\1/') - if [ "$repver" = "$debver" ] ; then - echo "Versions match!" - else - printf "reported version string (%s) does not match debian changelog (%s)\n" "$repver" "$debver" - exit 1 - fi -fi ###################################################################### ### CONFIGURE ENVIRONMENTS @@ -156,7 +150,8 @@ fi echo echo "##################################################" echo "### configuring testuser home..." -cp -a "$TESTDIR"/home/testuser "$TEMPDIR"/ +(cd "$TESTDIR"/home && find testuser | cpio -pdu "$TEMPDIR") + # set up environment for testuser export TESTHOME="$TEMPDIR"/testuser export GNUPGHOME="$TESTHOME"/.gnupg @@ -176,7 +171,7 @@ get_gpg_prng_arg >> "$GNUPGHOME"/gpg.conf echo echo "##################################################" echo "### configuring admin home..." -cp -a "$TESTDIR"/home/admin "$TEMPDIR"/ +(cd "$TESTDIR"/home && find admin | cpio -pdu "$TEMPDIR") # set up sshd echo @@ -285,7 +280,6 @@ monkeysphere-authentication update-users $(whoami) # FIXME: this is maybe not failing properly for: # ms: improper group or other writability on path '/tmp'. - ###################################################################### ### TESTS