Add Min Option For Dumping Input Seeds PiperOrigin-RevId: 974773370
diff --git a/centipede/engine_worker.cc b/centipede/engine_worker.cc index e0f6785..a806973 100644 --- a/centipede/engine_worker.cc +++ b/centipede/engine_worker.cc
@@ -198,6 +198,7 @@ "persistent_mode_socket="; // TODO: Use better flag names when // standardizing the protocol. constexpr std::string_view kWorkerCrossOverLevel = "crossover_level="; +constexpr std::string_view kWorkerMinSeeds = "min_seeds="; struct WorkerState { std::atomic<bool> has_failure_output = false; @@ -481,8 +482,8 @@ WORKER_CHECK_FOR_ERROR(); } - // TODO(xinhaoyuan): Make 32 adjustable. - while (seed_handles.size() < 32) { + const size_t min_seeds = GetWorkerFlags().GetIntFlag(kWorkerMinSeeds, 32); + while (seed_handles.size() < min_seeds) { const size_t prev_size = seed_handles.size(); adapter.GetRandomSeedInput(adapter.ctx, &sink); WorkerCheck(seed_handles.size() == prev_size + 1,
diff --git a/centipede/runner.cc b/centipede/runner.cc index 88a4ce9..f50d6ae 100644 --- a/centipede/runner.cc +++ b/centipede/runner.cc
@@ -570,7 +570,8 @@ ++seed_index; }; callbacks.GetPresetSeedInputs(dump_seed_callback); - while (seed_index < 32) { + const size_t min_seeds = state->flag_helper.GetIntFlag("min_seeds=", 32); + while (seed_index < min_seeds) { dump_seed_callback(callbacks.GetRandomSeedInput()); } }