Skip to content

Commit

Permalink
Move test tag filters to .bazelrc and add "no" prefix.
Browse files Browse the repository at this point in the history
The previous "asan" filter doesn't make it clear that the
target shouldn't run in that configuration, and in practice
people used "noasan" instead.

Moving the tags to .bazelrc ensures that they're applied to
all builds, regardless of how they're invoked.

This also removes the build_tag_filters since it's useful to
verify that a target compiles during CI builds, even if it's
not possible to run the test with asan.

Bug: 374131426
Change-Id: I1f0b49a8e9b7b855470ba8000797092887c18f67
  • Loading branch information
bmclarnon committed Oct 24, 2024
1 parent f7dcd5f commit 65e01fc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ build:asan --copt=-fsanitize=address
build:asan --copt=-fno-omit-frame-pointer
build:asan --linkopt=-fsanitize=address
build:asan --action_env=ASAN_OPTIONS=strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1:detect_leaks=1
test:asan --test_tag_filters=-noasan

build:tsan --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux
build:tsan --compilation_mode=dbg
Expand All @@ -35,6 +36,7 @@ build:tsan --copt=-O1
build:tsan --copt=-fno-omit-frame-pointer
build:tsan --linkopt=-fsanitize=thread
build:tsan --action_env TSAN_OPTIONS=halt_on_error=1:second_deadlock_stack=1
test:tsan --test_tag_filters=-notsan

build:ubsan --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux
build:ubsan --compilation_mode=dbg
Expand All @@ -49,6 +51,7 @@ build:ubsan --linkopt=-fsanitize=undefined
# work around linker errors.
build:ubsan --linkopt=-fsanitize-link-c++-runtime
build:ubsan --action_env UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1
test:ubsan --test_tag_filters=-noubsan

# Settings for remote build execution.
build:cfc-remote --experimental_allow_tags_propagation
Expand Down
8 changes: 4 additions & 4 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ set -x
readonly BAZELISK="${BAZELISK:-bazelisk}"

if [ "$1" == "continuous" ]; then
${BAZELISK} test //... --config=asan --build_tag_filters=-asan --test_tag_filters=-asan
${BAZELISK} test //... --config=asan
elif [ "$1" == "sanitizers" ]; then
${BAZELISK} test //... --config=asan --build_tag_filters=-asan --test_tag_filters=-asan
${BAZELISK} test //... --config=tsan --build_tag_filters=-tsan --test_tag_filters=-tsan
${BAZELISK} test //... --config=ubsan --build_tag_filters=-noubsan --test_tag_filters=-noubsan
${BAZELISK} test //... --config=asan
${BAZELISK} test //... --config=tsan
${BAZELISK} test //... --config=ubsan
elif [ "$1" == "release" ]; then
${BAZELISK} test //...

Expand Down

0 comments on commit 65e01fc

Please sign in to comment.