X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=sidecars%2Flistener%2Ftest%2Frun_unit_test.ksh;h=93fe2fbfa20086a69c5a9a15cf8f2810f2b8bfca;hb=refs%2Fchanges%2F59%2F4659%2F1;hp=2ccd47e908d84368700ab4af7e41544d5bddd6fd;hpb=835ea34297bb2d238c1bedaf5430953ef43d58da;p=ric-app%2Fmc.git diff --git a/sidecars/listener/test/run_unit_test.ksh b/sidecars/listener/test/run_unit_test.ksh index 2ccd47e..93fe2fb 100755 --- a/sidecars/listener/test/run_unit_test.ksh +++ b/sidecars/listener/test/run_unit_test.ksh @@ -25,6 +25,12 @@ # the ability to pre-install before running this test, so # we will force one to be there if we don't find it in /usr. # +# CI Mode +# For the Jenkins jobs to capture trigger data allowing sonar +# analysis, we must force a build in the ../src directory. +# CI mode is on by default, to force this build, but can be +# turned off with the -c option for local builds/testing. +# # Date: 10 December 2019 # Author: E. Scott Daniels # ------------------------------------------------------------------------- @@ -127,10 +133,12 @@ export LIBRARY_PATH=/usr/local/lib:$LIBRARY_PATH running=/tmp/PID$$.running force_rmr_load=0 +ci_mode=1 # -c turns off; see the flower box above while [[ $1 == -* ]] do case $1 in + -c) ci_mode=0;; -f) force_rmr_load=1;; -N) no_rmr_load=1;; # for local testing @@ -150,6 +158,17 @@ fi ensure_pkgs # ensure that we have RMR; some CI environments are lacking +if (( ci_mode )) # in CI mode we must force a build in the src so build wrapper captures trigger data +then + echo "building in src for sonar build wrapper capture" + ( + cd ../src + export TEST_COV_OPTS="-ftest-coverage -fprofile-arcs" # picked up by make so we get coverage on tools for sonar + make -B + ) +fi + +echo "building unit test(s)" if ! make -B unit_test # ensure that it's fresh then echo "[FAIL] cannot make unit_test" @@ -224,5 +243,7 @@ else rm -f *test*.gcov fi +cp *.gcov ../ # jjb description points to top listener dir for sonar to find gcov files + rm -f /tmp/PID$$.* exit $rc