aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2022-07-03 19:50:13 +0700
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2022-07-04 14:39:30 +0700
commitaaeab8c976a478309477e4200c1aef51407f6152 (patch)
tree8460e228fb47eda87456d026281485fe42bdf9af
parent618f171cb1173e6e665a282b611f938c9c337925 (diff)
coverity: compile tests, but not execute them
Compiling unit tests would allow Coverity to analyze them too and thus find more bugs. The problem is that binaries listed in check_PROGRAMS are not compiled during 'make all', but only during 'make check'. One approach [1] is to run 'make check' in do_build(), however it breaks 'Coverity-Upload' job because some unit tests are failing. This is why I had to revert bf84ba9f69a0a2125bfd4327519b0e6fa212d664 together with ae41942214ef43bbb6aeb257bad2985765035ad7 that was supposed to fix it. Even if all unit tests were passing, we still don't want to execute them because running tests is beyond the scope of 'Coverity-Upload' job. Another approach is to patch Makefile.am files replacing check_PROGRAMS with noinst_PROGRAMS, so that the test binaries are compiled during 'make all' but not executed. Change-Id: Idf0714a59356633021be21acc47f9471d059b7fe Related: [1] I3f3149a61df96646798c72d0ad31c41b97e6b81f
-rwxr-xr-xcoverity/prepare_source_Osmocom.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/coverity/prepare_source_Osmocom.sh b/coverity/prepare_source_Osmocom.sh
index 452af3e..22d72e7 100755
--- a/coverity/prepare_source_Osmocom.sh
+++ b/coverity/prepare_source_Osmocom.sh
@@ -47,6 +47,13 @@ for proj in \
else
git clone git://git.osmocom.org/$proj
fi
+
+ # We want to compile tests, but not execute them. Using 'noinst_PROGRAMS'
+ # instead of 'check_PROGRAMS' allows building test binaries during 'make all'.
+ files="$(git -C $proj grep -l check_PROGRAMS)"
+ if [ -n "$files" ]; then
+ sed -i "s/check_PROGRAMS/noinst_PROGRAMS/" $files
+ fi
done
if ! [ -d layer1-api ]; then