Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(477)

Side by Side Diff: testing/libfuzzer/fuzzer_test.gni

Issue 1768743002: [libfuzzer] in-vcs corpus support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: making sure 2nd build doesn't build anything. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « testing/libfuzzer/archive_corpus.py ('k') | third_party/boringssl/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # Defines fuzzer_test. 5 # Defines fuzzer_test.
6 # 6 #
7 import("//build/config/features.gni") 7 import("//build/config/features.gni")
8 import("//build/config/sanitizers/sanitizers.gni") 8 import("//build/config/sanitizers/sanitizers.gni")
9 import("//testing/test.gni") 9 import("//testing/test.gni")
10 10
11 # fuzzer_test is used to define individual libfuzzer tests. 11 # fuzzer_test is used to define individual libfuzzer tests.
12 # 12 #
13 # Supported attributes: 13 # Supported attributes:
14 # - (required) sources - fuzzer test source files 14 # - (required) sources - fuzzer test source files
15 # - deps - test dependencies 15 # - deps - test dependencies
16 # - additional_configs - additional configs to be used for compilation 16 # - additional_configs - additional configs to be used for compilation
17 # - dict - a dictionary file for the fuzzer. 17 # - dict - a dictionary file for the fuzzer.
18 # - libfuzzer_options - options for the fuzzer (e.g. -max_len or -timeout). 18 # - libfuzzer_options - options for the fuzzer (e.g. -max_len or -timeout).
19 # - seed_corpus - a directory with seed corpus.
19 # 20 #
20 # If use_libfuzzer gn flag is defined, then proper fuzzer would be build. 21 # If use_libfuzzer gn flag is defined, then proper fuzzer would be build.
21 # Without use_libfuzzer a unit-test style binary would be built on linux 22 # Without use_libfuzzer a unit-test style binary would be built on linux
22 # and the whole target is a no-op otherwise. 23 # and the whole target is a no-op otherwise.
23 # 24 #
24 # The template wraps test() target with appropriate dependencies. 25 # The template wraps test() target with appropriate dependencies.
25 # If any test run-time options are present (dict or libfuzzer_options), then a 26 # If any test run-time options are present (dict or libfuzzer_options), then a
26 # config (.options file) file would be generated or modified in root output 27 # config (.options file) file would be generated or modified in root output
27 # dir (next to test). 28 # dir (next to test).
28 template("fuzzer_test") { 29 template("fuzzer_test") {
(...skipping 13 matching lines...) Expand all
42 invoker.libfuzzer_options, 43 invoker.libfuzzer_options,
43 ] 44 ]
44 outputs = [ 45 outputs = [
45 "$root_build_dir/" + target_name + ".options", 46 "$root_build_dir/" + target_name + ".options",
46 ] 47 ]
47 } 48 }
48 49
49 test_deps += [ ":" + target_name + "_libfuzzer_options_copy" ] 50 test_deps += [ ":" + target_name + "_libfuzzer_options_copy" ]
50 } 51 }
51 52
53 if (defined(invoker.seed_corpus)) {
54 depfile = "$root_build_dir/$target_name" + ".seed_corpus.d"
55 out = "$root_build_dir/$target_name" + "_seed_corpus.zip"
56
57 action(target_name + "_seed_corpus") {
58 script = "//testing/libfuzzer/archive_corpus.py"
59 args = [
60 "--depfile",
61 rebase_path(depfile),
62 "--corpus",
63 rebase_path(invoker.seed_corpus),
64 "--output",
65 rebase_path(out),
66 "--fuzzer",
67 rebase_path("$root_build_dir/$target_name"),
68 ]
69
70 depfile = depfile
71 outputs = [
72 out,
73 ]
74 }
75
76 test_deps += [ ":" + target_name + "_seed_corpus" ]
77 }
78
52 if (defined(invoker.dict)) { 79 if (defined(invoker.dict)) {
53 # Copy dictionary to output. 80 # Copy dictionary to output.
54 copy(target_name + "_dict_copy") { 81 copy(target_name + "_dict_copy") {
55 sources = [ 82 sources = [
56 invoker.dict, 83 invoker.dict,
57 ] 84 ]
58 outputs = [ 85 outputs = [
59 "$root_build_dir/" + target_name + ".dict", 86 "$root_build_dir/" + target_name + ".dict",
60 ] 87 ]
61 } 88 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 135 }
109 if (defined(invoker.deps)) { 136 if (defined(invoker.deps)) {
110 assert(invoker.deps == [] || invoker.deps != []) 137 assert(invoker.deps == [] || invoker.deps != [])
111 } 138 }
112 if (defined(invoker.dict)) { 139 if (defined(invoker.dict)) {
113 assert(invoker.dict == [] || invoker.dict != []) 140 assert(invoker.dict == [] || invoker.dict != [])
114 } 141 }
115 if (defined(invoker.libfuzzer_options)) { 142 if (defined(invoker.libfuzzer_options)) {
116 assert(invoker.libfuzzer_options == [] || invoker.libfuzzer_options != []) 143 assert(invoker.libfuzzer_options == [] || invoker.libfuzzer_options != [])
117 } 144 }
145 if (defined(invoker.seed_corpus)) {
146 assert(invoker.seed_corpus == [] || invoker.seed_corpus != [])
147 }
118 148
119 group(target_name) { 149 group(target_name) {
120 } 150 }
121 } 151 }
122 } 152 }
OLDNEW
« no previous file with comments | « testing/libfuzzer/archive_corpus.py ('k') | third_party/boringssl/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698