X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=sidecars%2Flistener%2Frun_unit_test.ksh;h=8d350fba4939fb8d48953016eb89671846e45bc3;hb=refs%2Fchanges%2F60%2F4560%2F1;hp=e20f738a216aeee61bd7127630506d6c0f112074;hpb=6c6ac644fc38772b343347cda37c884af8415cfb;p=ric-app%2Fmc.git diff --git a/sidecars/listener/run_unit_test.ksh b/sidecars/listener/run_unit_test.ksh index e20f738..8d350fb 100755 --- a/sidecars/listener/run_unit_test.ksh +++ b/sidecars/listener/run_unit_test.ksh @@ -26,6 +26,16 @@ # Author: E. Scott Daniels # ------------------------------------------------------------------------- +function abort_after { + touch /tmp/running + sleep ${1:-60} + if [[ -e /tmp/running ]] + then + echo "abort: unit test running too long, killing $2" + kill -9 ${2:-bad-pid} + fi +} + function setup_dirs { mkdir -p /tmp/fifos mkdir -p /tmp/mc_listener_test/final @@ -47,7 +57,6 @@ function purge_dirs { rm -fr /tmp/mc_listener_test } - if ! make -B unit_test # ensure that it's fresh then echo "[FAIL] cannot make unit_test" @@ -67,13 +76,16 @@ then exit fi +abort_after 60 if ! unit_test >/tmp/PID$$.utlog 2>&1 then + rm -f /tmp/running cat /tmp/PID$$.utlog rm -f /tmp/PID$$.* purge_dirs exit 1 fi +rm -f /tmp/running echo "[PASS] base unit tests all pass" echo "[INFO] file/directory verification begins...." @@ -88,7 +100,7 @@ if [[ -e $copy_src ]] then echo "[FAIL] copy source test should have been unlinked but was there!" rc=1 -else +else dest_md5=$( cat $copy_dest | md5sum ) # use cat so that filename doesn't factor in to output if [[ $dest_md5 != $src_md5 ]] then @@ -116,6 +128,7 @@ then echo "[FAIL] overall test fails" else echo "[PASS] overall test passes" + rm -f *test*.gcov fi rm -f /tmp/PID$$.*