| 1 |
# Copyright The OpenTelemetry Authors |
| 2 |
# SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
# bazel configurations for running tests under sanitizers. |
| 5 |
# Based on https://github.com/bazelment/trunk/blob/master/tools/bazel.rc |
| 6 |
|
| 7 |
# Enable automatic configs based on platform |
| 8 |
common --enable_platform_specific_config |
| 9 |
|
| 10 |
# Make globs that don't match anything fail |
| 11 |
common --incompatible_disallow_empty_glob |
| 12 |
|
| 13 |
# Needed by gRPC to build on some platforms. |
| 14 |
build --copt -DGRPC_BAZEL_BUILD |
| 15 |
|
| 16 |
# Workaround abseil libraries missing symbols |
| 17 |
build:windows --dynamic_mode=off |
| 18 |
|
| 19 |
# Set minimum supported C++ version |
| 20 |
build:macos --host_cxxopt=-std=c++14 --cxxopt=-std=c++14 |
| 21 |
build:linux --host_cxxopt=-std=c++14 --cxxopt=-std=c++14 |
| 22 |
build:windows --host_cxxopt=/std:c++14 --cxxopt=/std:c++14 |
| 23 |
|
| 24 |
# --config=asan : Address Sanitizer. |
| 25 |
common:asan --copt -DADDRESS_SANITIZER |
| 26 |
common:asan --copt -fsanitize=address,bool,float-cast-overflow,integer-divide-by-zero,null,return,returns-nonnull-attribute,shift-exponent,signed-integer-overflow,unreachable,vla-bound |
| 27 |
common:asan --copt -fsanitize-address-use-after-scope |
| 28 |
common:asan --copt -fno-sanitize-recover=all |
| 29 |
common:asan --linkopt -fsanitize=address,bool,float-cast-overflow,integer-divide-by-zero,null,return,returns-nonnull-attribute,shift-exponent,signed-integer-overflow,unreachable,vla-bound |
| 30 |
common:asan --linkopt -fsanitize-address-use-after-scope |
| 31 |
common:asan --linkopt -fno-sanitize-recover=all |
| 32 |
common:asan --cc_output_directory_tag=asan |
| 33 |
|
| 34 |
# --config=tsan : Thread Sanitizer. |
| 35 |
common:tsan --copt -fsanitize=thread |
| 36 |
common:tsan --copt -DTHREAD_SANITIZER |
| 37 |
common:tsan --linkopt -fsanitize=thread |
| 38 |
common:tsan --cc_output_directory_tag=tsan |
| 39 |
# This is needed to address false positive problem with abseil.The same setting as gRPC |
| 40 |
# https://github.com/google/sanitizers/issues/953 |
| 41 |
common:tsan --test_env=TSAN_OPTIONS=report_atomic_races=0 |