summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/afl/afl_driver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Fuzzer/afl/afl_driver.cpp')
-rw-r--r--llvm/lib/Fuzzer/afl/afl_driver.cpp16
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);
}
OpenPOWER on IntegriCloud