The jenkins wrapper script that drives unit test for sonar needs
to "see" a build in the source directory in order to actually
trigger the scan. This change ensures this happens in the unit
test script which is driven by the jenkins jobs (via CMake
created build).
Issue-ID: RIC-632
Signed-off-by: E. Scott Daniels <daniels@research.att.com>
Change-Id: I1d4641d724498ba27f900b3146db909c61779223
# 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.
#
# 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
# -------------------------------------------------------------------------
# Date: 10 December 2019
# Author: E. Scott Daniels
# -------------------------------------------------------------------------
running=/tmp/PID$$.running
force_rmr_load=0
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
while [[ $1 == -* ]]
do
case $1 in
-f) force_rmr_load=1;;
-N) no_rmr_load=1;; # for local testing
-f) force_rmr_load=1;;
-N) no_rmr_load=1;; # for local testing
ensure_pkgs # ensure that we have RMR; some CI environments are lacking
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
+ make
+ )
+fi
+
+echo "building unit test(s)"
if ! make -B unit_test # ensure that it's fresh
then
echo "[FAIL] cannot make unit_test"
if ! make -B unit_test # ensure that it's fresh
then
echo "[FAIL] cannot make unit_test"
+cp *.gcov ../ # jjb description points to top listener dir for sonar to find gcov files
+
rm -f /tmp/PID$$.*
exit $rc
rm -f /tmp/PID$$.*
exit $rc