[libFuzzer] don't timeout when loading the corpus. Be a bit more verbose when loading...
authorKostya Serebryany <kcc@google.com>
Wed, 17 Feb 2016 19:42:34 +0000 (19:42 +0000)
committerKostya Serebryany <kcc@google.com>
Wed, 17 Feb 2016 19:42:34 +0000 (19:42 +0000)
llvm-svn: 261143

llvm/lib/Fuzzer/FuzzerIO.cpp
llvm/lib/Fuzzer/FuzzerLoop.cpp

index 9df6837..5cc589a 100644 (file)
@@ -86,9 +86,13 @@ void WriteToFile(const Unit &U, const std::string &Path) {
 void ReadDirToVectorOfUnits(const char *Path, std::vector<Unit> *V,
                             long *Epoch) {
   long E = Epoch ? *Epoch : 0;
-  for (auto &X : ListFilesInDir(Path, Epoch)) {
+  auto Files = ListFilesInDir(Path, Epoch);
+  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 % 1000) == 0 && i)
+      Printf("Loaded %zd/%zd files from %s\n", i, Files.size(), Path);
     V->push_back(FileToVector(FilePath));
   }
 }
index 78d5c61..e044b67 100644 (file)
@@ -101,6 +101,8 @@ void Fuzzer::StaticAlarmCallback() {
 
 void Fuzzer::AlarmCallback() {
   assert(Options.UnitTimeoutSec > 0);
+  if (!CurrentUnitSize)
+    return; // We have not started running units yet.
   size_t Seconds =
       duration_cast<seconds>(system_clock::now() - UnitStartTime).count();
   if (Seconds == 0)