diff --git a/.coverity.conf.sample b/.coverity.conf.sample index 3ed4be64b..5caf5d6fb 100644 --- a/.coverity.conf.sample +++ b/.coverity.conf.sample @@ -4,9 +4,13 @@ COVTOKEN=aAbBcCdDeEfFgGhHiIjJkK COVBINDIR="/opt/cov-analysis-linux64-2019.03/bin" # Nickname included in scan description: NICKNAME=myself +# cov can't read gcov from gcc > 7 +HOSTCC=gcc-7 +HOSTCXX=g++-7 +HOSTLD=g++-7 +# Do not change it: COVDIR=cov-int -COVBUILD="cov-build --dir $COVDIR" # Depending if your kernel > 4.8.x, you might need to activate this to run Coverity executables # (but latest tools with kernel 5.2 run fine) diff --git a/covbuild.sh b/covbuild.sh index bd06630d4..4784a1de6 100755 --- a/covbuild.sh +++ b/covbuild.sh @@ -5,16 +5,39 @@ set -e pre_build_hook -rm -rf "$COVDIR" -mkdir "$COVDIR" +mkdir -p "$COVDIR" make clean -$COVBUILD make -j 4 bootrom -$COVBUILD make -j 4 fullimage -$COVBUILD make -j 4 mfkey -$COVBUILD make -j 4 nonce2key -$COVBUILD make -j 4 fpga_compress +cov-build --dir "$COVDIR" --initialize + +######################################### +# Build Host prerequisites # +######################################### +cov-build --dir "$COVDIR" --c-coverage=gcov --no-network-coverage --no-generate-build-id --force make CC=$HOSTCC CXX=$HOSTCXX LD=$HOSTLD fpga_compress + +######################################### +# Build ARM, no test coverage # +######################################### +cov-build --dir "$COVDIR" --no-generate-build-id --force make bootrom +cov-build --dir "$COVDIR" --no-generate-build-id --force make fullimage + +######################################### +# Build client # +######################################### # make sure to do client after ARM because Coverity retains one build info per file # and we want the client-side of the common/ analysis -$COVBUILD make -j 4 client +cov-build --dir "$COVDIR" --c-coverage=gcov --no-network-coverage --no-generate-build-id --force make CC=$HOSTCC CXX=$HOSTCXX LD=$HOSTLD mfkey +cov-build --dir "$COVDIR" --c-coverage=gcov --no-network-coverage --no-generate-build-id --force make CC=$HOSTCC CXX=$HOSTCXX LD=$HOSTLD nonce2key +cov-build --dir "$COVDIR" --c-coverage=gcov --no-network-coverage --no-generate-build-id --force make CC=$HOSTCC CXX=$HOSTCXX LD=$HOSTLD client + +######################################### +# Run tests # +######################################### +cov-build --dir "$COVDIR" --c-coverage=gcov --no-network-coverage --test-capture ./pm3test.sh +#cov-manage-emit --dir "$COVDIR" list-coverage-known + +######################################### +# Import Git annotations (~ git blame) # +######################################### +cov-import-scm --dir "$COVDIR" --scm git --filename-regex "$PWD" --log ""$COVDIR"/cov-import-scm-log.txt" post_build_hook diff --git a/covconfig.sh b/covconfig.sh index 5f4878b3c..24815f200 100755 --- a/covconfig.sh +++ b/covconfig.sh @@ -3,4 +3,7 @@ set -e . .coverity.conf || exit 1 +# cov-configure --list-configured-compilers text cov-configure --template --compiler arm-none-eabi-gcc --comptype gcc +# cov can't read gcov from gcc > 7 +cov-configure --template --compiler $HOSTCC --comptype gcc