Skip to content

Commit 1eb3692

Browse files
committed
fuzz: add -q quiet argument for standalone fuzzers.
travis has a log length limit
1 parent c0ed29e commit 1eb3692

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

fuzz/fuzz-harness.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ extern int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size);
77
int main(int argc, char ** argv) {
88
int i;
99
buffer *input = buf_new(100000);
10+
int quiet = 0;
1011

1112
for (i = 1; i < argc; i++) {
1213
#if DEBUG_TRACE
@@ -15,6 +16,10 @@ int main(int argc, char ** argv) {
1516
TRACE(("debug printing on"))
1617
}
1718
#endif
19+
if (strcmp(argv[i], "-q") == 0) {
20+
printf("Running quiet\n");
21+
quiet = 1;
22+
}
1823
}
1924

2025
int old_fuzz_wrapfds = 0;
@@ -31,11 +36,17 @@ int main(int argc, char ** argv) {
3136

3237
/* Run twice to catch problems with statefulness */
3338
fuzz.wrapfds = old_fuzz_wrapfds;
34-
printf("Running %s once \n", fn);
39+
if (!quiet) {
40+
printf("Running %s once \n", fn);
41+
}
3542
LLVMFuzzerTestOneInput(input->data, input->len);
36-
printf("Running %s twice \n", fn);
43+
if (!quiet) {
44+
printf("Running %s twice \n", fn);
45+
}
3746
LLVMFuzzerTestOneInput(input->data, input->len);
38-
printf("Done %s\n", fn);
47+
if (!quiet) {
48+
printf("Done %s\n", fn);
49+
}
3950

4051
/* Disable wrapfd so it won't interfere with buf_readfile() above */
4152
old_fuzz_wrapfds = fuzz.wrapfds;

fuzzers_test.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ result=0
77
test -d fuzzcorpus && hg --repository fuzzcorpus/ pull || hg clone https://hg.ucc.asn.au/dropbear-fuzzcorpus fuzzcorpus || exit 1
88
for f in `make list-fuzz-targets`; do
99
# use xargs to split the too-long argument list
10-
echo fuzzcorpus/$f/* | xargs -n 1000 ./$f || result=1
10+
# -q quiet because travis has a logfile limit
11+
echo fuzzcorpus/$f/* | xargs -n 1000 ./$f -q || result=1
1112
done
1213

1314
exit $result

0 commit comments

Comments
 (0)