compile_go_fuzzer: pass build tags to `go list` (#5008)

`go list` will fail if all files in the fuzzed package use a build tag
restriction (like the common `gofuzz` tag).

Also, pass the `gofuzz` tag in the teleport build to plumb it through.
This commit is contained in:
Andrew Lytvynov 2021-01-20 19:44:15 +00:00 committed by GitHub
parent 9797a3447d
commit 687187f07e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -25,7 +25,7 @@ fi
if [[ $SANITIZER = *coverage* ]]; then
cd $GOPATH/src/$path
fuzzed_package=`go list -f '{{.Name}}'`
fuzzed_package=`go list $tags -f '{{.Name}}'`
cp $GOPATH/ossfuzz_coverage_runner.go ./"${function,,}"_test.go
sed -i -e 's/FuzzFunction/'$function'/' ./"${function,,}"_test.go
sed -i -e 's/mypackagebeingfuzzed/'$fuzzed_package'/' ./"${function,,}"_test.go

View File

@ -20,5 +20,5 @@ mkdir -p $GOPATH/src/github.com/gravitational
cd $GOPATH/src/github.com/gravitational
git clone https://github.com/gravitational/teleport.git
compile_go_fuzzer github.com/gravitational/teleport/lib/fuzz FuzzParseProxyJump utils_fuzz
compile_go_fuzzer github.com/gravitational/teleport/lib/fuzz FuzzNewExpression parse_fuzz
compile_go_fuzzer github.com/gravitational/teleport/lib/fuzz FuzzParseProxyJump utils_fuzz gofuzz
compile_go_fuzzer github.com/gravitational/teleport/lib/fuzz FuzzNewExpression parse_fuzz gofuzz