cleanup of how ssh_test return code is captured in tests/basic
[monkeysphere.git] / tests / common
1 # -*-shell-script-*-
2
3 failed_cleanup() {
4     # FIXME: can we be more verbose here?
5     echo 'FAILED!'
6     read -p "press enter to cleanup and remove tmp (or type bash for a subshell to examine): " XX
7     if [ "$XX" = bash ] ; then
8         bash
9     fi
10
11     cleanup
12 }
13
14 get_gpg_prng_arg() {
15     if (gpg --quick-random --version >/dev/null 2>&1) ; then
16         echo quick-random
17     elif (gpg --debug-quick-random --version >/dev/null 2>&1) ; then
18         echo debug-quick-random
19     fi
20 }
21
22 cleanup() {
23     echo "### removing temp dir..."
24     rm -rf "$TEMPDIR"
25
26     if [ "$SSHD_PID" ] ; then
27         echo "### killing off lingering sshd..."
28         kill "$SSHD_PID"
29     fi
30
31     wait
32 }