[llvm] r259265 - [libFuzzer] add -timeout_exitcode option
Kostya Serebryany via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 29 15:30:08 PST 2016
Author: kcc
Date: Fri Jan 29 17:30:07 2016
New Revision: 259265
URL: http://llvm.org/viewvc/llvm-project?rev=259265&view=rev
Log:
[libFuzzer] add -timeout_exitcode option
Modified:
llvm/trunk/docs/LibFuzzer.rst
llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp
llvm/trunk/lib/Fuzzer/FuzzerFlags.def
llvm/trunk/lib/Fuzzer/FuzzerInternal.h
llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp
llvm/trunk/lib/Fuzzer/test/fuzzer-timeout.test
Modified: llvm/trunk/docs/LibFuzzer.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LibFuzzer.rst?rev=259265&r1=259264&r2=259265&view=diff
==============================================================================
--- llvm/trunk/docs/LibFuzzer.rst (original)
+++ llvm/trunk/docs/LibFuzzer.rst Fri Jan 29 17:30:07 2016
@@ -62,6 +62,7 @@ The most important flags are::
mutate_depth 5 Apply this number of consecutive mutations to each input.
timeout 1200 Timeout in seconds (if positive). If one unit runs more than this number of seconds the process will abort.
abort_on_timeout 0 If positive, call abort on timeout.
+ timeout_exitcode 77 Unless abort_on_timeout is set, use this exitcode on timeout.
max_total_time 0 If positive, indicates the maximal total time in seconds to run the fuzzer.
help 0 Print help.
merge 0 If 1, the 2-nd, 3-rd, etc corpora will be merged into the 1-st corpus. Only interesting units will be taken.
Modified: llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp?rev=259265&r1=259264&r2=259265&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp Fri Jan 29 17:30:07 2016
@@ -269,6 +269,7 @@ int FuzzerDriver(const std::vector<std::
Options.MaxLen = Flags.max_len;
Options.UnitTimeoutSec = Flags.timeout;
Options.AbortOnTimeout = Flags.abort_on_timeout;
+ Options.TimeoutExitCode = Flags.timeout_exitcode;
Options.MaxTotalTimeSec = Flags.max_total_time;
Options.DoCrossOver = Flags.cross_over;
Options.MutateDepth = Flags.mutate_depth;
Modified: llvm/trunk/lib/Fuzzer/FuzzerFlags.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerFlags.def?rev=259265&r1=259264&r2=259265&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerFlags.def (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerFlags.def Fri Jan 29 17:30:07 2016
@@ -30,6 +30,8 @@ FUZZER_FLAG_INT(
"Timeout in seconds (if positive). "
"If one unit runs more than this number of seconds the process will abort.")
FUZZER_FLAG_INT(abort_on_timeout, 0, "If positive, call abort on timeout.")
+FUZZER_FLAG_INT(timeout_exitcode, 77,
+ "Unless abort_on_timeout is set, use this exitcode on timeout.")
FUZZER_FLAG_INT(max_total_time, 0, "If positive, indicates the maximal total "
"time in seconds to run the fuzzer.")
FUZZER_FLAG_INT(help, 0, "Print help.")
Modified: llvm/trunk/lib/Fuzzer/FuzzerInternal.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerInternal.h?rev=259265&r1=259264&r2=259265&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerInternal.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerInternal.h Fri Jan 29 17:30:07 2016
@@ -175,6 +175,7 @@ public:
int MaxLen = 0;
int UnitTimeoutSec = 300;
bool AbortOnTimeout = false;
+ int TimeoutExitCode = 77;
int MaxTotalTimeSec = 0;
bool DoCrossOver = true;
int MutateDepth = 5;
Modified: llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp?rev=259265&r1=259264&r2=259265&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp Fri Jan 29 17:30:07 2016
@@ -114,7 +114,7 @@ void Fuzzer::AlarmCallback() {
Printf("SUMMARY: libFuzzer: timeout\n");
if (Options.AbortOnTimeout)
abort();
- exit(1);
+ exit(Options.TimeoutExitCode);
}
}
Modified: llvm/trunk/lib/Fuzzer/test/fuzzer-timeout.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/fuzzer-timeout.test?rev=259265&r1=259264&r2=259265&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/fuzzer-timeout.test (original)
+++ llvm/trunk/lib/Fuzzer/test/fuzzer-timeout.test Fri Jan 29 17:30:07 2016
@@ -12,3 +12,4 @@ SingleInputTimeoutTest: ALARM: working o
SingleInputTimeoutTest-NOT: Test unit written to ./timeout-
RUN: ASAN_OPTIONS=handle_abort=0 not --crash LLVMFuzzer-TimeoutTest -timeout=1 -abort_on_timeout=1
+RUN: LLVMFuzzer-TimeoutTest -timeout=1 -timeout_exitcode=0
More information about the llvm-commits
mailing list