[compiler-rt] r353573 - [libFuzzer] remove two unused experimental flags

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 8 14:02:38 PST 2019


Author: kcc
Date: Fri Feb  8 14:02:37 2019
New Revision: 353573

URL: http://llvm.org/viewvc/llvm-project?rev=353573&view=rev
Log:
[libFuzzer] remove two unused experimental flags

Removed:
    compiler-rt/trunk/test/fuzzer/merge-summary.test
Modified:
    compiler-rt/trunk/lib/fuzzer/FuzzerDriver.cpp
    compiler-rt/trunk/lib/fuzzer/FuzzerFlags.def
    compiler-rt/trunk/lib/fuzzer/FuzzerMerge.cpp
    compiler-rt/trunk/lib/fuzzer/FuzzerMerge.h
    compiler-rt/trunk/lib/fuzzer/tests/FuzzerUnittest.cpp
    compiler-rt/trunk/test/fuzzer/merge-control-file.test

Modified: compiler-rt/trunk/lib/fuzzer/FuzzerDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerDriver.cpp?rev=353573&r1=353572&r2=353573&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fuzzer/FuzzerDriver.cpp (original)
+++ compiler-rt/trunk/lib/fuzzer/FuzzerDriver.cpp Fri Feb  8 14:02:37 2019
@@ -478,8 +478,7 @@ void FuzzWithFork(const FuzzingOptions &
   auto CFPath = TempPath(".fork");
   Printf("INFO: -fork=1: doing fuzzing in a separate process in order to "
          "be more resistant to crashes, timeouts, and OOMs\n");
-  auto Files =
-      CrashResistantMerge(Args, Corpora, CFPath, nullptr, nullptr);
+  auto Files = CrashResistantMerge(Args, Corpora, CFPath);
   Printf("INFO: -fork=1: seed corpus analyzed, %zd seeds chosen, starting to "
          "fuzz in separate processes\n", Files.size());
 
@@ -738,9 +737,7 @@ int FuzzerDriver(int *argc, char ***argv
     }
     std::string CFPath =
         Flags.merge_control_file ? Flags.merge_control_file : TempPath(".txt");
-    auto Files =
-        CrashResistantMerge(Args, *Inputs, CFPath, Flags.load_coverage_summary,
-                            Flags.save_coverage_summary);
+    auto Files = CrashResistantMerge(Args, *Inputs, CFPath);
     for (auto &Path : Files)
       F->WriteToOutputCorpus(FileToVector(Path, Options.MaxLen));
     // We are done, delete the control file if it was a temporary one.

Modified: compiler-rt/trunk/lib/fuzzer/FuzzerFlags.def
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerFlags.def?rev=353573&r1=353572&r2=353573&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fuzzer/FuzzerFlags.def (original)
+++ compiler-rt/trunk/lib/fuzzer/FuzzerFlags.def Fri Feb  8 14:02:37 2019
@@ -52,13 +52,6 @@ FUZZER_FLAG_STRING(merge_control_file,
                    "If a merge process gets killed it tries to leave this file "
                    "in a state suitable for resuming the merge. "
                    "By default a temporary file will be used.")
-FUZZER_FLAG_STRING(save_coverage_summary, "Experimental:"
-                   " save coverage summary to a given file."
-                   " Used with -merge=1")
-FUZZER_FLAG_STRING(load_coverage_summary, "Experimental:"
-                   " load coverage summary from a given file."
-                   " Treat this coverage as belonging to the first corpus. "
-                   " Used with -merge=1")
 FUZZER_FLAG_INT(minimize_crash, 0, "If 1, minimizes the provided"
   " crash input. Use with -runs=N or -max_total_time=N to limit "
   "the number attempts."

Modified: compiler-rt/trunk/lib/fuzzer/FuzzerMerge.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerMerge.cpp?rev=353573&r1=353572&r2=353573&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fuzzer/FuzzerMerge.cpp (original)
+++ compiler-rt/trunk/lib/fuzzer/FuzzerMerge.cpp Fri Feb  8 14:02:37 2019
@@ -168,16 +168,6 @@ size_t Merger::Merge(const Set<uint32_t>
   return AllFeatures.size() - InitialNumFeatures;
 }
 
-void Merger::PrintSummary(std::ostream &OS) {
-  for (auto &File : Files) {
-    OS << std::hex;
-    OS << File.Name << " size: " << File.Size << " features: ";
-    for (auto Feature : File.Features)
-      OS << " " << Feature;
-    OS << "\n";
-  }
-}
-
 Set<uint32_t> Merger::AllFeatures() const {
   Set<uint32_t> S;
   for (auto &File : Files)
@@ -185,25 +175,6 @@ Set<uint32_t> Merger::AllFeatures() cons
   return S;
 }
 
-Set<uint32_t> Merger::ParseSummary(std::istream &IS) {
-  std::string Line, Tmp;
-  Set<uint32_t> Res;
-  while (std::getline(IS, Line, '\n')) {
-    size_t N;
-    std::istringstream ISS1(Line);
-    ISS1 >> Tmp;  // Name
-    ISS1 >> Tmp;  // size:
-    assert(Tmp == "size:" && "Corrupt summary file");
-    ISS1 >> std::hex;
-    ISS1 >> N;    // File Size
-    ISS1 >> Tmp;  // features:
-    assert(Tmp == "features:" && "Corrupt summary file");
-    while (ISS1 >> std::hex >> N)
-      Res.insert(N);
-  }
-  return Res;
-}
-
 // Inner process. May crash if the target crashes.
 void Fuzzer::CrashResistantMergeInternalStep(const std::string &CFPath) {
   Printf("MERGE-INNER: using the control file '%s'\n", CFPath.c_str());
@@ -278,9 +249,7 @@ static void WriteNewControlFile(const st
 Vector<std::string>
 CrashResistantMerge(const Vector<std::string> &Args,
                     const Vector<std::string> &Corpora,
-                    const std::string &CFPath,
-                    const char *CoverageSummaryInputPathOrNull,
-                    const char *CoverageSummaryOutputPathOrNull) {
+                    const std::string &CFPath) {
   size_t NumAttempts = 0;
   if (FileSize(CFPath)) {
     Printf("MERGE-OUTER: non-empty control file provided: '%s'\n",
@@ -354,19 +323,7 @@ CrashResistantMerge(const Vector<std::st
   IF.close();
   Printf("MERGE-OUTER: consumed %zdMb (%zdMb rss) to parse the control file\n",
          M.ApproximateMemoryConsumption() >> 20, GetPeakRSSMb());
-  if (CoverageSummaryOutputPathOrNull) {
-    Printf("MERGE-OUTER: writing coverage summary for %zd files to %s\n",
-           M.Files.size(), CoverageSummaryOutputPathOrNull);
-    std::ofstream SummaryOut(CoverageSummaryOutputPathOrNull);
-    M.PrintSummary(SummaryOut);
-  }
   Set<uint32_t> InitialFeatures;
-  if (CoverageSummaryInputPathOrNull) {
-    std::ifstream SummaryIn(CoverageSummaryInputPathOrNull);
-    InitialFeatures = M.ParseSummary(SummaryIn);
-    Printf("MERGE-OUTER: coverage summary loaded from %s, %zd features found\n",
-           CoverageSummaryInputPathOrNull, InitialFeatures.size());
-  }
   Vector<std::string> NewFiles;
   size_t NumNewFeatures = M.Merge(InitialFeatures, &NewFiles);
   Printf("MERGE-OUTER: %zd new files with %zd new features added\n",

Modified: compiler-rt/trunk/lib/fuzzer/FuzzerMerge.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerMerge.h?rev=353573&r1=353572&r2=353573&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fuzzer/FuzzerMerge.h (original)
+++ compiler-rt/trunk/lib/fuzzer/FuzzerMerge.h Fri Feb  8 14:02:37 2019
@@ -63,8 +63,6 @@ struct Merger {
   bool Parse(std::istream &IS, bool ParseCoverage);
   bool Parse(const std::string &Str, bool ParseCoverage);
   void ParseOrExit(std::istream &IS, bool ParseCoverage);
-  void PrintSummary(std::ostream &OS);
-  Set<uint32_t> ParseSummary(std::istream &IS);
   size_t Merge(const Set<uint32_t> &InitialFeatures,
                Vector<std::string> *NewFiles);
   size_t ApproximateMemoryConsumption() const;
@@ -74,9 +72,7 @@ struct Merger {
 Vector<std::string>
 CrashResistantMerge(const Vector<std::string> &Args,
                     const Vector<std::string> &Corpora,
-                    const std::string &CFPath,
-                    const char *CoverageSummaryInputPathOrNull,
-                    const char *CoverageSummaryOutputPathOrNull);
+                    const std::string &CFPath);
 
 }  // namespace fuzzer
 

Modified: compiler-rt/trunk/lib/fuzzer/tests/FuzzerUnittest.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/tests/FuzzerUnittest.cpp?rev=353573&r1=353572&r2=353573&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fuzzer/tests/FuzzerUnittest.cpp (original)
+++ compiler-rt/trunk/lib/fuzzer/tests/FuzzerUnittest.cpp Fri Feb  8 14:02:37 2019
@@ -645,10 +645,7 @@ static void Merge(const std::string &Inp
   Merger M;
   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);
 }
 

Modified: compiler-rt/trunk/test/fuzzer/merge-control-file.test
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/fuzzer/merge-control-file.test?rev=353573&r1=353572&r2=353573&view=diff
==============================================================================
--- compiler-rt/trunk/test/fuzzer/merge-control-file.test (original)
+++ compiler-rt/trunk/test/fuzzer/merge-control-file.test Fri Feb  8 14:02:37 2019
@@ -30,16 +30,6 @@ OK_0: MERGE-OUTER: 3 new files with {{.*
 
 RUN: rm -f %t/T1/*; cp %t/T0/* %t/T1
 RUN: echo 3 > %t/MCF; echo 0 >> %t/MCF; echo %t/T1/1 >> %t/MCF; echo %t/T1/2 >> %t/MCF; echo %t/T1/3 >> %t/MCF
-RUN: %run %t/T.exe -merge=1 %t/T1 %t/T2 -merge_control_file=%t/MCF -save_coverage_summary=%t/SUMMARY 2>&1 | FileCheck %s --check-prefix=SAVE_SUMMARY
-SAVE_SUMMARY: MERGE-OUTER: writing coverage summary for 3 files to {{.*}}/SUMMARY
-
-RUN: rm -f %t/T1/*; cp %t/T0/* %t/T1
-RUN: echo 3 > %t/MCF; echo 0 >> %t/MCF; echo %t/T1/1 >> %t/MCF; echo %t/T1/2 >> %t/MCF; echo %t/T1/3 >> %t/MCF
-RUN: %run %t/T.exe -merge=1 %t/T1 %t/T2 -merge_control_file=%t/MCF -load_coverage_summary=%t/SUMMARY 2>&1 | FileCheck %s --check-prefix=LOAD_SUMMARY
-LOAD_SUMMARY: MERGE-OUTER: coverage summary loaded from
-
-RUN: rm -f %t/T1/*; cp %t/T0/* %t/T1
-RUN: echo 3 > %t/MCF; echo 0 >> %t/MCF; echo %t/T1/1 >> %t/MCF; echo %t/T1/2 >> %t/MCF; echo %t/T1/3 >> %t/MCF
 RUN: echo STARTED 0 1 >> %t/MCF
 RUN: echo DONE 0 11 >> %t/MCF
 RUN: echo STARTED 1 2 >> %t/MCF

Removed: compiler-rt/trunk/test/fuzzer/merge-summary.test
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/fuzzer/merge-summary.test?rev=353572&view=auto
==============================================================================
--- compiler-rt/trunk/test/fuzzer/merge-summary.test (original)
+++ compiler-rt/trunk/test/fuzzer/merge-summary.test (removed)
@@ -1,17 +0,0 @@
-RUN: %cpp_compiler %S/FullCoverageSetTest.cpp -o %t-FullCoverageSetTest
-
-RUN: rm -rf %t/T1 %t/T2
-RUN: mkdir -p %t/T0 %t/T1 %t/T2
-RUN: echo ...Z.. > %t/T2/1
-RUN: echo ....E. > %t/T2/2
-RUN: echo .....R > %t/T2/3
-RUN: echo F..... > %t/T2/a
-RUN: echo .U.... > %t/T2/b
-RUN: echo ..Z... > %t/T2/c
-
-RUN: %run %t-FullCoverageSetTest -merge=1 %t/T1 %t/T2 -save_coverage_summary=%t/SUMMARY 2>&1 | FileCheck %s --check-prefix=SAVE_SUMMARY
-SAVE_SUMMARY: MERGE-OUTER: writing coverage summary for 6 files to {{.*}}SUMMARY
-RUN: rm %t/T1/*
-RUN: %run %t-FullCoverageSetTest -merge=1 %t/T1 %t/T2 -load_coverage_summary=%t/SUMMARY 2>&1 | FileCheck %s --check-prefix=LOAD_SUMMARY
-LOAD_SUMMARY: MERGE-OUTER: coverage summary loaded from {{.*}}SUMMAR
-LOAD_SUMMARY: MERGE-OUTER: 0 new files with 0 new features added




More information about the llvm-commits mailing list