No public description PiperOrigin-RevId: 757888608
diff --git a/.github/workflows/bazel_test.yml b/.github/workflows/bazel_test.yml index a83bee7..88315d8 100644 --- a/.github/workflows/bazel_test.yml +++ b/.github/workflows/bazel_test.yml
@@ -76,6 +76,7 @@ -c ${{ matrix.compilation_mode }} \ --config=fuzztest-experimental --config=asan \ --platform_suffix=fuzztest-experimental-asan \ + --experimental_ui_max_stdouterr_bytes=4000000 \ //e2e_tests:corpus_database_test - name: Save new cache based on main if: github.ref == 'refs/heads/main'
diff --git a/centipede/centipede_interface.cc b/centipede/centipede_interface.cc index 9acb555..bc8aed1 100644 --- a/centipede/centipede_interface.cc +++ b/centipede/centipede_interface.cc
@@ -491,43 +491,9 @@ LOG(INFO) << "Test shard index: " << test_shard_index << " Total test shards: " << total_test_shards; - // Step 2: Are we resuming from a previously terminated run? - // Currently there are two ways of determining this: - // - // The old way is to find the last index of a fuzz test for which we already - // have a workdir, which is done below, and then resume from the test. This - // requires Centipede to know the order of all the tests, which is unavailable - // in the single test execution model. - // - // The new way is to use the per-workflow execution ID to match with any - // previously stored execution ID, which works independently for each test - - // it is implemented and documented later. - // - // TODO(xinhaoyuan): Clean up the old approach when it's no longer used. - bool is_resuming = false; - int resuming_fuzztest_idx = 0; - if (!fuzztest_config.execution_id.has_value()) { - for (int i = 0; i < fuzz_tests_to_run.size(); ++i) { - if (!is_workdir_specified) { - env.workdir = base_workdir_path / fuzz_tests_to_run[i]; - } - // Check the existence of the coverage path to not only make sure the - // workdir exists, but also that it was created for the same binary as in - // this run. - if (RemotePathExists(WorkDir{env}.CoverageDirPath())) { - is_resuming = true; - resuming_fuzztest_idx = i; - } - } - } - - LOG_IF(INFO, is_resuming) << "Resuming from the fuzz test " - << fuzz_tests_to_run[resuming_fuzztest_idx] - << " (index: " << resuming_fuzztest_idx << ")"; - - // Step 3: Iterate over the fuzz tests and run them. + // Step 2: Iterate over the fuzz tests and run them. const std::string binary = env.binary; - for (int i = resuming_fuzztest_idx; i < fuzz_tests_to_run.size(); ++i) { + for (int i = 0; i < fuzz_tests_to_run.size(); ++i) { // Clean up previous stop requests. stop_time will be set later. ClearEarlyStopRequestAndSetStopTime(/*stop_time=*/absl::InfiniteFuture()); if (!env.fuzztest_single_test_mode && @@ -548,6 +514,8 @@ (base_workdir_path / absl::StrCat(fuzz_tests_to_run[i], ".execution_id")) .string(); + + bool is_resuming = false; if (!is_workdir_specified && fuzztest_config.execution_id.has_value()) { // Use the execution IDs to resume or skip tests. const bool execution_id_matched = [&] {
diff --git a/e2e_tests/corpus_database_test.cc b/e2e_tests/corpus_database_test.cc index b9136d1..3c94aae 100644 --- a/e2e_tests/corpus_database_test.cc +++ b/e2e_tests/corpus_database_test.cc
@@ -183,7 +183,7 @@ << std_err; } -TEST_P(UpdateCorpusDatabaseTest, ResumedFuzzTestRunsForRemainingTime) { +TEST_P(UpdateCorpusDatabaseTest, StartsNewFuzzTestRunsWithoutExecutionIds) { TempDir corpus_database; // 1st run that gets interrupted. @@ -196,13 +196,15 @@ auto [fst_status, fst_std_out, fst_std_err] = RunBinaryMaybeWithCentipede( GetCorpusDatabaseTestingBinaryPath(), fst_run_options); + EXPECT_THAT(fst_std_err, HasSubstr("Fuzzing FuzzTest.FailsInTwoWays for 5m")); + // Adjust the fuzzing time so that only 1s remains. const absl::StatusOr<std::string> fuzzing_time_file = FindFile(corpus_database.path().c_str(), "fuzzing_time"); ASSERT_TRUE(fuzzing_time_file.ok()) << fst_std_err; ASSERT_TRUE(WriteFile(*fuzzing_time_file, "299s")); - // 2nd run that resumes the fuzzing. + // 2nd run that does not resume due to no execution ID. RunOptions snd_run_options; snd_run_options.fuzztest_flags = { {"corpus_database", corpus_database.path()}, @@ -212,11 +214,7 @@ auto [snd_status, snd_std_out, snd_std_err] = RunBinaryMaybeWithCentipede( GetCorpusDatabaseTestingBinaryPath(), snd_run_options); - EXPECT_THAT( - snd_std_err, - // The resumed fuzz test is the first one defined in the binary. - AllOf(HasSubstr("Resuming from the fuzz test FuzzTest.FailsInTwoWays"), - HasSubstr("Fuzzing FuzzTest.FailsInTwoWays for 1s"))); + EXPECT_THAT(snd_std_err, HasSubstr("Fuzzing FuzzTest.FailsInTwoWays for 5m")); } TEST_P(UpdateCorpusDatabaseTest,
diff --git a/fuzztest/internal/centipede_adaptor.cc b/fuzztest/internal/centipede_adaptor.cc index c019d9f..fe591dc 100644 --- a/fuzztest/internal/centipede_adaptor.cc +++ b/fuzztest/internal/centipede_adaptor.cc
@@ -166,20 +166,6 @@ #endif } -std::string GetSelfBinaryHashForCentipedeEnvironment() { - static absl::NoDestructor<std::string> cached_self_binary_hash{[] { - fuzztest::internal::Environment env; - const auto args = GetProcessArgs(); - FUZZTEST_INTERNAL_CHECK( - args.ok(), absl::StrCat("failed to get the original process args: ", - args.status())); - env.coverage_binary = (*args)[0]; - env.UpdateBinaryHashIfEmpty(); - return env.binary_hash; - }()}; - return *cached_self_binary_hash; -} - std::string ShellEscape(absl::string_view str) { return absl::StrCat("'", absl::StrReplaceAll(str, {{"'", "'\\''"}}), "'"); } @@ -278,7 +264,7 @@ } env.coverage_binary = (*args)[0]; env.binary_name = std::filesystem::path{(*args)[0]}.filename(); - env.binary_hash = GetSelfBinaryHashForCentipedeEnvironment(); + env.binary_hash = "DUMMY_HASH"; env.exit_on_crash = // Do shallow testing when running in unit-test mode unless we are replay // coverage inputs.