Skip to content

Commit e4c0f52

Browse files
committed
Fix fuzz-go to fuzz multiple funcs in single file
1 parent c6bc434 commit e4c0f52

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

.github/workflows/fuzz-go.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
inputs:
66
directory:
77
description: "Directory to search for Go fuzz tests in."
8-
default: '.'
8+
default: "."
99
required: false
1010
type: string
1111
fuzz-time:
@@ -33,15 +33,20 @@ jobs:
3333
RESULTS=()
3434
3535
for FILE in $TEST_FILES; do
36-
FUZZ_FUNC=$(grep -E 'func Fuzz\w*' $FILE | sed 's/func //' | sed 's/(.*$//')
37-
if [ -z "$FUZZ_FUNC" ]; then
36+
FUZZ_FUNCS=$(grep -E 'func Fuzz\w*' $FILE | sed 's/func //' | sed 's/(.*$//')
37+
if [ -z "$FUZZ_FUNCS" ]; then
3838
continue
3939
fi
4040
4141
PACKAGE_PATH=$(dirname ${FILE#${{ inputs.directory }}/})
42-
RESULTS+=("{\"package\":\"$PACKAGE_PATH\",\"function\":\"$FUZZ_FUNC\"}")
43-
44-
echo "Found $FUZZ_FUNC in $PACKAGE_PATH"
42+
for FUZZ_FUNC in $FUZZ_FUNCS; do
43+
if [ -z "$FUZZ_FUNC" ]; then
44+
continue
45+
fi
46+
47+
RESULTS+=("{\"package\":\"$PACKAGE_PATH\",\"function\":\"$FUZZ_FUNC\"}")
48+
echo "Found $FUZZ_FUNC in $PACKAGE_PATH"
49+
done
4550
done
4651
4752
NUM_RESULTS=${#RESULTS[@]}
@@ -74,8 +79,7 @@ jobs:
7479
cache: false
7580

7681
- name: Find cache location
77-
run:
78-
echo "FUZZ_CACHE=$(go env GOCACHE)/fuzz" >> $GITHUB_ENV
82+
run: echo "FUZZ_CACHE=$(go env GOCACHE)/fuzz" >> $GITHUB_ENV
7983

8084
- name: Restore fuzz cache
8185
uses: actions/cache@v4

0 commit comments

Comments
 (0)