summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/test/FuzzerUnittest.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2017-03-22 20:32:44 +0000
committerKostya Serebryany <kcc@google.com>2017-03-22 20:32:44 +0000
commit4fc6dd7f8fdd9e5d61f1cfe32afae038c0a8988f (patch)
treeca9aa9e03c351a2aa610237da827252e17a379fa /llvm/lib/Fuzzer/test/FuzzerUnittest.cpp
parent6b2c9ac8885c62500efbe6013936d83bee7fae8f (diff)
downloadbcm5719-llvm-4fc6dd7f8fdd9e5d61f1cfe32afae038c0a8988f.tar.gz
bcm5719-llvm-4fc6dd7f8fdd9e5d61f1cfe32afae038c0a8988f.zip
[libFuzzer] add two experimental flags to make corpus merging more scalable: -save_coverage_summary/-load_coverage_summary. This is still WIP, the documentation will come later if these flags survive
llvm-svn: 298548
Diffstat (limited to 'llvm/lib/Fuzzer/test/FuzzerUnittest.cpp')
-rw-r--r--llvm/lib/Fuzzer/test/FuzzerUnittest.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/test/FuzzerUnittest.cpp b/llvm/lib/Fuzzer/test/FuzzerUnittest.cpp
index 4992ef57b6c..5eb915a9162 100644
--- a/llvm/lib/Fuzzer/test/FuzzerUnittest.cpp
+++ b/llvm/lib/Fuzzer/test/FuzzerUnittest.cpp
@@ -14,6 +14,7 @@
#include "gtest/gtest.h"
#include <memory>
#include <set>
+#include <sstream>
using namespace fuzzer;
@@ -636,7 +637,10 @@ static void Merge(const std::string &Input,
Merger M;
std::vector<std::string> NewFiles;
EXPECT_TRUE(M.Parse(Input, true));
+ std::stringstream SS;
+ M.PrintSummary(SS);
EXPECT_EQ(NumNewFeatures, M.Merge(&NewFiles));
+ EXPECT_EQ(M.AllFeatures(), M.ParseSummary(SS));
EQ(NewFiles, Result);
}
@@ -706,6 +710,16 @@ TEST(Merge, Good) {
EQ(M.Files[2].Features, {1, 3, 6});
EXPECT_EQ(3U, M.Merge(&NewFiles));
EQ(NewFiles, {"B"});
+
+ // Same as the above, but with InitialFeatures.
+ EXPECT_TRUE(M.Parse("2\n0\nB\nC\n"
+ "STARTED 0 1001\nDONE 0 4 5 6 \n"
+ "STARTED 1 1002\nDONE 1 6 1 3\n"
+ "", true));
+ EQ(M.Files[0].Features, {4, 5, 6});
+ EQ(M.Files[1].Features, {1, 3, 6});
+ EXPECT_EQ(3U, M.Merge({1, 2, 3}, &NewFiles));
+ EQ(NewFiles, {"B"});
}
TEST(Merge, Merge) {
OpenPOWER on IntegriCloud