X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Funit_test.ksh;h=8b21feec36437f697b8be9d65cb61500ce91c905;hb=77406e61f2158f5b88b7a9f6e3e86d8f62c8f71a;hp=f74e4382414f83915b772b5d9490b5bae26d31cc;hpb=b0ba22eb7deafbe43f7dac0e9d6abd8d4484c3bf;p=ric-plt%2Flib%2Frmr.git diff --git a/test/unit_test.ksh b/test/unit_test.ksh index f74e438..8b21fee 100755 --- a/test/unit_test.ksh +++ b/test/unit_test.ksh @@ -335,6 +335,8 @@ gen_xml=0 replace_flags=1 # replace ##### in gcov for discounted lines run_nano_tests=0 +export RMR_WARNING=1 # turn on warnings + while [[ $1 == "-"* ]] do case $1 in @@ -344,6 +346,7 @@ do -N) run_nano_tests=1;; -c) module_cov_target=$2; shift;; + -e) capture_file=$2; >$capture_file; shift;; # capture errors from failed tests rather than spewing on tty -f) force_discounting=1; trigger_discount_str="WARN|FAIL|PASS" # check all outcomes for each module ;; @@ -447,11 +450,20 @@ do if ! ./${tfile%.c} >/tmp/PID$$.log 2>&1 then echo "[FAIL] unit test failed for: $tfile" - if (( quiet )) + if [[ -n $capture_file ]] then - grep "^<" /tmp/PID$$.log # in quiet mode just dump <...> messages which are assumed from the test programme not appl + echo "all errors captured in $capture_file, listing only fail message on tty" + echo "$tfile --------------------------------------" >>$capture_file + cat /tmp/PID$$.log >>$capture_file + grep "^" /tmp/PID$$.log + echo "" else - cat /tmp/PID$$.log + if (( quiet )) + then + grep "^<" /tmp/PID$$.log|grep -v "^" # in quiet mode just dump <...> messages which are assumed from the test programme not appl + else + cat /tmp/PID$$.log + fi fi (( ut_errors++ )) # cause failure even if not in strict mode continue # skip coverage tests for this