Add rebuild to unit test script if no lib found 43/4543/1
authorE. Scott Daniels <daniels@research.att.com>
Thu, 13 Aug 2020 16:48:38 +0000 (12:48 -0400)
committerE. Scott Daniels <daniels@research.att.com>
Thu, 13 Aug 2020 16:48:38 +0000 (12:48 -0400)
The sonar jenkins jobs do not force a build which is now a problem
for the unit tests as some of them require the framework library
to be found.  This change adds a build step to the unit test
script if the library is missing which will allow the sonar jobs
to run.

Issue-ID: RIC-634

Signed-off-by: E. Scott Daniels <daniels@research.att.com>
Change-Id: I34e9a9bf5c6db1a868e390cdfa855e24c0b3b410

test/unit_test.sh

index c845553..a4f9d0a 100755 (executable)
@@ -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