Update fuzzer infrastructure for developers a little (#27403)

* add a config that will build fuzzers

* bazel run --config=fuzzer_asan //path/to:fuzzer fuzzes!
pull/27405/head
Craig Tiller 3 years ago committed by GitHub
parent bbf41f2980
commit 179cdfcadb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      BUILD
  2. 10
      test/core/util/grpc_fuzzer.bzl
  3. 14
      tools/bazel.rc

@ -58,6 +58,12 @@ config_setting(
values = {"apple_platform_type": "ios"},
)
# Fuzzers can be built as fuzzers or as tests
config_setting(
name = "grpc_build_fuzzers",
values = {"define": "grpc_build_fuzzers=true"},
)
selects.config_setting_group(
name = "grpc_no_xds",
match_any = [

@ -18,12 +18,18 @@ def grpc_fuzzer(name, corpus, srcs = [], deps = [], data = [], size = "large", *
grpc_cc_test(
name = name,
srcs = srcs,
deps = deps + ["//test/core/util:fuzzer_corpus_test"],
deps = deps + select({
"//:grpc_build_fuzzers": [],
"//conditions:default": ["//test/core/util:fuzzer_corpus_test"],
}),
data = data + native.glob([corpus + "/**"]),
external_deps = [
"gtest",
],
size = size,
args = ["--directory=" + native.package_name() + "/" + corpus],
args = select({
"//:grpc_build_fuzzers": [native.package_name() + "/" + corpus],
"//conditions:default": ["--directory=" + native.package_name() + "/" + corpus],
}),
**kwargs
)

@ -25,6 +25,20 @@ build:asan --linkopt=-fsanitize=address
build:asan --action_env=ASAN_OPTIONS=detect_leaks=1:color=always
build:asan --action_env=LSAN_OPTIONS=suppressions=test/core/util/lsan_suppressions.txt:report_objects=1
build:fuzzer_asan --strip=never
build:fuzzer_asan --define=grpc_build_fuzzers=true
build:fuzzer_asan --copt=-fsanitize=fuzzer,address
build:fuzzer_asan --copt=-fsanitize-coverage=edge
build:fuzzer_asan --copt=-fsanitize-coverage=trace-cmp
build:fuzzer_asan --copt=-O0
build:fuzzer_asan --copt=-fno-omit-frame-pointer
build:fuzzer_asan --copt=-DGPR_NO_DIRECT_SYSCALLS
build:fuzzer_asan --copt=-DGRPC_ASAN
build:fuzzer_asan --copt=-DADDRESS_SANITIZER # used by absl
build:fuzzer_asan --linkopt=-fsanitize=fuzzer,address
build:fuzzer_asan --action_env=ASAN_OPTIONS=detect_leaks=1:color=always
build:fuzzer_asan --action_env=LSAN_OPTIONS=suppressions=test/core/util/lsan_suppressions.txt:report_objects=1
# We have a separate ASAN config for Mac OS to workaround a couple of bugs:
# 1. https://github.com/bazelbuild/bazel/issues/6932
# _FORTIFY_SOURCE=1 is enabled by default on Mac OS, which breaks ASAN.

Loading…
Cancel
Save