mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-01 02:33:44 +00:00
[lib/Fuzzer] more efficient reload logic; also don't spam git too much
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237649 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c3ccd67d72
commit
3b3cbed1b0
@ -16,7 +16,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <unordered_set>
|
||||
#include <set>
|
||||
|
||||
#include "FuzzerInterface.h"
|
||||
|
||||
@ -132,7 +131,7 @@ class Fuzzer {
|
||||
size_t TotalNumberOfRuns = 0;
|
||||
|
||||
std::vector<Unit> Corpus;
|
||||
std::set<Unit> UnitsAddedAfterInitialLoad;
|
||||
std::unordered_set<std::string> UnitHashesAddedToCorpus;
|
||||
std::unordered_set<uintptr_t> FullCoverageSets;
|
||||
std::unordered_set<uint64_t> CoveragePairs;
|
||||
|
||||
|
@ -99,13 +99,15 @@ void Fuzzer::RereadOutputCorpus() {
|
||||
for (auto &X : AdditionalCorpus) {
|
||||
if (X.size() > (size_t)Options.MaxLen)
|
||||
X.resize(Options.MaxLen);
|
||||
if (UnitsAddedAfterInitialLoad.insert(X).second) {
|
||||
Corpus.push_back(X);
|
||||
if (UnitHashesAddedToCorpus.insert(Hash(X)).second) {
|
||||
CurrentUnit.clear();
|
||||
CurrentUnit.insert(CurrentUnit.begin(), X.begin(), X.end());
|
||||
size_t NewCoverage = RunOne(CurrentUnit);
|
||||
if (NewCoverage && Options.Verbosity >= 1)
|
||||
PrintStats("RELOAD", NewCoverage);
|
||||
if (NewCoverage) {
|
||||
Corpus.push_back(X);
|
||||
if (Options.Verbosity >= 1)
|
||||
PrintStats("RELOAD", NewCoverage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -142,6 +144,8 @@ void Fuzzer::ShuffleAndMinimize() {
|
||||
}
|
||||
}
|
||||
Corpus = NewCorpus;
|
||||
for (auto &X : Corpus)
|
||||
UnitHashesAddedToCorpus.insert(Hash(X));
|
||||
PrintStats("INITED", MaxCov);
|
||||
}
|
||||
|
||||
@ -292,7 +296,7 @@ void Fuzzer::SaveCorpus() {
|
||||
void Fuzzer::ReportNewCoverage(size_t NewCoverage, const Unit &U) {
|
||||
if (!NewCoverage) return;
|
||||
Corpus.push_back(U);
|
||||
UnitsAddedAfterInitialLoad.insert(U);
|
||||
UnitHashesAddedToCorpus.insert(Hash(U));
|
||||
PrintStats("NEW ", NewCoverage, "");
|
||||
if (Options.Verbosity) {
|
||||
std::cerr << " L: " << U.size();
|
||||
|
@ -9,7 +9,7 @@ cd $1
|
||||
git add *
|
||||
git commit -m "fuzz test corpus"
|
||||
git pull --no-edit
|
||||
for((attempt=0; attempt<100; attempt++)); do
|
||||
for((attempt=0; attempt<5; attempt++)); do
|
||||
echo GIT PUSH $1 ATTEMPT $attempt
|
||||
if $(git push); then break; fi
|
||||
git pull --no-edit
|
||||
|
Loading…
x
Reference in New Issue
Block a user