From 5bdd9a8cb9b35361bd54d6e518c289c41e23ab79 Mon Sep 17 00:00:00 2001 From: adelez Date: Fri, 15 Jun 2018 16:31:21 -0700 Subject: [PATCH 1/2] Revert "Revert "Add suppressions to sanitizers for bazel builds"" --- bazel/grpc_build_system.bzl | 3 ++- test/core/channel/BUILD | 1 + test/core/security/BUILD | 4 ++++ test/core/transport/BUILD | 1 + test/core/tsi/alts/crypt/BUILD | 1 + test/core/tsi/alts/frame_protector/BUILD | 4 ++++ test/core/tsi/alts/handshaker/BUILD | 5 +++++ .../tsi/alts/zero_copy_frame_protector/BUILD | 3 +++ test/core/util/BUILD | 5 +++++ test/cpp/client/BUILD | 1 + test/cpp/microbenchmarks/BUILD | 1 + test/cpp/util/BUILD | 2 ++ tools/BUILD | 19 +++++++++++++++++++ .../internal_ci/linux/grpc_tsan_on_foundry.sh | 2 +- 14 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 tools/BUILD diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index 0a1edeb31c5..73147bf3ac9 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -60,7 +60,7 @@ def _maybe_update_cc_library_hdrs(hdrs): def grpc_cc_library(name, srcs = [], public_hdrs = [], hdrs = [], external_deps = [], deps = [], standalone = False, language = "C++", testonly = False, visibility = None, - alwayslink = 0): + alwayslink = 0, data = []): copts = [] if language.upper() == "C": copts = if_not_windows(["-std=c99"]) @@ -85,6 +85,7 @@ def grpc_cc_library(name, srcs = [], public_hdrs = [], hdrs = [], "include" ], alwayslink = alwayslink, + data = data, ) def grpc_proto_plugin(name, srcs = [], deps = []): diff --git a/test/core/channel/BUILD b/test/core/channel/BUILD index c554b20148c..e5a9e364573 100644 --- a/test/core/channel/BUILD +++ b/test/core/channel/BUILD @@ -105,6 +105,7 @@ grpc_cc_test( language = "C++", deps = [ "//:grpc", + "//test/core/util:gpr_test_util", ], external_deps = [ "gtest", diff --git a/test/core/security/BUILD b/test/core/security/BUILD index 70bcc8c9c36..12aa84d93b3 100644 --- a/test/core/security/BUILD +++ b/test/core/security/BUILD @@ -183,6 +183,7 @@ grpc_cc_test( "//:gpr", "//:gpr_base", "//:grpc", + "//test/core/util:gpr_test_util", ], ) @@ -195,6 +196,7 @@ grpc_cc_test( "//:gpr", "//:gpr_base", "//:grpc", + "//test/core/util:gpr_test_util", ], ) @@ -206,6 +208,7 @@ grpc_cc_test( "//:alts_util", "//:gpr", "//:grpc", + "//test/core/util:gpr_test_util", ], ) @@ -220,5 +223,6 @@ grpc_cc_test( "//:grpc_secure", "//:tsi", "//:tsi_interface", + "//test/core/util:gpr_test_util", ], ) diff --git a/test/core/transport/BUILD b/test/core/transport/BUILD index 84fb3a1421d..7ca1c1d9435 100644 --- a/test/core/transport/BUILD +++ b/test/core/transport/BUILD @@ -129,6 +129,7 @@ grpc_cc_test( language = "C++", deps = [ "//:grpc", + "//test/core/util:gpr_test_util", ], external_deps = [ "gtest", diff --git a/test/core/tsi/alts/crypt/BUILD b/test/core/tsi/alts/crypt/BUILD index cf9dbca3168..abe1e83656f 100644 --- a/test/core/tsi/alts/crypt/BUILD +++ b/test/core/tsi/alts/crypt/BUILD @@ -27,6 +27,7 @@ grpc_cc_test( "//:alts_frame_protector", "//:gpr", "//:grpc", + "//test/core/util:gpr_test_util", ], ) diff --git a/test/core/tsi/alts/frame_protector/BUILD b/test/core/tsi/alts/frame_protector/BUILD index dd1966b379b..6ff3015f4dd 100644 --- a/test/core/tsi/alts/frame_protector/BUILD +++ b/test/core/tsi/alts/frame_protector/BUILD @@ -27,6 +27,7 @@ grpc_cc_test( "//:gpr", "//:grpc", "//test/core/tsi/alts/crypt:alts_crypt_test_util", + "//test/core/util:gpr_test_util", ], ) @@ -39,6 +40,7 @@ grpc_cc_test( "//:gpr", "//:grpc", "//test/core/tsi/alts/crypt:alts_crypt_test_util", + "//test/core/util:gpr_test_util", ], ) @@ -54,6 +56,7 @@ grpc_cc_test( "//:tsi_interface", "//test/core/tsi/alts/crypt:alts_crypt_test_util", "//test/core/tsi:transport_security_test_lib", + "//test/core/util:gpr_test_util", ], ) @@ -67,5 +70,6 @@ grpc_cc_test( "//:gpr_base", "//:grpc", "//test/core/tsi/alts/crypt:alts_crypt_test_util", + "//test/core/util:gpr_test_util", ], ) diff --git a/test/core/tsi/alts/handshaker/BUILD b/test/core/tsi/alts/handshaker/BUILD index 809742744c9..3f1a681c1ad 100644 --- a/test/core/tsi/alts/handshaker/BUILD +++ b/test/core/tsi/alts/handshaker/BUILD @@ -37,6 +37,7 @@ grpc_cc_test( "//:tsi", "//:tsi_interface", "//:grpc", + "//test/core/util:gpr_test_util", ], ) @@ -47,6 +48,7 @@ grpc_cc_test( deps = [ ":alts_handshaker_service_api_test_lib", "//:grpc", + "//test/core/util:gpr_test_util", ], ) @@ -60,6 +62,7 @@ grpc_cc_test( "//:gpr_base", "//:grpc", "//:tsi", + "//test/core/util:gpr_test_util", ], ) @@ -71,6 +74,7 @@ grpc_cc_test( ":alts_handshaker_service_api_test_lib", "//:grpc", "//:tsi", + "//test/core/util:gpr_test_util", ], ) @@ -81,6 +85,7 @@ grpc_cc_test( deps = [ "//:alts_util", "//:grpc", + "//test/core/util:gpr_test_util", ], ) diff --git a/test/core/tsi/alts/zero_copy_frame_protector/BUILD b/test/core/tsi/alts/zero_copy_frame_protector/BUILD index 2b41dae0439..a3b797327e4 100644 --- a/test/core/tsi/alts/zero_copy_frame_protector/BUILD +++ b/test/core/tsi/alts/zero_copy_frame_protector/BUILD @@ -28,6 +28,7 @@ grpc_cc_test( "//:grpc", "//:grpc_base_c", "//test/core/tsi/alts/crypt:alts_crypt_test_util", + "//test/core/util:gpr_test_util", ], ) @@ -40,6 +41,7 @@ grpc_cc_test( "//:gpr", "//:grpc", "//test/core/tsi/alts/crypt:alts_crypt_test_util", + "//test/core/util:gpr_test_util", ], ) @@ -53,5 +55,6 @@ grpc_cc_test( "//:grpc", "//:grpc_base_c", "//test/core/tsi/alts/crypt:alts_crypt_test_util", + "//test/core/util:gpr_test_util", ], ) diff --git a/test/core/util/BUILD b/test/core/util/BUILD index f52570cde57..be3e204777d 100644 --- a/test/core/util/BUILD +++ b/test/core/util/BUILD @@ -32,6 +32,11 @@ grpc_cc_library( "test_config.h", ], deps = ["//:gpr"], + data = [ + "//tools:lsan_suppressions.txt", + "//tools:tsan_suppressions.txt", + "//tools:ubsan_suppressions.txt", + ], ) grpc_cc_library( diff --git a/test/cpp/client/BUILD b/test/cpp/client/BUILD index 12825e88c26..c03ea92d34a 100644 --- a/test/cpp/client/BUILD +++ b/test/cpp/client/BUILD @@ -28,6 +28,7 @@ grpc_cc_test( "//:gpr", "//:grpc", "//:grpc++", + "//test/core/util:gpr_test_util", ], ) diff --git a/test/cpp/microbenchmarks/BUILD b/test/cpp/microbenchmarks/BUILD index 5dcfd94ed34..d51a0e3dc5f 100644 --- a/test/cpp/microbenchmarks/BUILD +++ b/test/cpp/microbenchmarks/BUILD @@ -24,6 +24,7 @@ grpc_cc_test( external_deps = [ "benchmark", ], + deps = ["//test/core/util:gpr_test_util",] ) grpc_cc_library( diff --git a/test/cpp/util/BUILD b/test/cpp/util/BUILD index b1153d2df35..9b42bb28b1d 100644 --- a/test/cpp/util/BUILD +++ b/test/cpp/util/BUILD @@ -217,6 +217,7 @@ grpc_cc_test( ], deps = [ "//:grpc++", + "//test/core/util:gpr_test_util", ], ) @@ -260,6 +261,7 @@ grpc_cc_test( deps = [ "//:grpc++_error_details", "//src/proto/grpc/testing:echo_messages_proto", + "//test/core/util:gpr_test_util", ], ) diff --git a/tools/BUILD b/tools/BUILD new file mode 100644 index 00000000000..e0f2a80bb44 --- /dev/null +++ b/tools/BUILD @@ -0,0 +1,19 @@ +# Copyright 2017 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +exports_files([ + "lsan_suppressions.txt", + "tsan_suppressions.txt", + "ubsan_suppressions.txt", +]) diff --git a/tools/internal_ci/linux/grpc_tsan_on_foundry.sh b/tools/internal_ci/linux/grpc_tsan_on_foundry.sh index fafa1ceecb4..cd4e354be67 100644 --- a/tools/internal_ci/linux/grpc_tsan_on_foundry.sh +++ b/tools/internal_ci/linux/grpc_tsan_on_foundry.sh @@ -14,5 +14,5 @@ # limitations under the License. export UPLOAD_TEST_RESULTS=true -EXTRA_FLAGS="--copt=-gmlt --strip=never --copt=-fsanitize=thread --linkopt=-fsanitize=thread --test_timeout=3600" +EXTRA_FLAGS="--copt=-gmlt --strip=never --copt=-fsanitize=thread --linkopt=-fsanitize=thread --test_timeout=3600 --action_env=TSAN_OPTIONS=suppressions=tools/tsan_suppressions.txt:halt_on_error=1:second_deadlock_stack=1" github/grpc/tools/internal_ci/linux/grpc_bazel_on_foundry_base.sh "${EXTRA_FLAGS}" From 1f3d714d07eb895e6c0ce9f196d83df5833259a0 Mon Sep 17 00:00:00 2001 From: Adele Zhou Date: Fri, 15 Jun 2018 17:13:08 -0700 Subject: [PATCH 2/2] Move suppressions files under test/core/util to avoid creating a BUILD file under tools, which breaks import. --- build.yaml | 8 ++++---- test/core/util/BUILD | 6 +++--- .../core/util}/lsan_suppressions.txt | 0 .../core/util}/tsan_suppressions.txt | 0 .../core/util}/ubsan_suppressions.txt | 0 tools/BUILD | 19 ------------------- tools/bazel.rc | 6 +++--- .../internal_ci/linux/grpc_tsan_on_foundry.sh | 2 +- tools/run_tests/generated/configs.json | 8 ++++---- 9 files changed, 15 insertions(+), 34 deletions(-) rename {tools => test/core/util}/lsan_suppressions.txt (100%) rename {tools => test/core/util}/tsan_suppressions.txt (100%) rename {tools => test/core/util}/ubsan_suppressions.txt (100%) delete mode 100644 tools/BUILD diff --git a/build.yaml b/build.yaml index 11060b6ddd7..14316012092 100644 --- a/build.yaml +++ b/build.yaml @@ -5494,7 +5494,7 @@ configs: compile_the_world: true test_environ: ASAN_OPTIONS: detect_leaks=1:color=always - LSAN_OPTIONS: suppressions=tools/lsan_suppressions.txt:report_objects=1 + LSAN_OPTIONS: suppressions=test/core/util/lsan_suppressions.txt:report_objects=1 asan-noleaks: CC: clang CPPFLAGS: -O0 -fsanitize-coverage=edge,trace-pc-guard -fsanitize=address -fno-omit-frame-pointer @@ -5518,7 +5518,7 @@ configs: compile_the_world: true test_environ: ASAN_OPTIONS: detect_leaks=1:color=always - LSAN_OPTIONS: suppressions=tools/lsan_suppressions.txt:report_objects=1 + LSAN_OPTIONS: suppressions=test/core/util/lsan_suppressions.txt:report_objects=1 basicprof: CPPFLAGS: -O2 -DGRPC_BASIC_PROFILER -DGRPC_TIMERS_RDTSC DEFINES: NDEBUG @@ -5592,7 +5592,7 @@ configs: LDXX: clang++ compile_the_world: true test_environ: - TSAN_OPTIONS: suppressions=tools/tsan_suppressions.txt:halt_on_error=1:second_deadlock_stack=1 + TSAN_OPTIONS: suppressions=test/core/util/tsan_suppressions.txt:halt_on_error=1:second_deadlock_stack=1 ubsan: CC: clang CPPFLAGS: -O0 -fsanitize-coverage=edge,trace-pc-guard -fsanitize=undefined -fno-omit-frame-pointer @@ -5604,7 +5604,7 @@ configs: LDXX: clang++ compile_the_world: true test_environ: - UBSAN_OPTIONS: halt_on_error=1:print_stacktrace=1:suppressions=tools/ubsan_suppressions.txt + UBSAN_OPTIONS: halt_on_error=1:print_stacktrace=1:suppressions=test/core/util/ubsan_suppressions.txt defaults: ares: CFLAGS: -Wno-sign-conversion $(if $(subst Darwin,,$(SYSTEM)),,-Wno-shorten-64-to-32) diff --git a/test/core/util/BUILD b/test/core/util/BUILD index be3e204777d..5492dcfa795 100644 --- a/test/core/util/BUILD +++ b/test/core/util/BUILD @@ -33,9 +33,9 @@ grpc_cc_library( ], deps = ["//:gpr"], data = [ - "//tools:lsan_suppressions.txt", - "//tools:tsan_suppressions.txt", - "//tools:ubsan_suppressions.txt", + "lsan_suppressions.txt", + "tsan_suppressions.txt", + "ubsan_suppressions.txt", ], ) diff --git a/tools/lsan_suppressions.txt b/test/core/util/lsan_suppressions.txt similarity index 100% rename from tools/lsan_suppressions.txt rename to test/core/util/lsan_suppressions.txt diff --git a/tools/tsan_suppressions.txt b/test/core/util/tsan_suppressions.txt similarity index 100% rename from tools/tsan_suppressions.txt rename to test/core/util/tsan_suppressions.txt diff --git a/tools/ubsan_suppressions.txt b/test/core/util/ubsan_suppressions.txt similarity index 100% rename from tools/ubsan_suppressions.txt rename to test/core/util/ubsan_suppressions.txt diff --git a/tools/BUILD b/tools/BUILD deleted file mode 100644 index e0f2a80bb44..00000000000 --- a/tools/BUILD +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2017 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -exports_files([ - "lsan_suppressions.txt", - "tsan_suppressions.txt", - "ubsan_suppressions.txt", -]) diff --git a/tools/bazel.rc b/tools/bazel.rc index 19e7921ca94..39f8071535b 100644 --- a/tools/bazel.rc +++ b/tools/bazel.rc @@ -11,7 +11,7 @@ build:asan --copt -fno-omit-frame-pointer build:asan --copt -DGPR_NO_DIRECT_SYSCALLS build:asan --linkopt -fsanitize=address build:asan --action_env=ASAN_OPTIONS=detect_leaks=1:color=always -build:asan --action_env=LSAN_OPTIONS=suppressions=lsan_suppressions.txt:report_objects=1 +build:asan --action_env=LSAN_OPTIONS=suppressions=test/core/util/lsan_suppressions.txt:report_objects=1 build:msan --strip=never build:msan --copt -fsanitize-coverage=edge @@ -32,7 +32,7 @@ build:tsan --copt -fno-omit-frame-pointer build:tsan --copt -DGPR_NO_DIRECT_SYSCALLS build:tsan --copt -DGRPC_TSAN build:tsan --linkopt -fsanitize=thread -build:tsan --action_env=TSAN_OPTIONS=suppressions=tools/tsan_suppressions.txt:halt_on_error=1:second_deadlock_stack=1 +build:tsan --action_env=TSAN_OPTIONS=suppressions=test/core/util/tsan_suppressions.txt:halt_on_error=1:second_deadlock_stack=1 build:ubsan --strip=never build:ubsan --copt -fsanitize-coverage=edge @@ -42,7 +42,7 @@ build:ubsan --copt -DGRPC_UBSAN build:ubsan --copt -DNDEBUG build:ubsan --copt -fno-sanitize=function,vptr build:ubsan --linkopt -fsanitize=undefined -build:ubsan --action_env=UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1:suppressions=tools/ubsan_suppressions.txt +build:ubsan --action_env=UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1:suppressions=test/core/util/ubsan_suppressions.txt build:basicprof --strip=never build:basicprof --copt -DNDEBUG diff --git a/tools/internal_ci/linux/grpc_tsan_on_foundry.sh b/tools/internal_ci/linux/grpc_tsan_on_foundry.sh index cd4e354be67..1396fc4e420 100644 --- a/tools/internal_ci/linux/grpc_tsan_on_foundry.sh +++ b/tools/internal_ci/linux/grpc_tsan_on_foundry.sh @@ -14,5 +14,5 @@ # limitations under the License. export UPLOAD_TEST_RESULTS=true -EXTRA_FLAGS="--copt=-gmlt --strip=never --copt=-fsanitize=thread --linkopt=-fsanitize=thread --test_timeout=3600 --action_env=TSAN_OPTIONS=suppressions=tools/tsan_suppressions.txt:halt_on_error=1:second_deadlock_stack=1" +EXTRA_FLAGS="--copt=-gmlt --strip=never --copt=-fsanitize=thread --linkopt=-fsanitize=thread --test_timeout=3600 --action_env=TSAN_OPTIONS=suppressions=test/core/util/tsan_suppressions.txt:halt_on_error=1:second_deadlock_stack=1" github/grpc/tools/internal_ci/linux/grpc_bazel_on_foundry_base.sh "${EXTRA_FLAGS}" diff --git a/tools/run_tests/generated/configs.json b/tools/run_tests/generated/configs.json index a14340cb7bd..74c62862408 100644 --- a/tools/run_tests/generated/configs.json +++ b/tools/run_tests/generated/configs.json @@ -6,7 +6,7 @@ "config": "asan-trace-cmp", "environ": { "ASAN_OPTIONS": "detect_leaks=1:color=always", - "LSAN_OPTIONS": "suppressions=tools/lsan_suppressions.txt:report_objects=1" + "LSAN_OPTIONS": "suppressions=test/core/util/lsan_suppressions.txt:report_objects=1" } }, { @@ -16,7 +16,7 @@ "config": "asan", "environ": { "ASAN_OPTIONS": "detect_leaks=1:color=always", - "LSAN_OPTIONS": "suppressions=tools/lsan_suppressions.txt:report_objects=1" + "LSAN_OPTIONS": "suppressions=test/core/util/lsan_suppressions.txt:report_objects=1" } }, { @@ -47,13 +47,13 @@ { "config": "ubsan", "environ": { - "UBSAN_OPTIONS": "halt_on_error=1:print_stacktrace=1:suppressions=tools/ubsan_suppressions.txt" + "UBSAN_OPTIONS": "halt_on_error=1:print_stacktrace=1:suppressions=test/core/util/ubsan_suppressions.txt" } }, { "config": "tsan", "environ": { - "TSAN_OPTIONS": "suppressions=tools/tsan_suppressions.txt:halt_on_error=1:second_deadlock_stack=1" + "TSAN_OPTIONS": "suppressions=test/core/util/tsan_suppressions.txt:halt_on_error=1:second_deadlock_stack=1" } }, {