diff --git a/centipede/engine_worker.cc b/centipede/engine_worker.cc index e0f67855c..a80697349 100644 --- a/centipede/engine_worker.cc +++ b/centipede/engine_worker.cc @@ -198,6 +198,7 @@ constexpr std::string_view kWorkerPersistentModeSocketPathFlagHeader = "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 has_failure_output = false; @@ -481,8 +482,8 @@ void WorkerDoGetSeeds(const FuzzTestAdapter& adapter) { 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 88a4ce90d..f50d6ae3c 100644 --- a/centipede/runner.cc +++ b/centipede/runner.cc @@ -570,7 +570,8 @@ static void DumpSeedsToDir(RunnerCallbacks& callbacks, const char* output_dir) { ++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()); } }