Merge remote-tracking branch 'origin/topic/timw/fix-coverage-part-deux'

* origin/topic/timw/fix-coverage-part-deux:
  CI: Remove --enable-werror for asan builds
  CI: Run coverage builds for PRs, but only upload on master
  Coverage: Ignore a few errors during generation
  Coverage: don't bother ignoring non-existent bro.dir files
  CI: Re-enable coverage
  CI: Switch asan build back to gcc
  Update cmake submodule [nomail]
  CI: Avoid divide by zero error when generating coverage files
This commit is contained in:
Tim Wojtulewicz 2024-05-21 16:22:57 -07:00
commit afc89c0480
7 changed files with 42 additions and 17 deletions

View file

@ -14,7 +14,7 @@ config: &CONFIG --build-type=release --disable-broker-tests --prefix=$CIRRUS_WOR
no_spicy_config: &NO_SPICY_CONFIG --build-type=release --disable-broker-tests --disable-spicy --prefix=$CIRRUS_WORKING_DIR/install --ccache --enable-werror
static_config: &STATIC_CONFIG --build-type=release --disable-broker-tests --enable-static-broker --enable-static-binpac --prefix=$CIRRUS_WORKING_DIR/install --ccache --enable-werror
binary_config: &BINARY_CONFIG --prefix=$CIRRUS_WORKING_DIR/install --libdir=$CIRRUS_WORKING_DIR/install/lib --binary-package --enable-static-broker --enable-static-binpac --disable-broker-tests --build-type=Release --ccache --enable-werror
asan_sanitizer_config: &ASAN_SANITIZER_CONFIG --build-type=debug --disable-broker-tests --sanitizers=address --enable-fuzzers --enable-coverage --disable-spicy --ccache --enable-werror
asan_sanitizer_config: &ASAN_SANITIZER_CONFIG --build-type=debug --disable-broker-tests --sanitizers=address --enable-fuzzers --enable-coverage --disable-spicy --ccache
ubsan_sanitizer_config: &UBSAN_SANITIZER_CONFIG --build-type=debug --disable-broker-tests --sanitizers=undefined --enable-fuzzers --disable-spicy --ccache --enable-werror
tsan_sanitizer_config: &TSAN_SANITIZER_CONFIG --build-type=debug --disable-broker-tests --sanitizers=thread --enable-fuzzers --disable-spicy --ccache --enable-werror
@ -392,10 +392,8 @@ asan_sanitizer_task:
<< : *CI_TEMPLATE
test_fuzzers_script: ./ci/test-fuzzers.sh
# coverage_script: ./ci/upload-coverage.sh
coverage_script: ./ci/upload-coverage.sh
env:
CC: clang-18
CXX: clang++-18
CXXFLAGS: -DZEEK_DICT_DEBUG
ZEEK_CI_CONFIGURE_FLAGS: *ASAN_SANITIZER_CONFIG
ASAN_OPTIONS: detect_leaks=1:detect_odr_violation=0

25
CHANGES
View file

@ -1,3 +1,28 @@
7.0.0-dev.280 | 2024-05-21 16:22:57 -0700
* CI: Remove --enable-werror for asan builds (Tim Wojtulewicz, Corelight)
There's a bug in GCC (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105562) that
causes std::regex to emit some warnings when built with -fsanitize=address. Any
warnings that actually mean anything would be caught by the other sanitizer
builds or by the regular ubuntu24 build.
* CI: Run coverage builds for PRs, but only upload on master (Tim Wojtulewicz, Corelight)
* Coverage: Ignore a few errors during generation (Tim Wojtulewicz, Corelight)
* Coverage: don't bother ignoring non-existent bro.dir files (Tim Wojtulewicz, Corelight)
* CI: Re-enable coverage (Tim Wojtulewicz, Corelight)
* CI: Switch asan build back to gcc (Tim Wojtulewicz, Corelight)
The tools used for coverage (gcov, lcov) work better with GCC. We could switch
over to similar tools for llvm, but they way they store files during coverage
builds don't work as well for us (mostly the places they store the files).
* CI: Avoid divide by zero error when generating coverage files (Tim Wojtulewicz, Corelight)
7.0.0-dev.270 | 2024-05-20 15:54:09 -0700
* Fix for suppressing SMB logging of previously-logged files (Vern Paxson, Corelight)

View file

@ -1 +1 @@
7.0.0-dev.270
7.0.0-dev.280

View file

@ -11,11 +11,6 @@ if [ "${CIRRUS_REPO_FULL_NAME}" != "zeek/zeek" ]; then
exit 0
fi
if [ "${CIRRUS_BRANCH}" != "master" ]; then
echo "Coverage upload skipped for non-master branches"
exit 0
fi
cd testing/coverage
make coverage
make coveralls

2
cmake

@ -1 +1 @@
Subproject commit 925c32db4d6d952ec43fa18a85d8bb70138b9257
Subproject commit 71ac5ebe5ff61eb30c8f7b2973faacc6f16f88f2

View file

@ -90,9 +90,11 @@ function check_group_coverage {
TOTAL=$(echo $(grep "$i" $DATA | cut -f 3) | tr " " "+" | bc)
fi
PERCENTAGE=$(echo "scale=3;100*$RUN/$TOTAL" | bc | tr "\n" " ")
printf "%-50s\t%12s\t%6s %%\n" "$i" "$RUN/$TOTAL" $PERCENTAGE |
sed 's|#|/|g' >>$OUTPUT
if [ $TOTAL -ne 0 ]; then
PERCENTAGE=$(echo "scale=3;100*$RUN/$TOTAL" | bc | tr "\n" " ")
printf "%-50s\t%12s\t%6s %%\n" "$i" "$RUN/$TOTAL" $PERCENTAGE |
sed 's|#|/|g' >>$OUTPUT
fi
done
}

View file

@ -93,7 +93,7 @@ fi
# Files and directories that will be removed from the counts in step 5. Directories
# need to be surrounded by escaped wildcards.
REMOVE_TARGETS="*.yy *.ll *.y *.l \*/bro.dir/\* *.bif \*/zeek.dir/\* \*/src/3rdparty/\* \*/src/zeek/3rdparty/\* \*/auxil/\* \*/build/zeek/3rdparty/\*"
REMOVE_TARGETS="*.yy *.ll *.y *.l *.bif \*/zeek.dir/\* \*/src/3rdparty/\* \*/src/zeek/3rdparty/\* \*/auxil/\* \*/build/zeek/3rdparty/\*"
# 1. Move to base dir, create tmp dir
cd ../../
@ -123,14 +123,19 @@ verify_run "lcov --no-external --capture --directory . --output-file $COVERAGE_F
# Zeek coverage numbers.
for TARGET in $REMOVE_TARGETS; do
echo -n "Getting rid of $TARGET files from tracefile... "
verify_run "lcov --remove $COVERAGE_FILE $TARGET --output-file $COVERAGE_FILE"
verify_run "lcov --ignore-errors unused,empty --remove $COVERAGE_FILE $TARGET --output-file $COVERAGE_FILE"
done
# 6. Create HTML files or Coveralls report
if [ $HTML_REPORT -eq 1 ]; then
echo -n "Creating HTML files... "
verify_run "genhtml -o $COVERAGE_HTML_DIR $COVERAGE_FILE"
verify_run "genhtml --ignore-errors empty -o $COVERAGE_HTML_DIR $COVERAGE_FILE"
else
if [ "${CIRRUS_BRANCH}" != "master" ]; then
echo "Coverage upload skipped for non-master branches"
exit 0
fi
# The data we send to coveralls has a lot of duplicate files in it because of the
# zeek symlink in the src directory. Run a script that cleans that up.
echo -n "Cleaning coverage data for Coveralls..."