From e47f1079d085d6f62d9f48a035666e7ced4b76bc Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 11 Oct 2018 17:10:03 +0000 Subject: Enable jumbo support for PDFium fuzzers. Make fuzzer helpers that are mutually exclusive use the same name for their global variables. If any target tries to include both, the jumbo build will likely fail. BUG=pdfium:964 Change-Id: Idadbc86ff990bf1e8c7cfb3500f1f191a96432db Reviewed-on: https://pdfium-review.googlesource.com/c/43850 Commit-Queue: Lei Zhang Reviewed-by: Tom Sepez --- testing/fuzzers/BUILD.gn | 5 +++-- testing/fuzzers/pdf_fuzzer_init.cc | 6 +++++- testing/fuzzers/pdfium_fuzzer_helper.cc | 5 ++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/testing/fuzzers/BUILD.gn b/testing/fuzzers/BUILD.gn index f528ad5c9d..94f501ad65 100644 --- a/testing/fuzzers/BUILD.gn +++ b/testing/fuzzers/BUILD.gn @@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/jumbo.gni") import("../../pdfium.gni") config("fuzzer_config") { @@ -66,7 +67,7 @@ group("fuzzers") { } template("pdfium_public_fuzzer") { - source_set(target_name) { + jumbo_source_set(target_name) { sources = invoker.sources + [ "pdfium_fuzzer_helper.cc", "pdfium_fuzzer_helper.h", @@ -95,7 +96,7 @@ template("pdfium_public_fuzzer") { } template("pdfium_fuzzer") { - source_set(target_name) { + jumbo_source_set(target_name) { sources = invoker.sources + [ "pdf_fuzzer_init.cc" ] deps = [ "../../:pdfium", diff --git a/testing/fuzzers/pdf_fuzzer_init.cc b/testing/fuzzers/pdf_fuzzer_init.cc index 4b9790c3f8..d6b10ff00e 100644 --- a/testing/fuzzers/pdf_fuzzer_init.cc +++ b/testing/fuzzers/pdf_fuzzer_init.cc @@ -18,4 +18,8 @@ struct TestCase { } FPDF_LIBRARY_CONFIG config; }; -static TestCase* testCase = new TestCase(); + +// pdf_fuzzer_init.cc and pdfium_fuzzer_helper.cc are mutually exclusive and +// should not be built together. They deliberately have the same global +// variable. +static TestCase* g_test_case = new TestCase(); diff --git a/testing/fuzzers/pdfium_fuzzer_helper.cc b/testing/fuzzers/pdfium_fuzzer_helper.cc index ed000d251d..0315916d0c 100644 --- a/testing/fuzzers/pdfium_fuzzer_helper.cc +++ b/testing/fuzzers/pdfium_fuzzer_helper.cc @@ -261,4 +261,7 @@ struct TestCase { UNSUPPORT_INFO unsupport_info; }; -static TestCase* test_case = new TestCase(); +// pdf_fuzzer_init.cc and pdfium_fuzzer_helper.cc are mutually exclusive and +// should not be built together. They deliberately have the same global +// variable. +static TestCase* g_test_case = new TestCase(); -- cgit v1.2.3