[M108 Migration][Loading Performance] Introduce |BeginMainFrame| throttling
[platform/framework/web/chromium-efl.git] / third_party / libprotobuf-mutator / BUILD.gn
1 # Copyright 2017 The Chromium Authors
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import("//build/config/sanitizers/sanitizers.gni")
6 import("//testing/libfuzzer/fuzzer_test.gni")
7 import("//third_party/libprotobuf-mutator/fuzzable_proto_library.gni")
8
9 config("main_config") {
10   cflags = [ "-Wno-shadow" ]
11   include_dirs = [ "src/" ]
12 }
13
14 source_set("libprotobuf-mutator") {
15   testonly = true
16
17   # Remove *San and coverage for a performance boost.
18   configs -= not_fuzzed_remove_configs
19   configs += [ "//build/config/sanitizers:not_fuzzed" ]
20
21   public_configs = [ ":main_config" ]
22   sources = [
23     "src/src/binary_format.cc",
24     "src/src/libfuzzer/libfuzzer_macro.cc",
25     "src/src/libfuzzer/libfuzzer_mutator.cc",
26     "src/src/mutator.cc",
27     "src/src/text_format.cc",
28     "src/src/utf8_fix.cc",
29   ]
30
31   # Allow users of LPM to use protobuf reflection and other features from
32   # protobuf_full.
33   public_deps = [ "//third_party/protobuf:protobuf_full" ]
34
35   # Let ClusterFuzz builders know to not build targets that depend on
36   # libprotobuf-mutator for AFL or Chrome OS.
37   if (use_afl || current_toolchain == "//build/toolchain/cros:target") {
38     all_dependent_configs = [ "//testing/libfuzzer:no_clusterfuzz" ]
39   }
40 }
41
42 # The CQ will try building this target without "use_libfuzzer" if it is defined.
43 # That will cause the build to fail, so don't define it when "use_libfuzzer" is
44 # is false.
45 if (use_libfuzzer) {
46   # Test that fuzzable_proto_library works. This target contains files that are
47   # optimized for LITE_RUNTIME and which import other files that are also
48   # optimized for LITE_RUNTIME.
49   fuzzer_test("lpm_test_fuzzer") {
50     sources = [ "test_fuzzer/test_fuzzer.cc" ]
51     deps = [
52       ":libprotobuf-mutator",
53       ":lpm_test_fuzzer_proto",
54     ]
55
56     # Don't actually run this on CF. It's only a test to ensure builds work.
57     additional_configs = [ "//testing/libfuzzer:no_clusterfuzz" ]
58   }
59 }
60
61 # Proto library for lpm_test_fuzzer
62 fuzzable_proto_library("lpm_test_fuzzer_proto") {
63   sources = [
64     "test_fuzzer/imported.proto",
65     "test_fuzzer/imported_publicly.proto",
66     "test_fuzzer/test_fuzzer_input.proto",
67   ]
68 }
69
70 # Avoid CQ complaints on platforms we don't care about (ie: iOS).
71 # Also prevent people from using this to include protobuf_full into a production
72 # build of Chrome.
73 if (use_libfuzzer) {
74   # Component that can provide protobuf_full to non-testonly targets
75   static_library("protobuf_full") {
76     public_deps = [ "//third_party/protobuf:protobuf_full" ]
77     sources = [ "dummy.cc" ]
78   }
79 }