diff options
author | Kostya Serebryany <kcc@google.com> | 2016-07-19 23:18:28 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2016-07-19 23:18:28 +0000 |
commit | 0ccf06f467df6d9e47b031fa3c75db1adc5b6290 (patch) | |
tree | 2b8ccc7027dcd1b808611bb6e1b5982d663c5524 /llvm/lib/Fuzzer | |
parent | a1fe17c9adb2b6093f1ce848a48fb8954c27c595 (diff) | |
download | bcm5719-llvm-0ccf06f467df6d9e47b031fa3c75db1adc5b6290.tar.gz bcm5719-llvm-0ccf06f467df6d9e47b031fa3c75db1adc5b6290.zip |
[libFuzzer] extend the messages printed by afl_driver
llvm-svn: 276052
Diffstat (limited to 'llvm/lib/Fuzzer')
-rw-r--r-- | llvm/lib/Fuzzer/afl/afl_driver.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/llvm/lib/Fuzzer/afl/afl_driver.cpp b/llvm/lib/Fuzzer/afl/afl_driver.cpp index 0f789981d74..fc9589552ba 100644 --- a/llvm/lib/Fuzzer/afl/afl_driver.cpp +++ b/llvm/lib/Fuzzer/afl/afl_driver.cpp @@ -239,11 +239,16 @@ static void maybe_duplicate_stderr() { } int main(int argc, char **argv) { - fprintf(stderr, "Running in AFl-fuzz mode\nUsage:\n" - "afl-fuzz [afl-flags] %s [N] " + fprintf(stderr, "======================= INFO =========================\n" + "This binary is built for AFL-fuzz.\n" + "To run the target function on a single input execute this:\n" + " %s < INPUT_FILE\n" + "To run the fuzzing execute this:\n" + " afl-fuzz [afl-flags] %s [N] " "-- run N fuzzing iterations before " - "re-spawning the process (default: 1000)\n", - argv[0]); + "re-spawning the process (default: 1000)\n" + "======================================================\n", + argv[0], argv[0]); if (LLVMFuzzerInitialize) LLVMFuzzerInitialize(&argc, &argv); // Do any other expensive one-time initialization here. @@ -258,6 +263,7 @@ int main(int argc, char **argv) { N = atoi(argv[1]); assert(N > 0); time_t unit_time_secs; + int num_runs = 0; while (__afl_persistent_loop(N)) { ssize_t n_read = read(0, AflInputBuf, kMaxAflInputSize); if (n_read > 0) { @@ -270,6 +276,7 @@ int main(int argc, char **argv) { CHECK_ERROR(gettimeofday(&unit_start_time, NULL) == 0, "Calling gettimeofday failed"); + num_runs++; LLVMFuzzerTestOneInput(copy, n_read); struct timeval unit_stop_time; @@ -284,4 +291,5 @@ int main(int argc, char **argv) { delete[] copy; } } + fprintf(stderr, "%s: successfully executed %d input(s)\n", argv[0], num_runs); } |