From 60a831d46ce6de6a5eed6bf63ae4f0f5087864ac Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Tue, 16 Jan 2024 08:28:34 +0100 Subject: [PATCH] Disable layering_check for OSS-Fuzz OSS-Fuzz builds fail with: ``` ERROR: /root/.cache/bazel/_bazel_root/17db7bb59affe64429348778697da03a/external/abseil-cpp~20230802.1/absl/strings/BUILD.bazel:591:11: Compiling absl/strings/internal/cordz_functions.cc failed: undeclared inclusion(s) in rule '@@abseil-cpp~20230802.1//absl/strings:cordz_functions': this rule is missing dependency declarations for the following files included by 'absl/strings/internal/cordz_functions.cc': 'bazel-out/k8-opt-ST-b76ee6246659/bin/external/abseil-cpp~20230802.1/absl/base/atomic_hook.cppmap' 'bazel-out/k8-opt-ST-b76ee6246659/bin/external/abseil-cpp~20230802.1/absl/base/errno_saver.cppmap' 'bazel-out/k8-opt-ST-b76ee6246659/bin/external/abseil-cpp~20230802.1/absl/base/log_severity.cppmap' ``` These files are emitted by Bazel when using the `layering_check` feature. This looks like a bug or breaking change in clang. --- .bazelrc | 2 +- .github/workflows/bazel_test.yml | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.bazelrc b/.bazelrc index 876b6f5..9179001 100644 --- a/.bazelrc +++ b/.bazelrc @@ -22,7 +22,7 @@ build --cxxopt=-std=c++14 build --sandbox_tmpfs_path=/tmp # Strict dependency check for C++ includes. -build --features=layering_check +build:ci --features=layering_check # Target Java 11 to squelch warnings about Java 8 being deprecated. build --java_language_version=11 diff --git a/.github/workflows/bazel_test.yml b/.github/workflows/bazel_test.yml index b724e46..e7be59c 100644 --- a/.github/workflows/bazel_test.yml +++ b/.github/workflows/bazel_test.yml @@ -45,10 +45,10 @@ jobs: libblocksruntime-dev - name: Run unit tests run: | - bazel test --test_tag_filters=-fuzz-test --build_tests_only //... + bazel test --test_tag_filters=-fuzz-test --build_tests_only --config=ci //... - name: Run Address Sanitizer tests run: | - bazel test --test_tag_filters=-fuzz-test --build_tests_only --config=asan //... + bazel test --test_tag_filters=-fuzz-test --build_tests_only --config=ci --config=asan //... fuzzer_run_tests: name: Brief fuzz test runs (C++) runs-on: ubuntu-20.04 @@ -72,7 +72,7 @@ jobs: libblocksruntime-dev - name: Run smoke test run: | - bazel run ${{ matrix.target }} --config=${{ matrix.config }} -- --clean --timeout_secs=5 + bazel run ${{ matrix.target }} --config=ci --config=${{ matrix.config }} -- --clean --timeout_secs=5 regression_tests: name: Regression tests (C++) runs-on: ubuntu-20.04 @@ -92,7 +92,7 @@ jobs: - name: Run regression tests run: | bazel test --verbose_failures --test_output=all \ - --build_tag_filters=fuzz-test --config=${{ matrix.config }} \ + --build_tag_filters=fuzz-test --config=ci --config=${{ matrix.config }} \ //examples:all coverage: name: Coverage gathering (C++) @@ -110,7 +110,7 @@ jobs: libblocksruntime-dev - name: Gather coverage run: | - bazel coverage //examples:re2_fuzz_test + bazel coverage --config=ci //examples:re2_fuzz_test - name: Check coverage report run: | grep "SF:examples/re2_fuzz_test.cc" bazel-out/_coverage/_coverage_report.dat @@ -129,7 +129,7 @@ jobs: run: sudo apt-get update && sudo apt-get install -yq clang - name: Run smoke test run: | - bazel run ${{ matrix.target }} --config=${{ matrix.config }} -- --clean --timeout_secs=5 + bazel run ${{ matrix.target }} --config=ci --config=${{ matrix.config }} -- --clean --timeout_secs=5 regression_tests_java: name: Regression tests (Java) runs-on: ubuntu-20.04 @@ -145,7 +145,7 @@ jobs: - name: Run regression tests run: | bazel test --verbose_failures --test_output=all \ - --build_tag_filters=fuzz-test --config=${{ matrix.config }} \ + --build_tag_filters=fuzz-test --config=ci --config=${{ matrix.config }} \ //examples/java/... regression_tests_gcc: name: Regression tests (GCC) @@ -157,7 +157,7 @@ jobs: - name: Run regression tests with GCC run: | bazel test --action_env=CC=gcc --action_env=CXX=g++ \ - --verbose_failures --test_output=all \ + --verbose_failures --test_output=all --config=ci \ //examples/... regression_tests_mac: name: Regression tests (macOS) @@ -168,7 +168,7 @@ jobs: uses: actions/checkout@v2 - name: Run regression tests on macOS run: | - bazel test --verbose_failures --test_output=all //examples/... + bazel test --verbose_failures --test_output=all --config=ci //examples/... bzlmod_examples_libfuzzer: name: Bzlmod examples (libFuzzer) runs-on: ubuntu-20.04 @@ -178,7 +178,8 @@ jobs: - name: Run regression tests on macOS run: | cd examples/bzlmod - bazel test --verbose_failures --test_output=all --@rules_fuzzing//fuzzing:cc_engine=@rules_fuzzing//fuzzing/engines:libfuzzer //... + bazel test --verbose_failures --test_output=all \ + --@rules_fuzzing//fuzzing:cc_engine=@rules_fuzzing//fuzzing/engines:libfuzzer //... bzlmod_examples_replay: name: Bzlmod examples (replay) runs-on: ubuntu-20.04 @@ -188,4 +189,5 @@ jobs: - name: Run regression tests on macOS run: | cd examples/bzlmod - bazel test --verbose_failures --test_output=all --@rules_fuzzing//fuzzing:cc_engine=@rules_fuzzing//fuzzing/engines:replay //... + bazel test --verbose_failures --test_output=all \ + --@rules_fuzzing//fuzzing:cc_engine=@rules_fuzzing//fuzzing/engines:replay //...