mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-03 01:12:53 +00:00
[libFuzzer] add -abort_on_timeout option
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258631 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
88a19038a7
commit
d75ddafc2f
@ -61,6 +61,7 @@ The most important flags are::
|
||||
cross_over 1 If 1, cross over inputs.
|
||||
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.
|
||||
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.
|
||||
|
@ -268,6 +268,7 @@ int FuzzerDriver(const std::vector<std::string> &Args,
|
||||
Options.Verbosity = Flags.verbosity;
|
||||
Options.MaxLen = Flags.max_len;
|
||||
Options.UnitTimeoutSec = Flags.timeout;
|
||||
Options.AbortOnTimeout = Flags.abort_on_timeout;
|
||||
Options.MaxTotalTimeSec = Flags.max_total_time;
|
||||
Options.DoCrossOver = Flags.cross_over;
|
||||
Options.MutateDepth = Flags.mutate_depth;
|
||||
|
@ -29,6 +29,7 @@ FUZZER_FLAG_INT(
|
||||
timeout, 1200,
|
||||
"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(max_total_time, 0, "If positive, indicates the maximal total "
|
||||
"time in seconds to run the fuzzer.")
|
||||
FUZZER_FLAG_INT(help, 0, "Print help.")
|
||||
|
@ -174,6 +174,7 @@ public:
|
||||
int Verbosity = 1;
|
||||
int MaxLen = 0;
|
||||
int UnitTimeoutSec = 300;
|
||||
bool AbortOnTimeout = false;
|
||||
int MaxTotalTimeSec = 0;
|
||||
bool DoCrossOver = true;
|
||||
int MutateDepth = 5;
|
||||
|
@ -112,6 +112,8 @@ void Fuzzer::AlarmCallback() {
|
||||
if (__sanitizer_print_stack_trace)
|
||||
__sanitizer_print_stack_trace();
|
||||
Printf("SUMMARY: libFuzzer: timeout\n");
|
||||
if (Options.AbortOnTimeout)
|
||||
abort();
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
@ -11,3 +11,4 @@ RUN: not LLVMFuzzer-TimeoutTest -timeout=1 -test_single_input=%S/hi.txt 2>&1 | F
|
||||
SingleInputTimeoutTest: ALARM: working on the last Unit for
|
||||
SingleInputTimeoutTest-NOT: Test unit written to ./timeout-
|
||||
|
||||
RUN: not --crash LLVMFuzzer-TimeoutTest -timeout=1 -abort_on_timeout=1
|
||||
|
Loading…
Reference in New Issue
Block a user