Index: lib/Fuzzer/FuzzerDriver.cpp =================================================================== --- lib/Fuzzer/FuzzerDriver.cpp +++ lib/Fuzzer/FuzzerDriver.cpp @@ -277,6 +277,7 @@ return 1; if (Flags.verbosity > 0 && !Options.Dictionary.empty()) Printf("Dictionary: %zd entries\n", Options.Dictionary.size()); + Options.WriteCrash = !Flags.test_single_input; Fuzzer F(USF, Options); Index: lib/Fuzzer/FuzzerInternal.h =================================================================== --- lib/Fuzzer/FuzzerInternal.h +++ lib/Fuzzer/FuzzerInternal.h @@ -93,6 +93,7 @@ std::string ArtifactPrefix = "./"; std::vector Tokens; std::vector Dictionary; + bool WriteCrash = true; }; Fuzzer(UserSuppliedFuzzer &USF, FuzzingOptions Options); void AddToCorpus(const Unit &U) { Corpus.push_back(U); } Index: lib/Fuzzer/FuzzerLoop.cpp =================================================================== --- lib/Fuzzer/FuzzerLoop.cpp +++ lib/Fuzzer/FuzzerLoop.cpp @@ -52,7 +52,8 @@ Print(CurrentUnit, "\n"); PrintUnitInASCIIOrTokens(CurrentUnit, "\n"); } - WriteUnitToFileWithPrefix(CurrentUnit, "crash-"); + if (Options.WriteCrash) + WriteUnitToFileWithPrefix(CurrentUnit, "crash-"); } void Fuzzer::StaticAlarmCallback() { Index: lib/Fuzzer/test/fuzzer.test =================================================================== --- lib/Fuzzer/test/fuzzer.test +++ lib/Fuzzer/test/fuzzer.test @@ -1,7 +1,8 @@ CHECK: BINGO RUN: LLVMFuzzer-SimpleTest 2>&1 | FileCheck %s -RUN: LLVMFuzzer-SimpleTest -test_single_input=%S/hi.txt 2>&1 | FileCheck %s +RUN: not LLVMFuzzer-NullDerefTest -test_single_input=%S/hi.txt 2>&1 | FileCheck %s --check-prefix=SingleInput +SingleInput-NOT: Test unit written to ./crash- RUN: not LLVMFuzzer-InfiniteTest -timeout=2 2>&1 | FileCheck %s --check-prefix=InfiniteTest InfiniteTest: ALARM: working on the last Unit for