File tree Expand file tree Collapse file tree 3 files changed +12
-15
lines changed Expand file tree Collapse file tree 3 files changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -425,7 +425,7 @@ bool Centipede::RunBatch(
425425 success;
426426 }
427427 if (EarlyStopRequested ()) return false ;
428- if (!success && env_.exit_on_crash ) {
428+ if (!success && env_.exit_on_crash && ! ShouldStop () ) {
429429 FUZZTEST_LOG (INFO) << " --exit_on_crash is enabled; exiting soon" ;
430430 RequestEarlyStop (EXIT_FAILURE);
431431 return false ;
@@ -881,6 +881,13 @@ void Centipede::ReportCrash(std::string_view binary,
881881 const BatchResult &batch_result) {
882882 FUZZTEST_CHECK_EQ (input_vec.size (), batch_result.results ().size ());
883883
884+ if (ShouldStop ()) {
885+ FUZZTEST_LOG_FIRST_N (WARNING, 1 )
886+ << " Stop condition met - not reporting further crashes possibly "
887+ " related to the stop condition." ;
888+ return ;
889+ }
890+
884891 const size_t suspect_input_idx = std::clamp<size_t >(
885892 batch_result.num_outputs_read (), 0 , input_vec.size () - 1 );
886893 auto log_execution_failure = [&](std::string_view log_prefix) {
Original file line number Diff line number Diff line change @@ -479,7 +479,7 @@ int CentipedeCallbacks::RunBatchForBinary(std::string_view binary) {
479479 env_.timeout_per_batch == 0
480480 ? absl::InfiniteDuration ()
481481 : absl::Seconds (env_.timeout_per_batch ) + absl::Seconds (5 );
482- const auto deadline = absl::Now () + amortized_timeout;
482+ const auto deadline = std::min ( absl::Now () + amortized_timeout, env_. stop_at ) ;
483483 int exit_code = EXIT_SUCCESS;
484484 const bool should_clean_up = [&] {
485485 if (!cmd.is_executing () && !cmd.ExecuteAsync ()) {
@@ -497,11 +497,12 @@ int CentipedeCallbacks::RunBatchForBinary(std::string_view binary) {
497497 if (should_clean_up) {
498498 exit_code = [&] {
499499 if (!cmd.is_executing ()) return EXIT_FAILURE;
500- FUZZTEST_LOG (ERROR) << " Cleaning up the batch execution." ;
500+ FUZZTEST_LOG (ERROR) << " Cleaning up the batch execution with timeout "
501+ << kCommandCleanupTimeout ;
501502 cmd.RequestStop ();
502503 const auto ret = cmd.Wait (absl::Now () + kCommandCleanupTimeout );
503504 if (ret.has_value ()) return *ret;
504- FUZZTEST_LOG (ERROR) << " Batch execution cleanup failed to end in 60s ." ;
505+ FUZZTEST_LOG (ERROR) << " Failed to wait for the batch execution cleanup ." ;
505506 return EXIT_FAILURE;
506507 }();
507508 command_contexts_.erase (
Original file line number Diff line number Diff line change @@ -285,17 +285,6 @@ void Environment::UpdateWithTargetConfig(
285285 timeout_per_input = time_limit_per_input_sec;
286286 UpdateTimeoutPerBatchIfEqualTo (autocomputed_timeout_per_batch);
287287
288- // Adjust `timeout_per_batch` to never exceed the test time limit.
289- if (const auto test_time_limit = config.GetTimeLimitPerTest ();
290- test_time_limit < absl::InfiniteDuration ()) {
291- const size_t test_time_limit_seconds =
292- convert_to_seconds (test_time_limit, " Test time limit" );
293- timeout_per_batch =
294- timeout_per_batch == 0
295- ? test_time_limit_seconds
296- : std::min (timeout_per_batch, test_time_limit_seconds);
297- }
298-
299288 // Convert bytes to MB by rounding up.
300289 constexpr auto bytes_to_mb = [](size_t bytes) {
301290 return bytes == 0 ? 0 : (bytes - 1 ) / 1024 / 1024 + 1 ;
You can’t perform that action at this time.
0 commit comments