Skip to content

Commit

Permalink
Disable layering_check for OSS-Fuzz
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fmeum committed Jan 16, 2024
1 parent ccf709f commit 60a831d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 13 additions & 11 deletions .github/workflows/bazel_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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++)
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 //...

0 comments on commit 60a831d

Please sign in to comment.