Skip to content

Commit

Permalink
[libFuzzer] log less when re-loading files; fix a silly bug: when run…
Browse files Browse the repository at this point in the history
…ning single files actually run all of them, not just the first one

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262754 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
kcc committed Mar 4, 2016
1 parent 1758dd6 commit 2c1ecb8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/Fuzzer/FuzzerDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ static int FuzzerDriver(const std::vector<std::string> &Args,
Inputs->size(), Runs);
for (auto &Path : *Inputs) {
auto StartTime = system_clock::now();
while (Runs-- > 0)
for (int Iter = 0; Iter < Runs; Iter++)
RunOneTest(&F, Path.c_str());
auto StopTime = system_clock::now();
auto MS = duration_cast<milliseconds>(StopTime - StartTime).count();
Expand Down
6 changes: 4 additions & 2 deletions lib/Fuzzer/FuzzerIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,14 @@ void ReadDirToVectorOfUnits(const char *Path, std::vector<Unit> *V,
long *Epoch, size_t MaxSize) {
long E = Epoch ? *Epoch : 0;
auto Files = ListFilesInDir(Path, Epoch);
size_t NumLoaded = 0;
for (size_t i = 0; i < Files.size(); i++) {
auto &X = Files[i];
auto FilePath = DirPlusFile(Path, X);
if (Epoch && GetEpoch(FilePath) < E) continue;
if ((i & (i - 1)) == 0 && i >= 1024)
Printf("Loaded %zd/%zd files from %s\n", i, Files.size(), Path);
NumLoaded++;
if ((NumLoaded & (NumLoaded - 1)) == 0 && NumLoaded >= 1024)
Printf("Loaded %zd/%zd files from %s\n", NumLoaded, Files.size(), Path);
V->push_back(FileToVector(FilePath, MaxSize));
}
}
Expand Down

0 comments on commit 2c1ecb8

Please sign in to comment.