| 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"));
|
| +}
|
|
|