summaryrefslogtreecommitdiff
path: root/lib/fuzzer/FuzzerLoop.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2019-04-13 01:57:33 +0000
committerKostya Serebryany <kcc@google.com>2019-04-13 01:57:33 +0000
commit95ec60fc93e36acfb67f842c64f3b71774cbe7f1 (patch)
tree3e0f85a5a2efa0070893f5c48c077dee16f6a849 /lib/fuzzer/FuzzerLoop.cpp
parentc438ef37dfc4b954ead9df6222fe0bb36987268e (diff)
downloadcompiler-rt-95ec60fc93e36acfb67f842c64f3b71774cbe7f1.tar.gz
[libFuzzer] speedup the merge step in the fork mode by merging only the files that have unique features.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@358320 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/fuzzer/FuzzerLoop.cpp')
-rw-r--r--lib/fuzzer/FuzzerLoop.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/fuzzer/FuzzerLoop.cpp b/lib/fuzzer/FuzzerLoop.cpp
index b68d759cf..a323a7a46 100644
--- a/lib/fuzzer/FuzzerLoop.cpp
+++ b/lib/fuzzer/FuzzerLoop.cpp
@@ -446,13 +446,12 @@ void Fuzzer::PrintPulseAndReportSlowInput(const uint8_t *Data, size_t Size) {
}
static void WriteFeatureSetToFile(const std::string &FeaturesDir,
- const uint8_t Sha1[],
+ const std::string &FileName,
const Vector<uint32_t> &FeatureSet) {
if (FeaturesDir.empty() || FeatureSet.empty()) return;
WriteToFile(reinterpret_cast<const uint8_t *>(FeatureSet.data()),
FeatureSet.size() * sizeof(FeatureSet[0]),
- DirPlusFile(FeaturesDir, Sha1ToString(Sha1)));
- Printf("Features: %s\n", Sha1ToString(Sha1).c_str());
+ DirPlusFile(FeaturesDir, FileName));
}
static void RenameFeatureSetFile(const std::string &FeaturesDir,
@@ -490,7 +489,7 @@ bool Fuzzer::RunOne(const uint8_t *Data, size_t Size, bool MayDeleteFile,
auto NewII = Corpus.AddToCorpus({Data, Data + Size}, NumNewFeatures,
MayDeleteFile, TPC.ObservedFocusFunction(),
UniqFeatureSetTmp, DFT, II);
- WriteFeatureSetToFile(Options.FeaturesDir, NewII->Sha1,
+ WriteFeatureSetToFile(Options.FeaturesDir, Sha1ToString(NewII->Sha1),
NewII->UniqFeatureSet);
return true;
}