feat(doc): Add trace man pages
[ric-plt/lib/rmr.git] / test / unit_test.ksh
index 745cf07..21848af 100755 (executable)
@@ -216,7 +216,7 @@ function discount_an_checks {
                rc = adj_cov < module_cov_target ? 1 : 0
                if( pass_fail == cfail || show_all ) {
                        if( chatty ) {
-                               printf( "[%s] %s executable=%d unexecuted=%d discounted=%d net_unex=%d  cov=%d% ==> %d%%%  target=%d%%\n", 
+                               printf( "[%s] %s executable=%d unexecuted=%d discounted=%d net_unex=%d  cov=%d%% ==> %d%%  target=%d%%\n", 
                                        pass_fail, full_name ? full_name : module, nexec, unexec, discount, net, orig_cov, adj_cov, module_cov_target )
                        } else {
                                printf( "[%s] %d%% (%d%%) %s\n", pass_fail, adj_cov, orig_cov, full_name ? full_name : module )
@@ -259,13 +259,14 @@ else
        fi
 fi
 
-export C_INCLUDE_PATH="../src/common/include"
+export C_INCLUDE_PATH="../src/common/include:$C_INCLUDE_PATH"
 
 module_cov_target=80
 builder="make -B %s"           # default to plain ole make
 verbose=0
 show_all=1                                     # show all things -F sets to show failures only
 strict=0                                       # -s (strict) will set; when off, coverage state ignored in final pass/fail
+show_output=0                          # show output from each test execution (-S)
 
 while [[ $1 == "-"* ]]
 do
@@ -282,6 +283,7 @@ do
                -F)     show_all=0;;
 
                -s)     strict=1;;                                      # coverage counts toward pass/fail state
+               -S)     show_output=1;;                         # test output shown even on success
                -v)     (( verbose++ ));;
 
                -h)     usage; exit 0;;
@@ -348,12 +350,19 @@ do
                add_ignored_func $f
        done
        
-       if ! ${tfile%.c} >/tmp/PID$$.log 2>&1
+       if ! ./${tfile%.c} >/tmp/PID$$.log 2>&1
        then
                echo "[FAIL] unit test failed for: $tfile"
                cat /tmp/PID$$.log
                (( ut_errors++ ))                               # cause failure even if not in strict mode
                continue                                                # skip coverage tests for this
+       else
+               if (( show_output ))
+               then
+                       printf "\n============= test programme output =======================\n"
+                       cat /tmp/PID$$.log
+                       printf "===========================================================\n"
+               fi
        fi
 
        (