From 468ed7843416d72d0c1454cac3e103ccadfde75c Mon Sep 17 00:00:00 2001 From: Kostya Serebryany Date: Tue, 8 Sep 2015 17:30:35 +0000 Subject: [PATCH] [libFuzzer] remove -iterations as redundant (there is also -num_runs) llvm-svn: 247030 --- llvm/lib/Fuzzer/FuzzerDriver.cpp | 2 +- llvm/lib/Fuzzer/FuzzerFlags.def | 3 --- llvm/lib/Fuzzer/FuzzerInternal.h | 2 +- llvm/lib/Fuzzer/FuzzerLoop.cpp | 4 ++-- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/llvm/lib/Fuzzer/FuzzerDriver.cpp b/llvm/lib/Fuzzer/FuzzerDriver.cpp index 8506fb48d0fd..55d1632a9a77 100644 --- a/llvm/lib/Fuzzer/FuzzerDriver.cpp +++ b/llvm/lib/Fuzzer/FuzzerDriver.cpp @@ -291,7 +291,7 @@ int FuzzerDriver(int argc, char **argv, UserSuppliedFuzzer &USF) { F.ShuffleAndMinimize(); if (Flags.save_minimized_corpus) F.SaveCorpus(); - F.Loop(Flags.iterations < 0 ? INT_MAX : Flags.iterations); + F.Loop(); if (Flags.verbosity) Printf("Done %d runs in %zd second(s)\n", F.getTotalNumberOfRuns(), F.secondsSinceProcessStartUp()); diff --git a/llvm/lib/Fuzzer/FuzzerFlags.def b/llvm/lib/Fuzzer/FuzzerFlags.def index ea47565f8926..1a6cb6333a72 100644 --- a/llvm/lib/Fuzzer/FuzzerFlags.def +++ b/llvm/lib/Fuzzer/FuzzerFlags.def @@ -12,9 +12,6 @@ //===----------------------------------------------------------------------===// FUZZER_FLAG_INT(verbosity, 1, "Verbosity level.") FUZZER_FLAG_INT(seed, 0, "Random seed. If 0, seed is generated.") -FUZZER_FLAG_INT(iterations, -1, - "Number of iterations of the fuzzer internal loop" - " (-1 for infinite iterations).") FUZZER_FLAG_INT(runs, -1, "Number of individual test runs (-1 for infinite runs).") FUZZER_FLAG_INT(max_len, 64, "Maximum length of the test input.") diff --git a/llvm/lib/Fuzzer/FuzzerInternal.h b/llvm/lib/Fuzzer/FuzzerInternal.h index 32edc91636a2..334800e8275f 100644 --- a/llvm/lib/Fuzzer/FuzzerInternal.h +++ b/llvm/lib/Fuzzer/FuzzerInternal.h @@ -94,7 +94,7 @@ class Fuzzer { }; Fuzzer(UserSuppliedFuzzer &USF, FuzzingOptions Options); void AddToCorpus(const Unit &U) { Corpus.push_back(U); } - void Loop(size_t NumIterations); + void Loop(); void ShuffleAndMinimize(); void InitializeTraceState(); size_t CorpusSize() const { return Corpus.size(); } diff --git a/llvm/lib/Fuzzer/FuzzerLoop.cpp b/llvm/lib/Fuzzer/FuzzerLoop.cpp index e65bd3314309..f1802f65c37a 100644 --- a/llvm/lib/Fuzzer/FuzzerLoop.cpp +++ b/llvm/lib/Fuzzer/FuzzerLoop.cpp @@ -327,11 +327,11 @@ void Fuzzer::MutateAndTestOne(Unit *U) { } } -void Fuzzer::Loop(size_t NumIterations) { +void Fuzzer::Loop() { for (auto &U: Options.Dictionary) USF.GetMD().AddWordToDictionary(U.data(), U.size()); - for (size_t i = 1; i <= NumIterations; i++) { + while (true) { for (size_t J1 = 0; J1 < Corpus.size(); J1++) { SyncCorpus(); RereadOutputCorpus();