-test_single_input flag specifies a file name with test data.
Review URL: http://reviews.llvm.org/D13359
Patch by Mike Aizatsky!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249096
91177308-0d34-0410-b5e6-
96231b3b80d8
sync_timeout 600 Minimum timeout between syncs.
use_traces 0 Experimental: use instruction traces
only_ascii 0 If 1, generate only ASCII (isprint+isspace) inputs.
+ test_single_input "" Use specified file content as test input. Test will be run only once. Useful for debugging a particular case.
For the full list of flags run the fuzzer binary with ``-help=1``.
return 0;
}
+int RunOneTest(Fuzzer *F, const char *InputFilePath) {
+ Unit U = FileToVector(InputFilePath);
+ F->ExecuteCallback(U);
+ return 0;
+}
+
int FuzzerDriver(int argc, char **argv, UserCallback Callback) {
FuzzerRandomLibc Rand(0);
SimpleUserSuppliedFuzzer SUSF(&Rand, Callback);
if (Flags.apply_tokens)
return ApplyTokens(F, Flags.apply_tokens);
+ if (Flags.test_single_input)
+ return RunOneTest(&F, Flags.test_single_input);
+
unsigned Seed = Flags.seed;
// Initialize Seed.
if (Seed == 0)
"trace-based-mutations (tbm).")
FUZZER_FLAG_INT(tbm_width, 5, "Apply at most this number of independent"
"trace-based-mutations (tbm)")
+FUZZER_FLAG_STRING(test_single_input, "Use specified file as test input.")
\ No newline at end of file
static void StaticAlarmCallback();
Unit SubstituteTokens(const Unit &U) const;
+ void ExecuteCallback(const Unit &U);
private:
void AlarmCallback();
- void ExecuteCallback(const Unit &U);
void MutateAndTestOne(Unit *U);
void ReportNewCoverage(size_t NewCoverage, const Unit &U);
size_t RunOne(const Unit &U);
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-InfiniteTest -timeout=2 2>&1 | FileCheck %s --check-prefix=InfiniteTest
InfiniteTest: ALARM: working on the last Unit for
--- /dev/null
+Hi!
\ No newline at end of file