X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=tests%2F_common.sh;h=fa2f1077f0235c2d7d397f3403874ced12d43382;hb=674c5c0b50247a280a5e6ab0ce1c252579db6407;hp=cb31ac766e1fe1e3338ded87c26ce9c4c574052c;hpb=0fb8990b502398a1d2316cb9a67bdf4bb0bde7ee;p=tpg%2Fopendispense2.git diff --git a/tests/_common.sh b/tests/_common.sh index cb31ac7..fa2f107 100644 --- a/tests/_common.sh +++ b/tests/_common.sh @@ -1,6 +1,7 @@ # # NOTE: Not a script, to be included by scripts # +USER=$(id -un) BASEDIR=rundir/${TESTNAME}/ PORT=22222 @@ -34,6 +35,7 @@ FAIL() { } TRY_COMMAND() { cmd="$*" + echo ">> $cmd" if ! $cmd ; then FAIL "Command \`$cmd\` failed" fi @@ -45,8 +47,12 @@ LD_LIBRARY_PATH=.. ../dispsrv -f ${BASEDIR}cfg_server.conf --dont-daemonise > ${ server_pid=$! cleanup() { - LOG "Killing ${server_pid}" - kill ${server_pid}; true + if pidof dispsrv | grep ${server_pid}; then + LOG "Killing ${server_pid}" + kill ${server_pid}; true + else + LOG "Server already terminated" + fi } trap cleanup EXIT @@ -57,4 +63,5 @@ if ! (echo "" | nc localhost ${PORT}); then LOG "Server not responding on ${PORT}" LOG "Server log contents:" cat ${BASEDIR}server.log + exit 1 fi