[llvm] r282971 - [libFuzzer] remove unused option
Kostya Serebryany via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 30 15:29:58 PDT 2016
Author: kcc
Date: Fri Sep 30 17:29:57 2016
New Revision: 282971
URL: http://llvm.org/viewvc/llvm-project?rev=282971&view=rev
Log:
[libFuzzer] remove unused option
Removed:
llvm/trunk/lib/Fuzzer/test/fuzzer-prunecorpus.test
Modified:
llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp
llvm/trunk/lib/Fuzzer/FuzzerFlags.def
llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp
llvm/trunk/lib/Fuzzer/FuzzerOptions.h
llvm/trunk/lib/Fuzzer/test/CustomCrossOverTest.cpp
llvm/trunk/lib/Fuzzer/test/fuzzer-customcrossover.test
Modified: llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp?rev=282971&r1=282970&r2=282971&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp Fri Sep 30 17:29:57 2016
@@ -427,7 +427,6 @@ int FuzzerDriver(int *argc, char ***argv
Options.PrintFinalStats = Flags.print_final_stats;
Options.PrintCorpusStats = Flags.print_corpus_stats;
Options.PrintCoverage = Flags.print_coverage;
- Options.PruneCorpus = Flags.prune_corpus;
if (Flags.exit_on_src_pos)
Options.ExitOnSrcPos = Flags.exit_on_src_pos;
Modified: llvm/trunk/lib/Fuzzer/FuzzerFlags.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerFlags.def?rev=282971&r1=282970&r2=282971&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerFlags.def (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerFlags.def Fri Sep 30 17:29:57 2016
@@ -92,8 +92,6 @@ FUZZER_FLAG_INT(detect_leaks, 1, "If 1,
"try to detect memory leaks during fuzzing (i.e. not only at shut down).")
FUZZER_FLAG_INT(rss_limit_mb, 2048, "If non-zero, the fuzzer will exit upon"
"reaching this limit of RSS memory usage.")
-FUZZER_FLAG_INT(prune_corpus, 1, "Prune corpus items without new coverage when "
- "loading corpus.")
FUZZER_FLAG_STRING(exit_on_src_pos, "Exit if a newly found PC originates"
" from the given source location. Example: -exit_on_src_pos=foo.cc:123. "
"Used primarily for testing libFuzzer itself.")
Modified: llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp?rev=282971&r1=282970&r2=282971&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp Fri Sep 30 17:29:57 2016
@@ -413,8 +413,7 @@ void Fuzzer::ShuffleAndMinimize(UnitVect
ShuffleCorpus(InitialCorpus);
for (const auto &U : *InitialCorpus) {
- bool NewCoverage = RunOne(U);
- if (!Options.PruneCorpus || NewCoverage) {
+ if (RunOne(U)) {
AddToCorpusAndMaybeRerun(U);
if (Options.Verbosity >= 2)
Printf("NEW0: %zd L %zd\n", MaxCoverage.BlockCoverage, U.size());
Modified: llvm/trunk/lib/Fuzzer/FuzzerOptions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerOptions.h?rev=282971&r1=282970&r2=282971&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerOptions.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerOptions.h Fri Sep 30 17:29:57 2016
@@ -49,7 +49,6 @@ struct FuzzingOptions {
bool PrintCorpusStats = false;
bool PrintCoverage = false;
bool DetectLeaks = true;
- bool PruneCorpus = true;
};
} // namespace fuzzer
Modified: llvm/trunk/lib/Fuzzer/test/CustomCrossOverTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/CustomCrossOverTest.cpp?rev=282971&r1=282970&r2=282971&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/CustomCrossOverTest.cpp (original)
+++ llvm/trunk/lib/Fuzzer/test/CustomCrossOverTest.cpp Fri Sep 30 17:29:57 2016
@@ -15,10 +15,16 @@
static const char *Separator = "-_^_-";
static const char *Target = "012-_^_-abc";
+static volatile int sink;
+
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
assert(Data);
std::string Str(reinterpret_cast<const char *>(Data), Size);
+ // Ensure that two different elements exist in the corpus.
+ if (Size && Data[0] == '0') sink++;
+ if (Size && Data[0] == 'a') sink--;
+
if (Str.find(Target) != std::string::npos) {
std::cout << "BINGO; Found the target, exiting\n";
exit(1);
Modified: llvm/trunk/lib/Fuzzer/test/fuzzer-customcrossover.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/fuzzer-customcrossover.test?rev=282971&r1=282970&r2=282971&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/fuzzer-customcrossover.test (original)
+++ llvm/trunk/lib/Fuzzer/test/fuzzer-customcrossover.test Fri Sep 30 17:29:57 2016
@@ -2,7 +2,7 @@ RUN: rm -rf %t/CustomCrossover
RUN: mkdir -p %t/CustomCrossover
RUN: echo "0123456789" > %t/CustomCrossover/digits
RUN: echo "abcdefghij" > %t/CustomCrossover/chars
-RUN: not LLVMFuzzer-CustomCrossOverTest -seed=1 -use_memcmp=0 -runs=100000 -prune_corpus=0 %t/CustomCrossover 2>&1 | FileCheck %s --check-prefix=LLVMFuzzerCustomCrossover
+RUN: not LLVMFuzzer-CustomCrossOverTest -seed=1 -use_memcmp=0 -runs=100000 %t/CustomCrossover 2>&1 | FileCheck %s --check-prefix=LLVMFuzzerCustomCrossover
RUN: rm -rf %t/CustomCrossover
LLVMFuzzerCustomCrossover: In LLVMFuzzerCustomCrossover
Removed: llvm/trunk/lib/Fuzzer/test/fuzzer-prunecorpus.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/fuzzer-prunecorpus.test?rev=282970&view=auto
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/fuzzer-prunecorpus.test (original)
+++ llvm/trunk/lib/Fuzzer/test/fuzzer-prunecorpus.test (removed)
@@ -1,13 +0,0 @@
-RUN: rm -rf %t/PruneCorpus
-RUN: mkdir -p %t/PruneCorpus
-RUN: echo a > %t/PruneCorpus/a
-RUN: echo b > %t/PruneCorpus/b
-RUN: LLVMFuzzer-EmptyTest %t/PruneCorpus -prune_corpus=1 -runs=0 2>&1 | FileCheck %s --check-prefix=PRUNE
-RUN: LLVMFuzzer-EmptyTest %t/PruneCorpus -prune_corpus=0 -runs=0 2>&1 | FileCheck %s --check-prefix=NOPRUNE
-RUN: rm -rf %t/PruneCorpus
-
-PRUNE: READ units: 2
-PRUNE: INITED{{.*}}units: 1
-NOPRUNE: READ units: 2
-NOPRUNE: INITED{{.*}}units: 2
-
More information about the llvm-commits
mailing list