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

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: nits 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
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 # - corpus - a directory with seed corpus.
mmoroz 2016/03/07 14:08:55 May be let's use |seed_corpus| option name and the
aizatsky 2016/03/07 21:42:54 Done.
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.corpus)) {
54 depfile = "$root_build_dir/$target_name" + ".corpus.d"
55 out = "$root_build_dir/$target_name" + "_corpus.zip"
56
57 action(target_name + "_corpus") {
58 script = "//testing/libfuzzer/archive_corpus.py"
59 args = [
60 "--depfile",
61 rebase_path(depfile),
62 "--corpus",
63 rebase_path(invoker.corpus),
64 "--output",
65 rebase_path(out),
66 ]
67
68 depfile = depfile
69 outputs = [
70 out,
71 ]
72 }
73
74 test_deps += [ ":" + target_name + "_corpus" ]
75 }
76
52 if (defined(invoker.dict)) { 77 if (defined(invoker.dict)) {
53 # Copy dictionary to output. 78 # Copy dictionary to output.
54 copy(target_name + "_dict_copy") { 79 copy(target_name + "_dict_copy") {
55 sources = [ 80 sources = [
56 invoker.dict, 81 invoker.dict,
57 ] 82 ]
58 outputs = [ 83 outputs = [
59 "$root_build_dir/" + target_name + ".dict", 84 "$root_build_dir/" + target_name + ".dict",
60 ] 85 ]
61 } 86 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 assert(invoker.dict == [] || invoker.dict != []) 138 assert(invoker.dict == [] || invoker.dict != [])
114 } 139 }
115 if (defined(invoker.libfuzzer_options)) { 140 if (defined(invoker.libfuzzer_options)) {
116 assert(invoker.libfuzzer_options == [] || invoker.libfuzzer_options != []) 141 assert(invoker.libfuzzer_options == [] || invoker.libfuzzer_options != [])
117 } 142 }
118 143
119 group(target_name) { 144 group(target_name) {
120 } 145 }
121 } 146 }
122 } 147 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698