X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=tests%2Fbasic;h=5ba7a250b948affc504378ee09f2dce4ba79d76f;hb=848f2e10f0ec24c8cbc12277948159312b4b71c2;hp=d7355786457af1e996010733699e28a59e98bcaa;hpb=37c5b03dbe70f8f3fe24d15318645e1678841879;p=monkeysphere.git diff --git a/tests/basic b/tests/basic index d735578..5ba7a25 100755 --- a/tests/basic +++ b/tests/basic @@ -13,6 +13,14 @@ # 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 +54,7 @@ ssh_test() { # kill the sshd process if it's still running kill "$SSHD_PID" + SSHD_PID= set -e @@ -79,9 +88,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,7 +129,6 @@ 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