• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
15import("//testing/libfuzzer/fuzzer_test.gni")
16import("//testing/test.gni")
17
18config("fuzzer_config") {
19  configs = [ "../..:spvtools_internal_config" ]
20}
21
22group("fuzzers") {
23  testonly = true
24  deps = []
25
26  if (!build_with_chromium || use_fuzzing_engine) {
27    deps += [ ":fuzzers_bin" ]
28  }
29}
30
31if (!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
47template("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
69spvtools_fuzzer("spvtools_as_fuzzer_src") {
70  sources = [ "spvtools_as_fuzzer.cpp" ]
71}
72
73spvtools_fuzzer("spvtools_binary_parser_fuzzer_src") {
74  sources = [ "spvtools_binary_parser_fuzzer.cpp" ]
75}
76
77spvtools_fuzzer("spvtools_dis_fuzzer_src") {
78  sources = [ "spvtools_dis_fuzzer.cpp" ]
79}
80
81spvtools_fuzzer("spvtools_opt_performance_fuzzer_src") {
82  sources = [
83    "spvtools_opt_fuzzer_common.cpp",
84    "spvtools_opt_performance_fuzzer.cpp",
85  ]
86}
87
88spvtools_fuzzer("spvtools_opt_legalization_fuzzer_src") {
89  sources = [
90    "spvtools_opt_fuzzer_common.cpp",
91    "spvtools_opt_legalization_fuzzer.cpp",
92  ]
93}
94
95spvtools_fuzzer("spvtools_opt_size_fuzzer_src") {
96  sources = [
97    "spvtools_opt_fuzzer_common.cpp",
98    "spvtools_opt_size_fuzzer.cpp",
99  ]
100}
101
102spvtools_fuzzer("spvtools_val_fuzzer_src") {
103  sources = [ "spvtools_val_fuzzer.cpp" ]
104}
105
106if (!build_with_chromium || use_fuzzing_engine) {
107  fuzzer_test("spvtools_as_fuzzer") {
108    sources = []
109    deps = [ ":spvtools_as_fuzzer_src" ]
110
111    # Intentionally doesn't use the seed corpus, because it consumes
112    #  part of the input as not part of the file.
113  }
114
115  fuzzer_test("spvtools_binary_parser_fuzzer") {
116    sources = []
117    deps = [ ":spvtools_binary_parser_fuzzer_src" ]
118
119    # Intentionally doesn't use the seed corpus, because it consumes
120    #  part of the input as not part of the file.
121  }
122
123  fuzzer_test("spvtools_dis_fuzzer") {
124    sources = []
125    deps = [ ":spvtools_dis_fuzzer_src" ]
126
127    # Intentionally doesn't use the seed corpus, because it consumes
128    #  part of the input as not part of the file.
129  }
130
131  fuzzer_test("spvtools_opt_performance_fuzzer") {
132    sources = []
133    deps = [ ":spvtools_opt_performance_fuzzer_src" ]
134    seed_corpus = "corpora/spv"
135  }
136
137  fuzzer_test("spvtools_opt_legalization_fuzzer") {
138    sources = []
139    deps = [ ":spvtools_opt_legalization_fuzzer_src" ]
140    seed_corpus = "corpora/spv"
141  }
142
143  fuzzer_test("spvtools_opt_size_fuzzer") {
144    sources = []
145    deps = [ ":spvtools_opt_size_fuzzer_src" ]
146    seed_corpus = "corpora/spv"
147  }
148
149  fuzzer_test("spvtools_val_fuzzer") {
150    sources = []
151    deps = [ ":spvtools_val_fuzzer_src" ]
152    seed_corpus = "corpora/spv"
153  }
154}
155