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

Unified Diff: testing/libfuzzer/fuzzer_test.gni

Issue 1703523002: [libfuzzer] support of custom libfuzzer options via .options file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | testing/libfuzzer/gen_fuzzer_runner.py » ('j') | testing/libfuzzer/gen_fuzzer_runner.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/libfuzzer/fuzzer_test.gni
diff --git a/testing/libfuzzer/fuzzer_test.gni b/testing/libfuzzer/fuzzer_test.gni
index 2064f6cf024c9abdabf346bd22cee094650908bc..5313faa9e3ba2487cd9b29992d929fda6fbe5881 100644
--- a/testing/libfuzzer/fuzzer_test.gni
+++ b/testing/libfuzzer/fuzzer_test.gni
@@ -11,7 +11,8 @@ import("//testing/test.gni")
# visible for testing only.
template("fuzzer_test_launcher") {
assert(defined(invoker.fuzzer_name), "need fuzzer_name in $target_name.")
- assert(defined(invoker.dict), "need dict in $target_name.")
+ assert(defined(invoker.dict) || defined(invoker.params),
+ "need dict or params in $target_name.")
generated_script = "$root_build_dir/$target_name"
@@ -22,9 +23,19 @@ template("fuzzer_test_launcher") {
invoker.fuzzer_name,
"--launcher",
rebase_path(generated_script, root_build_dir),
- "--dict",
- rebase_path("$root_build_dir/" + invoker.dict, root_build_dir),
]
+ if (defined(invoker.dict)) {
+ args += [
+ "--dict",
+ rebase_path("$root_build_dir/" + invoker.dict, root_build_dir),
+ ]
+ }
+ if (defined(invoker.params)) {
+ args += [
+ "--params",
+ "\"" + invoker.params + "\"",
+ ]
+ }
outputs = [
generated_script,
]
@@ -39,13 +50,14 @@ template("fuzzer_test_launcher") {
# - deps - test dependencies
# - additional_configs - additional configs to be used for compilation
# - dict - a dictionary file for the fuzzer.
+# - params - custom parameters for the fuzzer (e.g. some -max_len or -timeout).
#
# If use_libfuzzer gn flag is defined, then proper fuzzer would be build.
# Without use_libfuzzer a unit-test style binary would be built on linux
# and the whole target is a no-op otherwise.
#
# The template wraps test() target with appropriate dependencies.
-# If any test run-time options are present (dict), then a launcher
+# If any test run-time options are present (dict or params), then a launcher
# file would be generated with <fuzzer_name>.sh name in root output
# dir (next to test).
template("fuzzer_test") {
@@ -63,32 +75,40 @@ template("fuzzer_test") {
test_data += invoker.data
}
- if (defined(invoker.dict)) {
+ if (defined(invoker.dict) || defined(invoker.params)) {
fuzzer_name = target_name
launcher_name = target_name + ".sh"
- # Copy dictionary to output
- copy(target_name + "_dict_copy") {
- sources = [
- invoker.dict,
- ]
- outputs = [
- "$root_build_dir/" + invoker.dict,
- ]
+ if (defined(invoker.dict)) {
+ # Copy dictionary to output
+ copy(target_name + "_dict_copy") {
+ sources = [
+ invoker.dict,
+ ]
+ outputs = [
+ "$root_build_dir/" + invoker.dict,
+ ]
+ }
}
fuzzer_test_launcher(launcher_name) {
- dict = invoker.dict
+ if (defined(invoker.dict)) {
aizatsky 2016/02/16 18:25:05 use forward_variables_from (see below).
mmoroz 2016/02/17 10:36:48 Done. Didn't know that, thanks!
+ dict = invoker.dict
+ }
+ if (defined(invoker.params)) {
+ params = invoker.params
+ }
}
- test_deps += [
- ":$launcher_name",
- ":" + fuzzer_name + "_dict_copy",
- ]
- test_data += [
- invoker.dict,
- ":$launcher_name",
- ]
+ test_deps += [ ":$launcher_name" ]
+ if (defined(invoker.dict)) {
+ test_deps += [ ":" + fuzzer_name + "_dict_copy" ]
+ }
+
+ if (defined(invoker.dict)) {
+ test_data += [ invoker.dict ]
+ }
+ test_data += [ ":$launcher_name" ]
}
test(target_name) {
@@ -118,6 +138,9 @@ template("fuzzer_test") {
if (defined(invoker.dict)) {
assert(invoker.dict == [] || invoker.dict != [])
}
+ if (defined(invoker.params)) {
+ assert(invoker.params == [] || invoker.params != [])
+ }
group(target_name) {
}
« no previous file with comments | « no previous file | testing/libfuzzer/gen_fuzzer_runner.py » ('j') | testing/libfuzzer/gen_fuzzer_runner.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698