[llvm] r292319 - [libFuzzer] exit(1) on failed merge

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 17 16:55:29 PST 2017


Author: kcc
Date: Tue Jan 17 18:55:29 2017
New Revision: 292319

URL: http://llvm.org/viewvc/llvm-project?rev=292319&view=rev
Log:
[libFuzzer] exit(1) on failed merge

Modified:
    llvm/trunk/lib/Fuzzer/FuzzerMerge.cpp
    llvm/trunk/lib/Fuzzer/test/merge.test

Modified: llvm/trunk/lib/Fuzzer/FuzzerMerge.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerMerge.cpp?rev=292319&r1=292318&r2=292319&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerMerge.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerMerge.cpp Tue Jan 17 18:55:29 2017
@@ -239,15 +239,21 @@ void Fuzzer::CrashResistantMerge(const s
   // Execute the inner process untill it passes.
   // Every inner process should execute at least one input.
   std::string BaseCmd = CloneArgsWithoutX(Args, "keep-all-flags");
+  bool Success = false;
   for (size_t i = 1; i <= AllFiles.size(); i++) {
     Printf("MERGE-OUTER: attempt %zd\n", i);
     auto ExitCode =
         ExecuteCommand(BaseCmd + " -merge_control_file=" + CFPath);
     if (!ExitCode) {
       Printf("MERGE-OUTER: succesfull in %zd attempt(s)\n", i);
+      Success = true;
       break;
     }
   }
+  if (!Success) {
+    Printf("MERGE-OUTER: zero succesfull attempts, exiting\n");
+    exit(1);
+  }
   // Read the control file and do the merge.
   Merger M;
   std::ifstream IF(CFPath);

Modified: llvm/trunk/lib/Fuzzer/test/merge.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/merge.test?rev=292319&r1=292318&r2=292319&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/merge.test (original)
+++ llvm/trunk/lib/Fuzzer/test/merge.test Tue Jan 17 18:55:29 2017
@@ -52,3 +52,7 @@ TMPDIR: MERGE-OUTER: failed to write to
 # Check that we can report an error if file size exceeded
 RUN: (ulimit -f 1; not LLVMFuzzer-FullCoverageSetTest -merge=1 %tmp/T1 %tmp/T2 2>&1 | FileCheck %s --check-prefix=SIGXFSZ)
 SIGXFSZ: ERROR: libFuzzer: file size exceeded
+
+RUN: rm -rf  %tmp/T1/* %tmp/T2/*
+RUN: not LLVMFuzzer-FullCoverageSetTest -merge=1 %tmp/T1 %tmp/T2 2>&1 | FileCheck %s --check-prefix=EMPTY
+EMPTY: MERGE-OUTER: zero succesfull attempts, exiting




More information about the llvm-commits mailing list