aboutsummaryrefslogtreecommitdiff
path: root/infra
diff options
context:
space:
mode:
authorCatena cyber <35799796+catenacyber@users.noreply.github.com>2021-03-17 15:42:12 +0100
committerGitHub <noreply@github.com>2021-03-17 07:42:12 -0700
commit8b15e28751104472681e3c59dff3809d130a4cad (patch)
tree12fc045a0a3bc8cadb0f0a0db06fc461e857b278 /infra
parente71e49d721c201418128da6cd9f235f7ea7515fa (diff)
downloadoss-fuzz-8b15e28751104472681e3c59dff3809d130a4cad.tar.gz
Go coverage : use gofuzz tag by default (#5425)
as is done by gofuzz build
Diffstat (limited to 'infra')
-rwxr-xr-xinfra/base-images/base-builder/compile_go_fuzzer5
1 files changed, 3 insertions, 2 deletions
diff --git a/infra/base-images/base-builder/compile_go_fuzzer b/infra/base-images/base-builder/compile_go_fuzzer
index 787a42ae6..a8dafc473 100755
--- a/infra/base-images/base-builder/compile_go_fuzzer
+++ b/infra/base-images/base-builder/compile_go_fuzzer
@@ -18,7 +18,7 @@
path=$1
function=$2
fuzzer=$3
-tags=""
+tags="-tags gofuzz"
if [[ $# -eq 4 ]]; then
tags="-tags $4"
fi
@@ -43,8 +43,9 @@ if [[ $SANITIZER = *coverage* ]]; then
sed -i -e 's/TestFuzzCorpus/Test'$function'Corpus/' ./"${function,,}"_test.go
fuzzed_repo=`echo $path | cut -d/ -f-3`
+ abspath_repo=`go list -m $tags -f {{.Dir}} $fuzzed_repo || go list $tags -f {{.Dir}} $fuzzed_repo`
# give equivalence to absolute paths in another file, as go test -cover uses golangish pkg.Dir
- echo "s=$fuzzed_repo"=`go list $tags -f {{.Dir}} $fuzzed_repo`= > $OUT/$fuzzer.gocovpath
+ echo "s=$fuzzed_repo"="$abspath_repo$"= > $OUT/$fuzzer.gocovpath
go test -run Test${function}Corpus -v $tags -coverpkg $fuzzed_repo/... -c -o $OUT/$fuzzer $path
else
# Compile and instrument all Go files relevant to this fuzz target.