From 179e4903f1c2ad62c7e2ff50c85fd89cc5723c22 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Thu, 16 May 2024 15:16:10 -0700 Subject: [PATCH 1/8] CI: Avoid divide by zero error when generating coverage files --- testing/coverage/code_coverage.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/testing/coverage/code_coverage.sh b/testing/coverage/code_coverage.sh index 100f6b8f44..03eb9c3c35 100755 --- a/testing/coverage/code_coverage.sh +++ b/testing/coverage/code_coverage.sh @@ -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 } From b8e2f91fc92d63330070b0f6da13f5c22b630fad Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Mon, 20 May 2024 17:10:27 -0700 Subject: [PATCH 2/8] Update cmake submodule [nomail] --- cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake b/cmake index 925c32db4d..71ac5ebe5f 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 925c32db4d6d952ec43fa18a85d8bb70138b9257 +Subproject commit 71ac5ebe5ff61eb30c8f7b2973faacc6f16f88f2 From 77c938821177cfec3fc6f3a8fa2519b7c6f0a334 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Tue, 21 May 2024 12:36:03 -0700 Subject: [PATCH 3/8] CI: Switch asan build back to gcc 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). --- .cirrus.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 9f207fec2a..bb9e2ef2e4 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -394,8 +394,6 @@ asan_sanitizer_task: test_fuzzers_script: ./ci/test-fuzzers.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 From d36fbeb6d05ef9c06fcd7a396545eb610119e3e4 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Tue, 21 May 2024 12:36:30 -0700 Subject: [PATCH 4/8] CI: Re-enable coverage --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index bb9e2ef2e4..059c07c4c0 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -392,7 +392,7 @@ 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: CXXFLAGS: -DZEEK_DICT_DEBUG ZEEK_CI_CONFIGURE_FLAGS: *ASAN_SANITIZER_CONFIG From 0e0852a876894245385432f96ad1121bd6c31605 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Tue, 21 May 2024 14:08:59 -0700 Subject: [PATCH 5/8] Coverage: don't bother ignoring non-existent bro.dir files --- testing/coverage/lcov_html.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/coverage/lcov_html.sh b/testing/coverage/lcov_html.sh index 146d1fb89e..e858293e77 100755 --- a/testing/coverage/lcov_html.sh +++ b/testing/coverage/lcov_html.sh @@ -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 ../../ From e8f504c0c0167f86c01830d3506ed6974644fc87 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Tue, 21 May 2024 14:09:22 -0700 Subject: [PATCH 6/8] Coverage: Ignore a few errors during generation --- testing/coverage/lcov_html.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/coverage/lcov_html.sh b/testing/coverage/lcov_html.sh index e858293e77..2d166282fe 100755 --- a/testing/coverage/lcov_html.sh +++ b/testing/coverage/lcov_html.sh @@ -123,13 +123,13 @@ 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 # 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. From 0cd023b83919fca7bfac55e75a41f724e820fd26 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Tue, 21 May 2024 14:15:35 -0700 Subject: [PATCH 7/8] CI: Run coverage builds for PRs, but only upload on master --- ci/upload-coverage.sh | 5 ----- testing/coverage/lcov_html.sh | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ci/upload-coverage.sh b/ci/upload-coverage.sh index 250d8c90ef..ef0bdb6e42 100755 --- a/ci/upload-coverage.sh +++ b/ci/upload-coverage.sh @@ -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 diff --git a/testing/coverage/lcov_html.sh b/testing/coverage/lcov_html.sh index 2d166282fe..18898048b4 100755 --- a/testing/coverage/lcov_html.sh +++ b/testing/coverage/lcov_html.sh @@ -131,6 +131,11 @@ if [ $HTML_REPORT -eq 1 ]; then echo -n "Creating HTML files... " 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..." From 5f75d4bc0bd79d213d67cdacea2ff9a8cb55b1d6 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Tue, 21 May 2024 14:35:17 -0700 Subject: [PATCH 8/8] CI: Remove --enable-werror for asan builds 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. --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index 059c07c4c0..54458bfd38 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -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