Add publish script to lister test set
[ric-app/mc.git] / sidecars / listener / test / run_unit_test.ksh
index 93fe2fb..2c7d7fc 100755 (executable)
@@ -131,6 +131,14 @@ function ensure_pkgs {
 export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
 export LIBRARY_PATH=/usr/local/lib:$LIBRARY_PATH
 
+# defined in the CI configuration where jenkins jobs are looking for gcov files
+gcov_dir=/tmp/gcov_rpts
+if [[ ! -d $cov_dir ]]
+then
+       echo "[INFO] making $gcov_dir"
+       mkdir $gcov_dir
+fi
+
 running=/tmp/PID$$.running
 force_rmr_load=0
 ci_mode=1                                                              # -c turns off; see the flower box above
@@ -183,14 +191,15 @@ then
        exit
 fi
 
+rm -fr *.gcov *.gcda                   # ditch any previously generated coverage info
+
 ./unit_test >/tmp/PID$$.utlog 2>&1 &
 pid=$!
 abort_after 60 $pid &
 wait $pid
-#if ! unit_test >/tmp/PID$$.utlog 2>&1
 if (( $? != 0 ))
 then
-       echo ">>>> wait popped"
+       echo "<FAIL> run_unit_test: wait popped"
        rm -f $running
        cat /tmp/PID$$.utlog
        rm -f /tmp/PID$$.*
@@ -240,10 +249,11 @@ then
        echo "[FAIL] overall test fails"
 else
        echo "[PASS] overall test passes"
-       rm -f *test*.gcov
+       rm -f *test*.gcov                                       # ditch test specific coverage files first
+       #cp *.gcov      $gcov_dir/                              # make avilable to jenkins job(s)
+       ./publish_cov.ksh                                       # push to reports dir and fix internal source filenames
 fi
 
-cp *.gcov ../                          # jjb description points to top listener dir for sonar to find gcov files
 
 rm -f /tmp/PID$$.*
 exit $rc