diff --git a/.bazelrc b/.bazelrc index 96f6099d86..77d574421a 100644 --- a/.bazelrc +++ b/.bazelrc @@ -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 @@ -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 diff --git a/docs/build_system.rst b/docs/build_system.rst index c7930dc97e..b59957c0c0 100644 --- a/docs/build_system.rst +++ b/docs/build_system.rst @@ -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