X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=sidecars%2Flistener%2Ftest%2Frun_app_tests.ksh;h=a8994a6fbe636aa9d756816403dfd54e0606b9e3;hb=refs%2Ftags%2F1.12.0;hp=686604130aef70035f9f219103935146d5c77553;hpb=9e389a0f00f4ce886fa0cafe3318ee0156770899;p=ric-app%2Fmc.git diff --git a/sidecars/listener/test/run_app_tests.ksh b/sidecars/listener/test/run_app_tests.ksh index 6866041..a8994a6 100755 --- a/sidecars/listener/test/run_app_tests.ksh +++ b/sidecars/listener/test/run_app_tests.ksh @@ -35,11 +35,11 @@ # This is a hack! There seems not to be an easy way to have the LF -# environment add RMR (or other needed packages) for testing. If we don't +# environment adds RMR (or other needed packages) for testing. If we don't # find RMR in the /usr/local part of the filesystem, we'll force it into # /tmp which doesn't require root. We'll be smart and get the desired -# rmr version from the repo root juas as we _expected_ the CI environmnt -# woudl do (but seems not to). +# rmr version from the repo root just as we _expected_ the CI environmnt +# would do (but seems not to). # function ensure_pkgs { if (( no_rmr_load )) @@ -101,12 +101,24 @@ export LIBRARY_PATH=/usr/local/lib:$LIBRARY_PATH force_rmr_load=0 no_rmr_load=0 +test_dir=$PWD +# defined in the CI configuration where jenkins jobs are looking for gcov files +gcov_dir=/tmp/gcov_rpts +if [[ ! -d $cov_dir ]] +then + echo " making $gcov_dir" + mkdir $gcov_dir +fi + + +verbose=0 while [[ $1 == -* ]] do case $1 in -f) force_rmr_load=1;; -N) no_rmr_load=1;; # for local testing + -v) verbose=1; vflag="-v";; *) echo "unrecognised option: $1" exit 1 @@ -118,43 +130,58 @@ done ensure_pkgs # some CI enviroments may not have RMR; get it -script_dir=${PWD%/*}/src cd ../src # build the binaries with coverage options set export TEST_COV_OPTS="-ftest-coverage -fprofile-arcs" # picked up by make so we get coverage on tools for sonar make clean # ensure coverage files removed -make -B # ensure coverage data is nuked +make -B # force build under the eyes of sonar build wrapper +if (( $? != 0 )) +then + echo "[FAIL] build failed" + exit +fi + +rm -fr *.gcov *.gcda # ditch any previously generated coverage info # drive with full complement to test good branches, then with bad (missing value) to drive exceptions -mc_listener -p 4567 -q -r 10 -e -d foo -x >/dev/null 2>&1 # -x (invalid) prevents execution loop +./mc_listener -p 4567 -q -r 10 -e -d foo -x >/dev/null 2>&1 # -x (invalid) prevents execution loop for x in d p r \? h # drive with missing values for d, p, r and singletons -h and -? do - mc_listener -$x >/dev/null 2>&1 + ./mc_listener -$x >/dev/null 2>&1 done +gcov mc_listener.c # debugging because jenkins gcov doesn't seem to be accumulating data -pipe_reader -d foo -e -f -m 0 -s -x >/dev/null 2>&1 # drive for all "good" conditions +./pipe_reader -d foo -e -f -m 0 -s -x >/dev/null 2>&1 # drive for all "good" conditions for x in d m \? h do - pipe_reader -$x >/dev/null 2>&1 # drive each exception (missing value) or 'help' + ./pipe_reader -$x >/dev/null 2>&1 # drive each exception (missing value) or 'help' done -rdc_replay -d foo -f bar -t 0 -x >/dev/null 2>&1 # drive for all "good" conditions +./rdc_replay -d foo -f bar -t 0 -x >/dev/null 2>&1 # drive for all "good" conditions for x in d f t \? h do - rdc_replay -$x >/dev/null 2>&1 # drive each exception (missing value) or 'help' + ./rdc_replay -$x >/dev/null 2>&1 # drive each exception (missing value) or 'help' done -$script_dir/verify.sh # verify MUST be first (replay relies on its output) -$script_dir/verify_replay.sh +./verify.sh $vflag # verify MUST be first (replay relies on its output) +./verify_replay.sh # generate and copy coverage files to parent which is where the CI jobs are looking for them # we do NOT gen stats for the library functions; the unit test script(s) do that # for x in mc_listener sender rdc_replay pipe_reader do - gcov $x.c - cp $x.c.gcov ../ # copy only interesting things (not the lib modules if they exist) + gcov $x.c + #cp $x.c.gcov $gcov_dir/ done +$test_dir/publish_cov.ksh # publish coverage files and fixup source names + +echo "[INFO] ----- published coverage information ----------------------------------" +ls -al $gcov_dir +grep -i "0:Source:" $gcov_dir/*.gcov + +echo "------------------------------------------------------------------------------" +echo "run_app_tests finished" exit