[llvm] r268547 - [libFuzzer] print stats after running individual inputs
Kostya Serebryany via llvm-commits
llvm-commits at lists.llvm.org
Wed May 4 13:44:51 PDT 2016
Author: kcc
Date: Wed May 4 15:44:50 2016
New Revision: 268547
URL: http://llvm.org/viewvc/llvm-project?rev=268547&view=rev
Log:
[libFuzzer] print stats after running individual inputs
Modified:
llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp
llvm/trunk/lib/Fuzzer/FuzzerInternal.h
llvm/trunk/lib/Fuzzer/test/fuzzer.test
Modified: llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp?rev=268547&r1=268546&r2=268547&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp Wed May 4 15:44:50 2016
@@ -238,7 +238,7 @@ int RunOneTest(Fuzzer *F, const char *In
Unit U = FileToVector(InputFilePath);
Unit PreciseSizedU(U);
assert(PreciseSizedU.size() == PreciseSizedU.capacity());
- F->ExecuteCallback(PreciseSizedU.data(), PreciseSizedU.size());
+ F->RunOne(PreciseSizedU.data(), PreciseSizedU.size());
return 0;
}
@@ -355,6 +355,7 @@ static int FuzzerDriver(const std::vecto
auto MS = duration_cast<milliseconds>(StopTime - StartTime).count();
Printf("%s: %zd ms\n", Path.c_str(), (long)MS);
}
+ F.PrintFinalStats();
exit(0);
}
Modified: llvm/trunk/lib/Fuzzer/FuzzerInternal.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerInternal.h?rev=268547&r1=268546&r2=268547&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerInternal.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerInternal.h Wed May 4 15:44:50 2016
@@ -344,6 +344,7 @@ public:
static void StaticInterruptCallback();
void ExecuteCallback(const uint8_t *Data, size_t Size);
+ bool RunOne(const uint8_t *Data, size_t Size);
// Merge Corpora[1:] into Corpora[0].
void Merge(const std::vector<std::string> &Corpora);
@@ -359,7 +360,6 @@ private:
void InterruptCallback();
void MutateAndTestOne();
void ReportNewCoverage(const Unit &U);
- bool RunOne(const uint8_t *Data, size_t Size);
bool RunOne(const Unit &U) { return RunOne(U.data(), U.size()); }
void RunOneAndUpdateCorpus(uint8_t *Data, size_t Size);
void WriteToOutputCorpus(const Unit &U);
Modified: llvm/trunk/lib/Fuzzer/test/fuzzer.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/fuzzer.test?rev=268547&r1=268546&r2=268547&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/fuzzer.test (original)
+++ llvm/trunk/lib/Fuzzer/test/fuzzer.test Wed May 4 15:44:50 2016
@@ -87,6 +87,10 @@ FINAL_STATS: stat::new_units_added:
FINAL_STATS: stat::slowest_unit_time_sec: 0
FINAL_STATS: stat::peak_rss_mb:
+RUN: LLVMFuzzer-SimpleTest %S/dict1.txt -runs=33 -print_final_stats=1 2>&1 | FileCheck %s --check-prefix=FINAL_STATS1
+FINAL_STATS1: stat::number_of_executed_units: 33
+FINAL_STATS1: stat::peak_rss_mb:
+
RUN: LLVMFuzzer-SpamyTest -runs=1 2>&1 | FileCheck %s --check-prefix=FD_MASK_0
RUN: LLVMFuzzer-SpamyTest -runs=1 -close_fd_mask=0 2>&1 | FileCheck %s --check-prefix=FD_MASK_0
RUN: LLVMFuzzer-SpamyTest -runs=1 -close_fd_mask=1 2>&1 | FileCheck %s --check-prefix=FD_MASK_1
More information about the llvm-commits
mailing list