diff --git a/MODULE.bazel b/MODULE.bazel index 1c45fc9e1..5207e27c9 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -14,6 +14,14 @@ module(name = "score_communication") bazel_dep(name = "platforms", version = "1.0.0") +# Centralized sanitizer policies (ASan, TSan, UBSan, LSan) +bazel_dep(name = "score_cpp_policies", version = "0.0.0", dev_dependency = True) +git_override( + module_name = "score_cpp_policies", + commit = "10fd9147eaaa8f2b829bc9b1d50213159415a9c8", # tip of rs/swp-245137 branch + remote = "https://github.com/RSingh1511/score_cpp_policies.git", +) + bazel_dep(name = "gcc_toolchain", version = "0.9.0", dev_dependency = True) gcc_toolchains = use_extension("@gcc_toolchain//toolchain:module_extensions.bzl", "gcc_toolchains", dev_dependency = True) @@ -96,7 +104,12 @@ toolchains_qnx.sdp( ) use_repo(toolchains_qnx, "toolchains_qnx_ifs") -bazel_dep(name = "toolchains_llvm", version = "1.5.0", dev_dependency = True) +bazel_dep(name = "toolchains_llvm", version = "1.7.0", dev_dependency = True) +git_override( + module_name = "toolchains_llvm", + commit = "576a587e4542733166ac1c3c4fb14c79c421332c", + remote = "https://github.com/bazel-contrib/toolchains_llvm", +) llvm = use_extension( "@toolchains_llvm//toolchain/extensions:llvm.bzl", @@ -118,12 +131,17 @@ llvm.toolchain( "-Wthread-safety", ]}, cxx_standard = {"": "c++17"}, + extra_known_features = [ + "@score_cpp_policies//sanitizers/features:asan_ubsan_lsan_link", + "@score_cpp_policies//sanitizers/features:tsan_link", + ], link_libs = {"": [ "-lrt", # This is the agreed way to ensure linking for targets using std::atomic operations. "-latomic", ]}, llvm_version = "19.1.7", + stdlib = {"": "stdc++"}, ) use_repo(llvm, "llvm_toolchain") @@ -170,7 +188,7 @@ download_file( urls = ["https://github.com/muttleyxd/clang-tools-static-binaries/releases/download/master-2da3e7b/clang-format-19_linux-amd64"], ) -bazel_dep(name = "rules_cc", version = "0.1.5") +bazel_dep(name = "rules_cc", version = "0.2.17") bazel_dep(name = "aspect_rules_lint", version = "2.2.0", dev_dependency = True) bazel_dep(name = "googletest", version = "1.17.0.bcr.2", dev_dependency = True) diff --git a/quality/integration_testing/integration_testing.bzl b/quality/integration_testing/integration_testing.bzl index b6003cc06..538f5b2ed 100644 --- a/quality/integration_testing/integration_testing.bzl +++ b/quality/integration_testing/integration_testing.bzl @@ -51,14 +51,14 @@ def integration_test(name, srcs, filesystem, **kwargs): }), os = "linux", env = select({ - "//quality/sanitizer/flags:none": None, - "//quality/sanitizer/flags:any_sanitizer": "//quality/sanitizer:absolute_env", + "@score_cpp_policies//sanitizers/flags:none": None, + "@score_cpp_policies//sanitizers/flags:any_sanitizer": "@score_cpp_policies//sanitizers:absolute_env", }), tars = [ filesystem, ] + select({ - "//quality/sanitizer/flags:none": [], - "//quality/sanitizer/flags:any_sanitizer": ["//quality/sanitizer:suppressions_pkg"], + "@score_cpp_policies//sanitizers/flags:none": [], + "@score_cpp_policies//sanitizers/flags:any_sanitizer": ["//quality/integration_testing/sanitizer_support:suppressions_pkg"], }) + [ "@ubuntu24_04//:ubuntu24_04", ], @@ -167,7 +167,7 @@ def integration_test(name, srcs, filesystem, **kwargs): _extend_list_in_kwargs_without_duplicates( kwargs, "target_compatible_with", - ["//quality/sanitizer/constraints:no_tsan"], + ["@score_cpp_policies//sanitizers/constraints:no_tsan"], ) _extend_list_in_kwargs_without_duplicates( diff --git a/quality/sanitizer/test_workspace/BUILD.tpl b/quality/integration_testing/sanitizer_support/BUILD similarity index 57% rename from quality/sanitizer/test_workspace/BUILD.tpl rename to quality/integration_testing/sanitizer_support/BUILD index 2b138b505..b5b178335 100644 --- a/quality/sanitizer/test_workspace/BUILD.tpl +++ b/quality/integration_testing/sanitizer_support/BUILD @@ -1,5 +1,5 @@ # ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation +# Copyright (c) 2026 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional # information regarding copyright ownership. @@ -11,17 +11,15 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* -cc_test( - name = "asan_fail_heap_out_of_bounds", - srcs = ["asan_fail_heap_out_of_bounds.cpp"], -) - -cc_test( - name = "lsan_fail_leak", - srcs = ["lsan_fail_leak.cpp"], -) +load("@rules_pkg//pkg:tar.bzl", "pkg_tar") -cc_test( - name = "tsan_fail_data_race", - srcs = ["tsan_fail_data_race.cpp"], +pkg_tar( + name = "suppressions_pkg", + srcs = [ + "//quality/sanitizer:repo_suppressions", + "@score_cpp_policies//sanitizers:suppressions", + ], + mode = "0444", + package_dir = "sanitizers/suppressions", + visibility = ["//visibility:public"], ) diff --git a/quality/sanitizer/BUILD b/quality/sanitizer/BUILD index bdaee0f14..e396a2847 100644 --- a/quality/sanitizer/BUILD +++ b/quality/sanitizer/BUILD @@ -11,92 +11,13 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* -load("@rules_pkg//pkg:tar.bzl", "pkg_tar") -load("//bazel/rules:expand_template.bzl", "expand_template") - -sh_test( - name = "sanitizers_functional_test", - srcs = ["sanitizers_functional_test.sh"], - data = [ - "sanitizer.bazelrc", - "test_workspace/BUILD.tpl", - "test_workspace/MODULE.bazel", - "test_workspace/asan_fail_heap_out_of_bounds.cpp", - "test_workspace/lsan_fail_leak.cpp", - "test_workspace/tsan_fail_data_race.cpp", - ], - env_inherit = [ - "PATH", - "http_proxy", - "https_proxy", - ], - tags = [ - "local", # Test marked local because it uses bazel. - "manual", # Due to long-runtime and local dependencies - ], - deps = ["@bazel_tools//tools/bash/runfiles"], -) - -filegroup( - name = "env_template", - srcs = select({ - "//quality/sanitizer/flags:tsan": ["tsan.env.template"], - "//quality/sanitizer/flags:asan_ubsan_lsan": ["asan_ubsan_lsan.env.template"], - }), - target_compatible_with = ["//quality/sanitizer/constraints:any_sanitizer"], -) - -[ - expand_template( - name = name + "_env", - out = name + "_sanitizer.env", - substitutions = { - "%ROOT%": root, - }, - target_compatible_with = ["//quality/sanitizer/constraints:any_sanitizer"], - template = ":env_template", - visibility = ["//:__subpackages__"], - ) - for name, root in ( - [ - "absolute", - "/", - ], - [ - "relative", - "./", - ], - ) -] - filegroup( - name = "suppressions", - srcs = select({ - "//quality/sanitizer/flags:tsan": ["tsan.supp"], - "//quality/sanitizer/flags:asan_ubsan_lsan": [ - "asan.supp", - "lsan.supp", - "ubsan.supp", - ], - }), - target_compatible_with = ["//quality/sanitizer/constraints:any_sanitizer"], -) - -pkg_tar( - name = "suppressions_pkg", - srcs = [":suppressions"], - mode = "0444", - package_dir = "quality/sanitizer", - target_compatible_with = ["//quality/sanitizer/constraints:any_sanitizer"], - visibility = ["//:__subpackages__"], -) - -sh_binary( - name = "wrapper", - srcs = ["wrapper.sh"], - data = [ - ":relative_env", - ":suppressions", + name = "repo_suppressions", + srcs = [ + "asan.supp", + "lsan.supp", + "tsan.supp", + "ubsan.supp", ], - target_compatible_with = ["//quality/sanitizer/constraints:any_sanitizer"], + visibility = ["//quality/integration_testing/sanitizer_support:__pkg__"], ) diff --git a/quality/sanitizer/asan_ubsan_lsan.env.template b/quality/sanitizer/asan_ubsan_lsan.env.template deleted file mode 100644 index 1842d7a18..000000000 --- a/quality/sanitizer/asan_ubsan_lsan.env.template +++ /dev/null @@ -1,3 +0,0 @@ -ASAN_OPTIONS=exitcode=55 allow_addr2line=1 verbosity=1 coverage=1 check_initialization_order=1 detect_stack_use_after_return=1 print_stats=1 halt_on_error=1 allocator_may_return_null=1 detect_leaks=1 suppressions=%ROOT%quality/sanitizer/asan.supp -UBSAN_OPTIONS=exitcode=55 allow_addr2line=1 verbosity=1 coverage=1 print_stacktrace=1 halt_on_error=1 suppressions=%ROOT%quality/sanitizer/ubsan.supp -LSAN_OPTIONS=exitcode=55 suppressions=%ROOT%quality/sanitizer/lsan.supp diff --git a/quality/sanitizer/constraints/BUILD b/quality/sanitizer/constraints/BUILD deleted file mode 100644 index 8d7b7beb3..000000000 --- a/quality/sanitizer/constraints/BUILD +++ /dev/null @@ -1,49 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# ******************************************************************************* - -constraint_setting( - name = "dummy_setting", - default_constraint_value = ":always_true", -) - -constraint_value( - name = "always_true", - constraint_setting = ":dummy_setting", -) - -alias( - name = "any_sanitizer", - actual = select({ - "//quality/sanitizer/flags:any_sanitizer": ":always_true", - "//conditions:default": "@platforms//:incompatible", - }), - visibility = ["//:__subpackages__"], -) - -alias( - name = "no_asan_ubsan_lsan", - actual = select({ - "//quality/sanitizer/flags:asan_ubsan_lsan": "@platforms//:incompatible", - "//conditions:default": ":always_true", - }), - visibility = ["//:__subpackages__"], -) - -alias( - name = "no_tsan", - actual = select({ - "//quality/sanitizer/flags:tsan": "@platforms//:incompatible", - "//conditions:default": ":always_true", - }), - visibility = ["//:__subpackages__"], -) diff --git a/quality/sanitizer/flags/BUILD b/quality/sanitizer/flags/BUILD deleted file mode 100644 index 622e790a5..000000000 --- a/quality/sanitizer/flags/BUILD +++ /dev/null @@ -1,51 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# ******************************************************************************* - -load("@bazel_skylib//lib:selects.bzl", "selects") -load("@bazel_skylib//rules:common_settings.bzl", "string_flag") - -string_flag( - name = "sanitizer", - build_setting_default = "none", - values = [ - "none", - "asan_ubsan_lsan", - "tsan", - ], -) - -config_setting( - name = "none", - flag_values = {":sanitizer": "none"}, - visibility = ["//:__subpackages__"], -) - -config_setting( - name = "asan_ubsan_lsan", - flag_values = {":sanitizer": "asan_ubsan_lsan"}, - visibility = ["//:__subpackages__"], -) - -config_setting( - name = "tsan", - flag_values = {":sanitizer": "tsan"}, - visibility = ["//:__subpackages__"], -) - -selects.config_setting_group( - name = "any_sanitizer", - match_any = [ - ":asan_ubsan_lsan", - ":tsan", - ], -) diff --git a/quality/sanitizer/sanitizer.bazelrc b/quality/sanitizer/sanitizer.bazelrc index 11c74d3a6..1c13a0044 100644 --- a/quality/sanitizer/sanitizer.bazelrc +++ b/quality/sanitizer/sanitizer.bazelrc @@ -11,35 +11,33 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* -# todo: Extract to toolchain feature once possible +# ============================================================================== +# Sanitizer Configurations (adapted from @score_cpp_policies) +# ============================================================================== -test:with_debug_symbols --cxxopt -gline-tables-only -test:with_debug_symbols --cxxopt -gcolumn-info +# Debug symbols for sanitizer stack traces +test:with_debug_symbols --cxxopt=-g1 test:with_debug_symbols --strip=never +# ASan + UBSan + LSan (Combined) test:asan_ubsan_lsan --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux test:asan_ubsan_lsan --extra_toolchains=@ferrocene_x86_64_unknown_linux_gnu_llvm//:rust_ferrocene_toolchain +test:asan_ubsan_lsan --features=asan_ubsan_lsan_link +build:asan_ubsan_lsan --platform_suffix=asan_ubsan_lsan test:asan_ubsan_lsan --config=with_debug_symbols -test:asan_ubsan_lsan --run_under=//quality/sanitizer:wrapper -test:asan_ubsan_lsan --//quality/sanitizer/flags:sanitizer=asan_ubsan_lsan -test:asan_ubsan_lsan --cxxopt -fsanitize=undefined,address,leak -test:asan_ubsan_lsan --cxxopt -fno-omit-frame-pointer -test:asan_ubsan_lsan --cxxopt -fno-common -test:asan_ubsan_lsan --linkopt -fsanitize=undefined,address,leak -test:asan_ubsan_lsan --linkopt -fsanitize-link-c++-runtime -test:asan_ubsan_lsan --platform_suffix=asan_ubsan +test:asan_ubsan_lsan --@score_cpp_policies//sanitizers/flags:sanitizer=asan_ubsan_lsan +test:asan_ubsan_lsan --run_under=@score_cpp_policies//sanitizers:wrapper -test:asan --config=asan_ubsan_lsan -test:ubsan --config=asan_ubsan_lsan -test:lsan --config=asan_ubsan_lsan +# Shortcuts for individual sanitizers +build:asan --config=asan_ubsan_lsan +build:ubsan --config=asan_ubsan_lsan +build:lsan --config=asan_ubsan_lsan +# ThreadSanitizer test:tsan --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux test:tsan --extra_toolchains=@ferrocene_x86_64_unknown_linux_gnu_llvm//:rust_ferrocene_toolchain +test:tsan --features=tsan_link +build:tsan --platform_suffix=tsan test:tsan --config=with_debug_symbols -test:tsan --run_under=//quality/sanitizer:wrapper -test:tsan --//quality/sanitizer/flags:sanitizer=tsan -test:tsan --cxxopt -fsanitize=thread -test:tsan --cxxopt -O1 -test:tsan --linkopt -fsanitize=thread -test:tsan --linkopt -fsanitize-link-c++-runtime -test:tsan --platform_suffix=tsan +test:tsan --@score_cpp_policies//sanitizers/flags:sanitizer=tsan +test:tsan --run_under=@score_cpp_policies//sanitizers:wrapper diff --git a/quality/sanitizer/sanitizers_functional_test.sh b/quality/sanitizer/sanitizers_functional_test.sh deleted file mode 100755 index b0cde5c8a..000000000 --- a/quality/sanitizer/sanitizers_functional_test.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env bash - -# ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# ******************************************************************************* - -# --- begin runfiles.bash initialization --- -# Copy-pasted from Bazel's Bash runfiles library (tools/bash/runfiles/runfiles.bash). -#set -euo pipefail -if [[ ! -d "${RUNFILES_DIR:-/dev/null}" && ! -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then - if [[ -f "$0.runfiles_manifest" ]]; then - export RUNFILES_MANIFEST_FILE="$0.runfiles_manifest" - elif [[ -f "$0.runfiles/MANIFEST" ]]; then - export RUNFILES_MANIFEST_FILE="$0.runfiles/MANIFEST" - elif [[ -f "$0.runfiles/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then - export RUNFILES_DIR="$0.runfiles" - fi -fi -if [[ -f "${RUNFILES_DIR:-/dev/null}/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then - source "${RUNFILES_DIR}/bazel_tools/tools/bash/runfiles/runfiles.bash" -elif [[ -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then - source "$(grep -m1 "^bazel_tools/tools/bash/runfiles/runfiles.bash " \ - "$RUNFILES_MANIFEST_FILE" | cut -d ' ' -f 2-)" -else - echo >&2 "ERROR: cannot find @bazel_tools//tools/bash/runfiles:runfiles.bash" - exit 1 -fi -# --- end runfiles.bash initialization --- - -rm -rf test_workspace -mkdir -p test_workspace -touch test_workspace/WORKSPACE - -# Unit under test -ln -sf "$(rlocation $TEST_WORKSPACE/quality/sanitizer/sanitizer.bazelrc)" "test_workspace/.bazelrc" - -# Test-Workspace -ln -sf "$(rlocation $TEST_WORKSPACE/quality/sanitizer/test_workspace/MODULE.bazel)" "test_workspace/MODULE.bazel" -ln -sf "$(rlocation $TEST_WORKSPACE/quality/sanitizer/test_workspace/BUILD.tpl)" "test_workspace/BUILD" -ln -sf "$(rlocation $TEST_WORKSPACE/quality/sanitizer/test_workspace/asan_fail_heap_out_of_bounds.cpp)" "test_workspace/asan_fail_heap_out_of_bounds.cpp" -ln -sf "$(rlocation $TEST_WORKSPACE/quality/sanitizer/test_workspace/lsan_fail_leak.cpp)" "test_workspace/lsan_fail_leak.cpp" -ln -sf "$(rlocation $TEST_WORKSPACE/quality/sanitizer/test_workspace/tsan_fail_data_race.cpp)" "test_workspace/tsan_fail_data_race.cpp" - -cd test_workspace - -if bazel test --config=asan //:asan_fail_heap_out_of_bounds; then - exit 1; -fi - -if bazel test --config=lsan //:lsan_fail_leak; then - exit 1; -fi - -if bazel test --config=tsan //:tsan_fail_data_race; then - exit 1; -fi - -exit 0; diff --git a/quality/sanitizer/test_workspace/MODULE.bazel b/quality/sanitizer/test_workspace/MODULE.bazel deleted file mode 100644 index 66e742149..000000000 --- a/quality/sanitizer/test_workspace/MODULE.bazel +++ /dev/null @@ -1,43 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# ******************************************************************************* -module(name = "foo") - -bazel_dep(name = "toolchains_llvm", version = "1.5.0", dev_dependency = True) - -llvm = use_extension( - "@toolchains_llvm//toolchain/extensions:llvm.bzl", - "llvm", - dev_dependency = True, -) -llvm.toolchain( - compile_flags = {"": [ - "-march=nehalem", - "-ffp-model=strict", - # Security - "-U_FORTIFY_SOURCE", # https://github.com/google/sanitizers/issues/247 - "-fstack-protector", - "-fno-omit-frame-pointer", - # Diagnostics - "-fcolor-diagnostics", - "-Wno-deprecated-declarations", - "-Wno-error=self-assign-overloaded", - "-Wthread-safety", - ]}, - cxx_standard = {"": "c++17"}, - link_libs = {"": [ - "-lrt", - ]}, - llvm_version = "16.0.0", - stdlib = {"": "dynamic-stdc++"}, -) -use_repo(llvm, "llvm_toolchain") diff --git a/quality/sanitizer/test_workspace/asan_fail_heap_out_of_bounds.cpp b/quality/sanitizer/test_workspace/asan_fail_heap_out_of_bounds.cpp deleted file mode 100644 index 5adc52eda..000000000 --- a/quality/sanitizer/test_workspace/asan_fail_heap_out_of_bounds.cpp +++ /dev/null @@ -1,9 +0,0 @@ -// This code snippet is copied from https://github.com/google/sanitizers/wiki/AddressSanitizerExampleHeapOutOfBounds -int main(int argc, char** argv) -{ - int* array = new int[100]; - array[0] = 0; - int res = array[argc + 100]; // BOOM - delete[] array; - return res; -} diff --git a/quality/sanitizer/test_workspace/lsan_fail_leak.cpp b/quality/sanitizer/test_workspace/lsan_fail_leak.cpp deleted file mode 100644 index dd29ba14f..000000000 --- a/quality/sanitizer/test_workspace/lsan_fail_leak.cpp +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -int main() -{ - auto* p = new int[100]; - p[0] = 0; // Leaked memory - return 0; -} diff --git a/quality/sanitizer/test_workspace/tsan_fail_data_race.cpp b/quality/sanitizer/test_workspace/tsan_fail_data_race.cpp deleted file mode 100644 index d29ae4f51..000000000 --- a/quality/sanitizer/test_workspace/tsan_fail_data_race.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ -#include -#include - -// This is a very basic example of a data-race condition, which should be found by a thread-sanitizer -int main() -{ - std::uint32_t some_number{0}; - - std::thread first_thread{[&some_number]() { - for (int i = 0; i < 100; i++) - { - some_number++; - } - }}; - - std::thread second_thread{[&some_number]() { - for (int i = 0; i < 100; i++) - { - some_number++; - } - }}; - - first_thread.join(); - second_thread.join(); - return 0; -} diff --git a/quality/sanitizer/tsan.env.template b/quality/sanitizer/tsan.env.template deleted file mode 100644 index e2cac276e..000000000 --- a/quality/sanitizer/tsan.env.template +++ /dev/null @@ -1 +0,0 @@ -TSAN_OPTIONS=exitcode=55 allow_addr2line=1 verbosity=1 coverage=1 detect_deadlocks=1 second_deadlock_stack=1 halt_on_error=0 suppressions=%ROOT%quality/sanitizer/tsan.supp diff --git a/quality/sanitizer/tsan.supp b/quality/sanitizer/tsan.supp index 8f571941a..dcd88ea51 100644 --- a/quality/sanitizer/tsan.supp +++ b/quality/sanitizer/tsan.supp @@ -17,15 +17,8 @@ # Suppressions that share the same justification may be organized in a single block. -# Standard library false positives (caused by a stdlib built without tsan instrumentation) -# We accept this because building the stdlib with instrumentation is currently out of scope. -race:include/c++/v1/ios -# TODO ticket +# These tests are already marked with target_compatible_with = [...no_tsan] but suppressions kept for documentation. +# See: Ticket-246891 called_from_lib:sample_ptr_test_rs called_from_lib:sample_allocatee_ptr_test_rs - -# Rust's stdlib test runner is not built with TSan instrumentation, so TSan cannot observe the -# pthread_create happens-before relationship and incorrectly reports a race on the closure data transferred to the spawned test thread. -race:> -race:test::run_test diff --git a/quality/sanitizer/wrapper.sh b/quality/sanitizer/wrapper.sh deleted file mode 100755 index 57ffb0618..000000000 --- a/quality/sanitizer/wrapper.sh +++ /dev/null @@ -1,17 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# ******************************************************************************* - -IFS=' -' -export $(cat quality/sanitizer/relative_sanitizer.env) -$@ diff --git a/score/mw/com/impl/plumbing/rust/BUILD b/score/mw/com/impl/plumbing/rust/BUILD index 3f57119b2..b7a790e19 100644 --- a/score/mw/com/impl/plumbing/rust/BUILD +++ b/score/mw/com/impl/plumbing/rust/BUILD @@ -47,7 +47,7 @@ rust_test( srcs = ["sample_allocatee_ptr.rs"], features = ["link_std_cpp_lib"], # Disabled for thread sanitizer because of detected race (Ticket-246891) - target_compatible_with = ["//quality/sanitizer/constraints:no_tsan"], + target_compatible_with = ["@score_cpp_policies//sanitizers/constraints:no_tsan"], deps = [ ":common_rs", "//score/mw/com/impl/plumbing/rust/test_support:test_helper_size_ffi_rs", @@ -60,7 +60,7 @@ rust_test( srcs = ["sample_ptr.rs"], features = ["link_std_cpp_lib"], # Disabled for thread sanitizer because of detected race (Ticket-246891) - target_compatible_with = ["//quality/sanitizer/constraints:no_tsan"], + target_compatible_with = ["@score_cpp_policies//sanitizers/constraints:no_tsan"], deps = [ ":common_rs", "//score/mw/com/impl/plumbing/rust/test_support:test_helper_size_ffi_rs", diff --git a/score/mw/com/test/partial_restart/consumer_restart/integration_test/BUILD b/score/mw/com/test/partial_restart/consumer_restart/integration_test/BUILD index 93af8fba8..ca702eb2d 100644 --- a/score/mw/com/test/partial_restart/consumer_restart/integration_test/BUILD +++ b/score/mw/com/test/partial_restart/consumer_restart/integration_test/BUILD @@ -27,5 +27,5 @@ integration_test( srcs = ["test_consumer_restart.py"], filesystem = ":filesystem", # Disabled for thread sanitizer because of detected race (Ticket-246892) - target_compatible_with = ["//quality/sanitizer/constraints:no_tsan"], + target_compatible_with = ["@score_cpp_policies//sanitizers/constraints:no_tsan"], ) diff --git a/score/mw/com/test/partial_restart/provider_restart/integration_test/BUILD b/score/mw/com/test/partial_restart/provider_restart/integration_test/BUILD index 67f4638ed..6bcd81b45 100644 --- a/score/mw/com/test/partial_restart/provider_restart/integration_test/BUILD +++ b/score/mw/com/test/partial_restart/provider_restart/integration_test/BUILD @@ -26,5 +26,5 @@ integration_test( srcs = ["test_provider_restart.py"], filesystem = ":filesystem", # Disabled for thread sanitizer because of detected race (Ticket-246892) - target_compatible_with = ["//quality/sanitizer/constraints:no_tsan"], + target_compatible_with = ["@score_cpp_policies//sanitizers/constraints:no_tsan"], ) diff --git a/score/mw/com/test/partial_restart/provider_restart_max_subscribers/integration_test/BUILD b/score/mw/com/test/partial_restart/provider_restart_max_subscribers/integration_test/BUILD index 912d4a10f..d3aa7e10c 100644 --- a/score/mw/com/test/partial_restart/provider_restart_max_subscribers/integration_test/BUILD +++ b/score/mw/com/test/partial_restart/provider_restart_max_subscribers/integration_test/BUILD @@ -27,5 +27,5 @@ integration_test( srcs = ["test_provider_restart_max_subscribers.py"], filesystem = ":filesystem", # Disabled for thread sanitizer because of detected race (Ticket-246892) - target_compatible_with = ["//quality/sanitizer/constraints:no_tsan"], + target_compatible_with = ["@score_cpp_policies//sanitizers/constraints:no_tsan"], ) diff --git a/score/mw/com/test/service_discovery_during_consumer_crash/integration_test/BUILD b/score/mw/com/test/service_discovery_during_consumer_crash/integration_test/BUILD index a1171d5ad..70d0efbdf 100644 --- a/score/mw/com/test/service_discovery_during_consumer_crash/integration_test/BUILD +++ b/score/mw/com/test/service_discovery_during_consumer_crash/integration_test/BUILD @@ -24,7 +24,7 @@ integration_test( srcs = ["test_service_discovery_during_consumer_crash.py"], filesystem = ":filesystem", # Disabled for thread sanitizer because of detected race (Ticket-246892) - target_compatible_with = ["//quality/sanitizer/constraints:no_tsan"], + target_compatible_with = ["@score_cpp_policies//sanitizers/constraints:no_tsan"], ) pkg_tar(