Debian Codegraph @

test/fuzzers/BUILD.gn

raw
1 # Copyright 2018 Google Inc. All rights reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 import("//testing/libfuzzer/fuzzer_test.gni")
16 import("//testing/test.gni")
17
18 config("fuzzer_config") {
19 configs = [ "../..:spvtools_internal_config" ]
20 }
21
22 group("fuzzers") {
23 testonly = true
24 deps = []
25
26 if (!build_with_chromium || use_fuzzing_engine) {
27 deps += [ ":fuzzers_bin" ]
28 }
29 }
30
31 if (!build_with_chromium || use_fuzzing_engine) {
32 group("fuzzers_bin") {
33 testonly = true
34
35 deps = [
36 ":spvtools_as_fuzzer",
37 ":spvtools_binary_parser_fuzzer",
38 ":spvtools_dis_fuzzer",
39 ":spvtools_opt_legalization_fuzzer",
40 ":spvtools_opt_performance_fuzzer",
41 ":spvtools_opt_size_fuzzer",
42 ":spvtools_val_fuzzer",
43 ]
44 }
45 }
46
47 template("spvtools_fuzzer") {
48 source_set(target_name) {
49 testonly = true
50 sources = invoker.sources
51 sources += [ "random_generator.cpp" ]
52 deps = [
53 "../..:spvtools",
54 "../..:spvtools_opt",
55 "../..:spvtools_val",
56 ]
57 if (defined(invoker.deps)) {
58 deps += invoker.deps
59 }
60
61 configs -= [ "//build/config/compiler:chromium_code" ]
62 configs += [
63 "//build/config/compiler:no_chromium_code",
64 ":fuzzer_config",
65 ]
66 }
67 }
68
69 spvtools_fuzzer("spvtools_as_fuzzer_src") {
70 sources = [
71 "spvtools_as_fuzzer.cpp",
72 ]
73 }
74
75 spvtools_fuzzer("spvtools_binary_parser_fuzzer_src") {
76 sources = [
77 "spvtools_binary_parser_fuzzer.cpp",
78 ]
79 }
80
81 spvtools_fuzzer("spvtools_dis_fuzzer_src") {
82 sources = [
83 "spvtools_dis_fuzzer.cpp",
84 ]
85 }
86
87 spvtools_fuzzer("spvtools_opt_performance_fuzzer_src") {
88 sources = [
89 "spvtools_opt_performance_fuzzer.cpp",
90 "spvtools_opt_fuzzer_common.cpp",
91 ]
92 }
93
94 spvtools_fuzzer("spvtools_opt_legalization_fuzzer_src") {
95 sources = [
96 "spvtools_opt_legalization_fuzzer.cpp",
97 "spvtools_opt_fuzzer_common.cpp",
98 ]
99 }
100
101 spvtools_fuzzer("spvtools_opt_size_fuzzer_src") {
102 sources = [
103 "spvtools_opt_size_fuzzer.cpp",
104 "spvtools_opt_fuzzer_common.cpp",
105 ]
106 }
107
108 spvtools_fuzzer("spvtools_val_fuzzer_src") {
109 sources = [
110 "spvtools_val_fuzzer.cpp",
111 ]
112 }
113
114 if (!build_with_chromium || use_fuzzing_engine) {
115 fuzzer_test("spvtools_as_fuzzer") {
116 sources = []
117 deps = [
118 ":spvtools_as_fuzzer_src",
119 ]
120 # Intentionally doesn't use the seed corpus, because it consumes
121 # part of the input as not part of the file.
122 }
123
124 fuzzer_test("spvtools_binary_parser_fuzzer") {
125 sources = []
126 deps = [
127 ":spvtools_binary_parser_fuzzer_src",
128 ]
129 # Intentionally doesn't use the seed corpus, because it consumes
130 # part of the input as not part of the file.
131 }
132
133 fuzzer_test("spvtools_dis_fuzzer") {
134 sources = []
135 deps = [
136 ":spvtools_dis_fuzzer_src",
137 ]
138 # Intentionally doesn't use the seed corpus, because it consumes
139 # part of the input as not part of the file.
140 }
141
142 fuzzer_test("spvtools_opt_performance_fuzzer") {
143 sources = []
144 deps = [
145 ":spvtools_opt_performance_fuzzer_src",
146 ]
147 seed_corpus = "corpora/spv"
148 }
149
150 fuzzer_test("spvtools_opt_legalization_fuzzer") {
151 sources = []
152 deps = [
153 ":spvtools_opt_legalization_fuzzer_src",
154 ]
155 seed_corpus = "corpora/spv"
156 }
157
158 fuzzer_test("spvtools_opt_size_fuzzer") {
159 sources = []
160 deps = [
161 ":spvtools_opt_size_fuzzer_src",
162 ]
163 seed_corpus = "corpora/spv"
164 }
165
166 fuzzer_test("spvtools_val_fuzzer") {
167 sources = []
168 deps = [
169 ":spvtools_val_fuzzer_src",
170 ]
171 seed_corpus = "corpora/spv"
172 }
173 }