X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=tests%2Fbasic;h=7fdca39e308037506e073b4603a6ecede1da751f;hb=aaa834da0f1eb3ea52aabc9809dfe3510a159797;hp=c85b449506165630049912c5159b711871cd518e;hpb=753b7c5f74caa99f31254b44fac62c313ecbb1db;p=monkeysphere.git diff --git a/tests/basic b/tests/basic index c85b449..7fdca39 100755 --- a/tests/basic +++ b/tests/basic @@ -8,11 +8,18 @@ # Copyright: 2008 # License: GPL v3 or later -# these tests should all be able to -# as a non-privileged user. +# these tests should all be able to run as a non-privileged user. # all subcommands in this script should complete without failure: set -e +# piped commands should return the code of the first non-zero return +set -o pipefail + +## make sure that the right tools are installed to run the test. the +## test has *more* requirements than plain ol' monkeysphere: +which socat || { echo "You must have socat installed to run this test." ; exit 1; } + +## FIXME: other checks? # gpg command for test admin user gpgadmin() { @@ -46,6 +53,7 @@ ssh_test() { # kill the sshd process if it's still running kill "$SSHD_PID" + SSHD_PID= set -e @@ -79,9 +87,16 @@ cleanup() { echo "### removing temp dir..." rm -rf "$TEMPDIR" + if [ "$SSHD_PID" ] ; then + echo "### killing off lingering sshd..." + kill "$SSHD_PID" + fi + wait } +SSHD_PID= + ## setup trap trap failed_cleanup EXIT @@ -113,8 +128,11 @@ export MONKEYSPHERE_LOG_LEVEL=DEBUG export SSHD_CONFIG="$TEMPDIR"/sshd_config export SOCKET="$TEMPDIR"/ssh-socket -export SSHD_PID= +# Make sure $DISPLAY is set to convince ssh and monkeysphere to fall +# back on $SSH_ASKPASS. Make sure it's not set to the current actual +# $DISPLAY (if one exists) because this test suite should not be doing +# *anything* with any running X11 session. export DISPLAY=monkeys ### CONFIGURE ENVIRONMENTS @@ -174,7 +192,7 @@ echo | monkeysphere-server gen-key --length 1024 --expire 0 testhost # remove the gpg.conf rm "$MONKEYSPHERE_SYSCONFIGDIR"/gnupg-host/gpg.conf -HOSTKEYID=$( monkeysphere-server show-key | tail -n1 | cut -f3 -d\ ) +HOSTKEYID=$( monkeysphere-server show-key | grep '^OpenPGP fingerprint: ' | cut -f3 -d\ ) # certify it with the "Admin's Key". # (this would normally be done via keyservers)