Commit c3dc6fcc authored by Max Moroz's avatar Max Moroz Committed by Commit Bot

[net] Disable fuzzer support targets unless use_fuzzing_engine is true.

Some buildbots are executing `ninja all` and fuzz targets should not
be attempted to be built there unless certain GN flags are enabled.

Bug: 999096
Change-Id: I11addbe7ab00a5ef8c57559bd84a1ec4b287f212
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1775756
Commit-Queue: Max Moroz <mmoroz@chromium.org>
Reviewed-by: default avatarMatt Mueller <mattm@chromium.org>
Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#691764}
parent 3e2f6900
...@@ -6190,7 +6190,9 @@ if (!is_ios) { ...@@ -6190,7 +6190,9 @@ if (!is_ios) {
# This has a global (InitGlobals) that must always be linked in, so # This has a global (InitGlobals) that must always be linked in, so
# must be a source set instead of a static library. # must be a source set instead of a static library.
if (!is_ios) { if (use_fuzzing_engine) {
# fuzzer_test targets are no-op when |use_fuzzing_engine| is false. Fuzzer
# support targets should be disabled too.
source_set("net_fuzzer_test_support") { source_set("net_fuzzer_test_support") {
testonly = true testonly = true
......
...@@ -453,17 +453,21 @@ source_set("test_support") { ...@@ -453,17 +453,21 @@ source_set("test_support") {
] ]
} }
source_set("fuzzer_test_support") { if (use_fuzzing_engine) {
testonly = true # fuzzer_test targets are no-op when |use_fuzzing_engine| is false. Fuzzer
sources = [ # support targets should be disabled too.
"fuzzed_host_resolver_util.cc", source_set("fuzzer_test_support") {
"fuzzed_host_resolver_util.h", testonly = true
] sources = [
deps = [ "fuzzed_host_resolver_util.cc",
"//base", "fuzzed_host_resolver_util.h",
"//base/test:test_support", ]
"//net", deps = [
] "//base",
"//base/test:test_support",
"//net",
]
}
} }
fuzzer_test("net_dns_hosts_parse_fuzzer") { fuzzer_test("net_dns_hosts_parse_fuzzer") {
......
...@@ -34,7 +34,7 @@ import("//testing/test.gni") ...@@ -34,7 +34,7 @@ import("//testing/test.gni")
# config (.options file) file would be generated or modified in root output # config (.options file) file would be generated or modified in root output
# dir (next to test). # dir (next to test).
template("fuzzer_test") { template("fuzzer_test") {
if (!disable_libfuzzer && (use_fuzzing_engine || is_linux)) { if (!disable_libfuzzer && use_fuzzing_engine) {
assert(defined(invoker.sources), "Need sources in $target_name.") assert(defined(invoker.sources), "Need sources in $target_name.")
test_deps = [ "//testing/libfuzzer:libfuzzer_main" ] test_deps = [ "//testing/libfuzzer:libfuzzer_main" ]
......
...@@ -36,3 +36,4 @@ $ git am --3way --message-id -p4 /tmp/patchdir ...@@ -36,3 +36,4 @@ $ git am --3way --message-id -p4 /tmp/patchdir
Local Modifications: Local Modifications:
- codereview.settings has been excluded. - codereview.settings has been excluded.
- elf_image_reader_fuzzer is enabled only when use_fuzzing_engine is true.
...@@ -236,7 +236,10 @@ static_library("snapshot") { ...@@ -236,7 +236,10 @@ static_library("snapshot") {
} }
} }
if (crashpad_is_linux) { if (crashpad_is_linux && use_fuzzing_engine) {
# Since crashpad uses its own crashpad_fuzzer_test GN template to wrap
# Chromium's fuzzer_test template, it's better to rely on |use_fuzzing_engine|
# and disable fuzz targets as they will not build successfully without it.
crashpad_fuzzer_test("elf_image_reader_fuzzer") { crashpad_fuzzer_test("elf_image_reader_fuzzer") {
sources = [ sources = [
"elf/elf_image_reader_fuzzer.cc", "elf/elf_image_reader_fuzzer.cc",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment