1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

[libFuzzer] print stats after running individual inputs

llvm-svn: 268547
This commit is contained in:
Kostya Serebryany 2016-05-04 20:44:50 +00:00
parent 9748823e1c
commit 29374da006
3 changed files with 7 additions and 2 deletions

View File

@ -238,7 +238,7 @@ int RunOneTest(Fuzzer *F, const char *InputFilePath) {
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::vector<std::string> &Args,
auto MS = duration_cast<milliseconds>(StopTime - StartTime).count();
Printf("%s: %zd ms\n", Path.c_str(), (long)MS);
}
F.PrintFinalStats();
exit(0);
}

View File

@ -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);

View File

@ -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