Skip to content

Commit

Permalink
bazel: Introduce do_not_build, do_no_run_test tags
Browse files Browse the repository at this point in the history
To test, added a "do_not_build" tag to a target that doesn't build, and
a "do_not_run_test" tag to a target that doesn't pass at runtime. The
wildcard build passed with both changes.

Fixed: 353531487
Change-Id: Ia864309377786beb997f5b6b2e50ee6c8b569a14
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/223492
Reviewed-by: Wyatt Hepler <hepler@google.com>
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
Commit-Queue: Ted Pudlik <tpudlik@google.com>
  • Loading branch information
tpudlik authored and CQ Bot Account committed Sep 16, 2024
1 parent eefd313 commit 4ceb5b8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
17 changes: 10 additions & 7 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,14 @@ common --experimental_exclude_starlark_flags_from_exec_config
common --//pw_toolchain/cc:cxx_standard=17
common:cxx20 --//pw_toolchain/cc:cxx_standard=20

# Also exclude integration tests from the default build. The test_tag_filters
# flag doesn't accumulate (https://github.com/bazelbuild/bazel/issues/7322): we
# have to specify it only once, setting all the exclusions in a comma-separated
# Skip building any targets tagged do_not_build.
build --build_tag_filters=-do_not_build

# Exclude integration tests from the default build. The test_tag_filters flag
# doesn't accumulate (https://github.com/bazelbuild/bazel/issues/7322): we have
# to specify it only once, setting all the exclusions in a comma-separated
# list.
test --test_tag_filters=-integration
test --test_tag_filters=-integration,-do_not_build,-do_not_run_test

# Required for combined code coverage reports.
coverage --experimental_generate_llvm_lcov
Expand Down Expand Up @@ -98,17 +101,17 @@ common:asan --//pw_toolchain/host_clang:asan
# TODO: https://github.com/bazelbuild/bazel/issues/7322 - We need to repeat the
# -integration because the test_tag_filters flag does not
# accumulate.
test:asan --test_tag_filters=-integration,-noasan
test:asan --test_tag_filters=-integration,-noasan,-do_not_build,-do_not_run_test

common:ubsan --//pw_toolchain/host_clang:ubsan
# TODO: https://github.com/bazelbuild/bazel/issues/7322 - We need to repeat the
# -integration because the test_tag_filters flag does not accumulate.
test:ubsan --test_tag_filters=-integration,-noubsan
test:ubsan --test_tag_filters=-integration,-noubsan,-do_not_build,-do_not_run_test

common:tsan --//pw_toolchain/host_clang:tsan
# TODO: https://github.com/bazelbuild/bazel/issues/7322 - We need to repeat the
# -integration because the test_tag_filters flag does not accumulate.
test:tsan --test_tag_filters=-integration,-notsan
test:tsan --test_tag_filters=-integration,-notsan,-do_not_build,-do_not_run_test

# Include libFuzzer build configurations.
import %workspace%/pw_fuzzer/libfuzzer.bazelrc
Expand Down
10 changes: 10 additions & 0 deletions docs/build_system.rst
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,16 @@ use the following additional tags:
will run all tests *except* for these integration tests.

* ``do_not_build``: targets which should not be built in wildcard builds. Any
use of this tag should be associated with a TODO pointing to a bug. Prefer
``do_not_build`` to ``manual`` if the target's build graph is correct, and
it just fails at the compilation stage.

* ``do_not_run_test``: test targets which should be built but not executed.
Prefer this to ``manual`` or ``do_not_build`` if the code compiles, but the
test fails at runtime. Any use of this tag should be associated with a TODO
pointing to a bug.

.. _docs-build_system-bazel_coverage:

Code Coverage
Expand Down

0 comments on commit 4ceb5b8

Please sign in to comment.