native go fuzzing: Restrict fuzzer lookup to `*.go` (#8238)

native go fuzzing: Restrict fuzzer lookup to *.go
Projects containing words starting with Fuzz in non-go
files break compile_native_go_fuzzer with the error:
sed: -e expression #1, char 15: unknown option to 's'

Signed-off-by: Paulo Gomes <pjbgf@linux.com>

Signed-off-by: Paulo Gomes <pjbgf@linux.com>
This commit is contained in:
Paulo Gomes 2022-08-17 04:03:34 +01:00 committed by GitHub
parent c113501247
commit 0b416da224
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -77,7 +77,7 @@ tags="-tags gofuzz"
abs_file_dir=$(go list $tags -f {{.Dir}} $path)
# TODO(adamkorcz): Get rid of "-r" flag here.
fuzzer_filename=$(grep -r -l -s "$function" "${abs_file_dir}")
fuzzer_filename=$(grep -r -l --include='*.go' -s "$function" "${abs_file_dir}")
# Test if file contains a line with "func $function" and "testing.F".
if [ $(grep -r "func $function" $fuzzer_filename | grep "testing.F" | wc -l) -eq 1 ]