-
Notifications
You must be signed in to change notification settings - Fork 725
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dan Laine
authored
Nov 15, 2022
1 parent
91c5e26
commit 680bf89
Showing
5 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Mostly taken from https://github.com/golang/go/issues/46312#issuecomment-1153345129 | ||
|
||
fuzzTime=${1:-1} | ||
files=$(grep -r --include='**_test.go' --files-with-matches 'func Fuzz' .) | ||
failed=false | ||
for file in ${files} | ||
do | ||
funcs=$(grep -oP 'func \K(Fuzz\w*)' $file) | ||
for func in ${funcs} | ||
do | ||
echo "Fuzzing $func in $file" | ||
parentDir=$(dirname $file) | ||
go test $parentDir -run=$func -fuzz=$func -fuzztime=${fuzzTime}s | ||
# If any of the fuzz tests fail, return exit code 1 | ||
if [ $? -ne 0 ]; then | ||
failed=true | ||
fi | ||
done | ||
done | ||
|
||
if $failed; then | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters