Adjust coverage script after lcov upgrade 99/309199/1
authorDariusz Michaluk <d.michaluk@samsung.com>
Fri, 5 Apr 2024 10:48:00 +0000 (12:48 +0200)
committerDariusz Michaluk <d.michaluk@samsung.com>
Fri, 5 Apr 2024 11:09:54 +0000 (13:09 +0200)
Change-Id: I8b081432054352a7b37358f9bae973ac0fcbdb63

tests/device-certificate-manager-coverage.sh.in

index fc617c5a02c1faa4856d4cec79ab8549ee200c78..36fd5f73ef548041fee9ca4994553172d1e23301 100644 (file)
@@ -25,14 +25,26 @@ cp -r "@COVERAGE_BUILD_DIR@"/* "@COVERAGE_DIR@"
 
 # prepare report
 rm -f $STDERR
-lcov --no-external -c -d "@COVERAGE_DIR@" -b "@CMAKE_BINARY_DIR@" -o $REPORT 2>$STDERR
-lcov -r $REPORT "@CMAKE_BINARY_DIR@/tests/*" -o $REPORT
-lcov -r $REPORT "@CMAKE_BINARY_DIR@/src/dcm-client/dcm_support.pb.h" -o $REPORT 2>$STDERR
 
-# check warnings
+# Due to mismatch in the version of gcc/gcov and lcov, we need to ignore few errors
+IGNORE_ERRORS=" --ignore-errors unused,unused \
+                               --ignore-errors empty,empty \
+                               --ignore-errors mismatch,mismatch \
+                               --ignore-errors gcov,gcov "
+
+lcov $IGNORE_ERRORS --no-external -c -d "@COVERAGE_DIR@" -b "@CMAKE_BINARY_DIR@" -o $REPORT 2>$STDERR
+lcov $IGNORE_ERRORS -r $REPORT "@CMAKE_BINARY_DIR@/tests/*" -o $REPORT
+lcov $IGNORE_ERRORS -r $REPORT "@CMAKE_BINARY_DIR@/src/dcm-client/dcm_support.pb.h" -o $REPORT 2>$STDERR
+
+# Let's skip lcov warning
+# geninfo: WARNING: using JSON module "JSON::PP" - which is much slower than some alternatives.
+# Consider installing one of JSON::XS or Cpanel::JSON::XS
+sed -i '/WARNING/d' $STDERR
+
+# check errors
 if [ -s $STDERR ]
 then
-       echo "Warnings detected (see $STDERR). Aborting."
+       echo "Errors detected (see $STDERR). Aborting."
        exit 1
 fi