X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Funit_test.sh;h=fd6f2e24aa57597ec014c5da0ed4c2fe4d4ac9ad;hb=refs%2Fheads%2Fi-release;hp=c845553cf02474e917426b0bae190c6a5ad581f2;hpb=d486a17c04f3d6d865f787168d446f4cfea3be25;p=ric-plt%2Fxapp-frame-cpp.git diff --git a/test/unit_test.sh b/test/unit_test.sh index c845553..fd6f2e2 100755 --- a/test/unit_test.sh +++ b/test/unit_test.sh @@ -92,7 +92,17 @@ done echo "## INFO ##" echo "build dir=$build_dir" -find $build_dir -name "libricxfcpp.*" +if ! find $build_dir | grep "libricxfcpp.*" # find returns good even if none; must grep to see error +then + echo "building first..." + ( + cd $build_dir + make package + ) + + echo "build finished" + find $build_dir -name "libricxfcpp.*" +fi echo "## INFO ##" export LD_LIBRARY_PATH=$build_dir:/usr/local/lib:$LD_LIBRARY_PATH @@ -107,17 +117,21 @@ echo "tests successfully built" >&2 spew="cat" +# order here is important to ensure coverage files accumulate +tests="metrics_test jhash_test config_test unit_test" + #run everything, then generate coverage stats after all have run -for x in metrics_test jhash_test config_test unit_test +for x in $tests do ./$x >/tmp/PID$$.log 2>&1 abort_if_error $? "test failed: $x" + grep SUMMARY /tmp/PID$$.log done # it seems that we loose coverage reporting if metrics_test's gcov file is generated # after unit test. Very strange. To be safe, run unit_test last. # -for x in metrics_test jhash_test config_test unit_test +for x in $tests do gcov $x.c >/dev/null 2>&1 done