Skip to content

Commit 5d9e482

Browse files
author
Dan Laine
authored
allow user of build_fuzz.sh to specify a directory to fuzz in (#2414)
1 parent 2e32281 commit 5d9e482

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

scripts/build_fuzz.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/usr/bin/env bash
22

3+
# First argument is the time, in seconds, to run each fuzz test for.
4+
# If not provided, defaults to 1 second.
5+
#
6+
# Second argument is the directory to run fuzz tests in.
7+
# If not provided, defaults to the current directory.
8+
39
set -euo pipefail
410

511
# Mostly taken from https://github.com/golang/go/issues/46312#issuecomment-1153345129
@@ -10,7 +16,9 @@ AVALANCHE_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd )
1016
source "$AVALANCHE_PATH"/scripts/constants.sh
1117

1218
fuzzTime=${1:-1}
13-
files=$(grep -r --include='**_test.go' --files-with-matches 'func Fuzz' .)
19+
fuzzDir=${2:-.}
20+
21+
files=$(grep -r --include='**_test.go' --files-with-matches 'func Fuzz' $fuzzDir)
1422
failed=false
1523
for file in ${files}
1624
do

0 commit comments

Comments
 (0)