diff options
author | Matt Johnston <matt@ucc.asn.au> | 2021-03-07 21:26:34 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2021-03-07 21:26:34 +0800 |
commit | 1eb369272bc8a23acc52bf11f81ff39b0d04f95b (patch) | |
tree | 41f24a5140fe458c6fa217d988038a9d0358295a | |
parent | c0ed29ea0290206d5f3f3a1c8ac5ac630f7f2f7c (diff) |
fuzz: add -q quiet argument for standalone fuzzers.
travis has a log length limit
-rw-r--r-- | fuzz/fuzz-harness.c | 17 | ||||
-rwxr-xr-x | fuzzers_test.sh | 3 |
2 files changed, 16 insertions, 4 deletions
diff --git a/fuzz/fuzz-harness.c b/fuzz/fuzz-harness.c index 331a88c..2c661d9 100644 --- a/fuzz/fuzz-harness.c +++ b/fuzz/fuzz-harness.c @@ -7,6 +7,7 @@ extern int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size); int main(int argc, char ** argv) { int i; buffer *input = buf_new(100000); + int quiet = 0; for (i = 1; i < argc; i++) { #if DEBUG_TRACE @@ -15,6 +16,10 @@ int main(int argc, char ** argv) { TRACE(("debug printing on")) } #endif + if (strcmp(argv[i], "-q") == 0) { + printf("Running quiet\n"); + quiet = 1; + } } int old_fuzz_wrapfds = 0; @@ -31,11 +36,17 @@ int main(int argc, char ** argv) { /* Run twice to catch problems with statefulness */ fuzz.wrapfds = old_fuzz_wrapfds; - printf("Running %s once \n", fn); + if (!quiet) { + printf("Running %s once \n", fn); + } LLVMFuzzerTestOneInput(input->data, input->len); - printf("Running %s twice \n", fn); + if (!quiet) { + printf("Running %s twice \n", fn); + } LLVMFuzzerTestOneInput(input->data, input->len); - printf("Done %s\n", fn); + if (!quiet) { + printf("Done %s\n", fn); + } /* Disable wrapfd so it won't interfere with buf_readfile() above */ old_fuzz_wrapfds = fuzz.wrapfds; diff --git a/fuzzers_test.sh b/fuzzers_test.sh index b27e0e2..a190acc 100755 --- a/fuzzers_test.sh +++ b/fuzzers_test.sh @@ -7,7 +7,8 @@ result=0 test -d fuzzcorpus && hg --repository fuzzcorpus/ pull || hg clone https://hg.ucc.asn.au/dropbear-fuzzcorpus fuzzcorpus || exit 1 for f in `make list-fuzz-targets`; do # use xargs to split the too-long argument list - echo fuzzcorpus/$f/* | xargs -n 1000 ./$f || result=1 + # -q quiet because travis has a logfile limit + echo fuzzcorpus/$f/* | xargs -n 1000 ./$f -q || result=1 done exit $result |