From 1e9d1d5293b9a76484a42b792ab4cef8b3b079f6 Mon Sep 17 00:00:00 2001 From: Richard Scheffenegger Date: Sat, 5 Nov 2022 12:36:46 +0100 Subject: [PATCH 1/2] execute test with the working directory set to their location, allowing relative pre- and post-exec scripts to work independent of invocation path --- run-tests.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/run-tests.sh b/run-tests.sh index 1b933b97..4079caba 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -25,6 +25,8 @@ # SUCH DAMAGE. # +#pwd=`pwd` +#rootdir=`/usr/bin/dirname ${pwd}/$0` rootdir=`/usr/bin/dirname $0` passed=0 failed=0 @@ -119,8 +121,11 @@ for file ; do if [ -t 1 ] ; then printf "\033[33m%10s\033[0m" "RUNNING" fi - timeout $timelimit $packetdrill ${flags} ${rootdir}/${testdir}/${testname}.pkt >${rootdir}/${testdir}/${prefix}${testname}.out 2>&1 + pwd=`pwd` + cd `dirname ${pwd}/${rootdir}/${testdir}/${testname}.pkt` + timeout $timelimit $packetdrill ${flags} ${testname}.pkt > ${prefix}${testname}.out 2>&1 result=$? + cd ${pwd} if [ $result -eq 0 -a $verbose -eq 0 ] ; then rm ${rootdir}/${testdir}/${prefix}${testname}.out fi @@ -203,6 +208,7 @@ for file ; do fi done done +cd ${rootdir} printf "===============================================================================\n" printf "Summary: Number of tests run: %3u\n" $run printf " Number of tests passed: %3u\n" $passed From 563b662c77c2d0d663900d0d4e34230c6200e209 Mon Sep 17 00:00:00 2001 From: Richard Scheffenegger Date: Sat, 5 Nov 2022 12:48:00 +0100 Subject: [PATCH 2/2] remove commented out lines --- run-tests.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/run-tests.sh b/run-tests.sh index 4079caba..14722c08 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -25,8 +25,6 @@ # SUCH DAMAGE. # -#pwd=`pwd` -#rootdir=`/usr/bin/dirname ${pwd}/$0` rootdir=`/usr/bin/dirname $0` passed=0 failed=0