From 0b416da2245bc6e85cc7e66f643fb6e78fdcae4d Mon Sep 17 00:00:00 2001 From: Paulo Gomes Date: Wed, 17 Aug 2022 04:03:34 +0100 Subject: [PATCH] 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 Signed-off-by: Paulo Gomes --- infra/base-images/base-builder/compile_native_go_fuzzer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infra/base-images/base-builder/compile_native_go_fuzzer b/infra/base-images/base-builder/compile_native_go_fuzzer index eee208f46..369a71579 100755 --- a/infra/base-images/base-builder/compile_native_go_fuzzer +++ b/infra/base-images/base-builder/compile_native_go_fuzzer @@ -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 ]