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

Unified Diff: testing/libfuzzer/tests/fuzzer_launcher_test.cc

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
« testing/libfuzzer/gen_fuzzer_runner.py ('K') | « testing/libfuzzer/tests/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/libfuzzer/tests/fuzzer_launcher_test.cc
diff --git a/testing/libfuzzer/tests/fuzzer_launcher_test.cc b/testing/libfuzzer/tests/fuzzer_launcher_test.cc
index 70f51fb3edf2f3d2c18994b2a36c93b4e6dbe4d7..7895a7aab2266f9a365c1e30e482e3bcff435343 100644
--- a/testing/libfuzzer/tests/fuzzer_launcher_test.cc
+++ b/testing/libfuzzer/tests/fuzzer_launcher_test.cc
@@ -37,3 +37,47 @@ TEST(FuzzerLauncherTest, Dict) {
EXPECT_THAT(fuzzer_args[1], EndsWith("test_dict"));
EXPECT_EQ("-custom_option", fuzzer_args[2]);
}
+
+TEST(FuzzerLauncherTest, Params) {
+ base::FilePath exe_path;
+ PathService::Get(base::FILE_EXE, &exe_path);
+ std::string launcher_path =
+ exe_path.DirName().Append("test_params_launcher.sh").value();
+
+ std::string output;
+ base::CommandLine cmd({{launcher_path, "-custom_option"}});
+ bool success = base::GetAppOutputAndError(cmd, &output);
+ EXPECT_TRUE(success);
+ std::vector<std::string> fuzzer_args = base::SplitString(
+ output, "\n\r", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
+
+ EXPECT_EQ(3UL, fuzzer_args.size());
+
+ EXPECT_THAT(fuzzer_args[0], EndsWith("print_args.py"));
+ EXPECT_EQ("-custom_option", fuzzer_args[1]);
+ EXPECT_THAT(fuzzer_args[2], StartsWith("-test_param"));
+ EXPECT_THAT(fuzzer_args[2], EndsWith("test_value"));
+}
+
+TEST(FuzzerLauncherTest, DictAndParams) {
+ base::FilePath exe_path;
+ PathService::Get(base::FILE_EXE, &exe_path);
+ std::string launcher_path =
+ exe_path.DirName().Append("test_dict_and_params_launcher.sh").value();
+
+ std::string output;
+ base::CommandLine cmd({{launcher_path, "-custom_option"}});
+ bool success = base::GetAppOutputAndError(cmd, &output);
+ EXPECT_TRUE(success);
+ std::vector<std::string> fuzzer_args = base::SplitString(
+ output, "\n\r", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
+
+ EXPECT_EQ(4UL, fuzzer_args.size());
+
+ EXPECT_THAT(fuzzer_args[0], EndsWith("print_args.py"));
+ EXPECT_THAT(fuzzer_args[1], StartsWith("-dict"));
+ EXPECT_THAT(fuzzer_args[1], EndsWith("test_dict"));
+ EXPECT_EQ("-custom_option", fuzzer_args[2]);
+ EXPECT_THAT(fuzzer_args[3], StartsWith("-test_param"));
+ EXPECT_THAT(fuzzer_args[3], EndsWith("test_value"));
+}
« testing/libfuzzer/gen_fuzzer_runner.py ('K') | « testing/libfuzzer/tests/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698