[libFuzzer] don't timeout when loading the corpus. Be a bit more verbose when loading large corpus.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261143 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Kostya Serebryany 2016-02-17 19:42:34 +00:00
parent 763454153f
commit 73b0e08885
2 changed files with 7 additions and 1 deletions

View 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));
}
}

View 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)