• 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    deps = [
52      "../..:spvtools",
53      "../..:spvtools_opt",
54      "../..:spvtools_val",
55    ]
56    if (defined(invoker.deps)) {
57      deps += invoker.deps
58    }
59
60    configs -= [ "//build/config/compiler:chromium_code" ]
61    configs += [
62      "//build/config/compiler:no_chromium_code",
63      ":fuzzer_config",
64    ]
65  }
66}
67
68spvtools_fuzzer("spvtools_as_fuzzer_src") {
69  sources = [ "spvtools_as_fuzzer.cpp" ]
70}
71
72spvtools_fuzzer("spvtools_binary_parser_fuzzer_src") {
73  sources = [ "spvtools_binary_parser_fuzzer.cpp" ]
74}
75
76spvtools_fuzzer("spvtools_dis_fuzzer_src") {
77  sources = [ "spvtools_dis_fuzzer.cpp" ]
78}
79
80spvtools_fuzzer("spvtools_opt_performance_fuzzer_src") {
81  sources = [ "spvtools_opt_performance_fuzzer.cpp" ]
82}
83
84spvtools_fuzzer("spvtools_opt_legalization_fuzzer_src") {
85  sources = [ "spvtools_opt_legalization_fuzzer.cpp" ]
86}
87
88spvtools_fuzzer("spvtools_opt_size_fuzzer_src") {
89  sources = [ "spvtools_opt_size_fuzzer.cpp" ]
90}
91
92spvtools_fuzzer("spvtools_val_fuzzer_src") {
93  sources = [ "spvtools_val_fuzzer.cpp" ]
94}
95
96if (!build_with_chromium || use_fuzzing_engine) {
97  fuzzer_test("spvtools_as_fuzzer") {
98    sources = []
99    deps = [ ":spvtools_as_fuzzer_src" ]
100
101    # Intentionally doesn't use the seed corpus, because it consumes
102    #  part of the input as not part of the file.
103  }
104
105  fuzzer_test("spvtools_binary_parser_fuzzer") {
106    sources = []
107    deps = [ ":spvtools_binary_parser_fuzzer_src" ]
108
109    # Intentionally doesn't use the seed corpus, because it consumes
110    #  part of the input as not part of the file.
111  }
112
113  fuzzer_test("spvtools_dis_fuzzer") {
114    sources = []
115    deps = [ ":spvtools_dis_fuzzer_src" ]
116
117    # Intentionally doesn't use the seed corpus, because it consumes
118    #  part of the input as not part of the file.
119  }
120
121  fuzzer_test("spvtools_opt_performance_fuzzer") {
122    sources = []
123    deps = [ ":spvtools_opt_performance_fuzzer_src" ]
124    seed_corpus = "corpora/spv"
125  }
126
127  fuzzer_test("spvtools_opt_legalization_fuzzer") {
128    sources = []
129    deps = [ ":spvtools_opt_legalization_fuzzer_src" ]
130    seed_corpus = "corpora/spv"
131  }
132
133  fuzzer_test("spvtools_opt_size_fuzzer") {
134    sources = []
135    deps = [ ":spvtools_opt_size_fuzzer_src" ]
136    seed_corpus = "corpora/spv"
137  }
138
139  fuzzer_test("spvtools_val_fuzzer") {
140    sources = []
141    deps = [ ":spvtools_val_fuzzer_src" ]
142    seed_corpus = "corpora/spv"
143  }
144}
145