diff options
author | Catena cyber <35799796+catenacyber@users.noreply.github.com> | 2021-03-09 15:07:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-09 06:07:33 -0800 |
commit | fb8b2e25bff2a7b8823de5d74202ba02c2ebe7f7 (patch) | |
tree | d3fa23b2e32e32e75d782a5dc76883cabc10e14d /infra | |
parent | 065393f3aabccb60fdb0a3c8e49197f26f2c8ece (diff) | |
download | oss-fuzz-fb8b2e25bff2a7b8823de5d74202ba02c2ebe7f7.tar.gz |
Golang coverage ok with package in $SRC (#5325)
Diffstat (limited to 'infra')
-rwxr-xr-x | infra/base-images/base-builder/compile_go_fuzzer | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/infra/base-images/base-builder/compile_go_fuzzer b/infra/base-images/base-builder/compile_go_fuzzer index e3442aa02..80f661a69 100755 --- a/infra/base-images/base-builder/compile_go_fuzzer +++ b/infra/base-images/base-builder/compile_go_fuzzer @@ -35,13 +35,15 @@ go list $tags $path || { go mod init $path && go mod tidy ;} if [[ $SANITIZER = *coverage* ]]; then fuzzed_package=`go list $tags -f '{{.Name}}' $path` + abspath=`go list $tags -f {{.Dir}} $path` + cd $abspath 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 sed -i -e 's/TestFuzzCorpus/Test'$function'Corpus/' ./"${function,,}"_test.go echo "#!/bin/sh" > $OUT/$fuzzer - echo "cd $path" >> $OUT/$fuzzer + echo "cd \$OUT/$abspath" >> $OUT/$fuzzer # The fuzzer may be in a subdirectory, but we want the coverage report for the whole repository fuzzed_repo=`echo $path | cut -d/ -f-3` echo "go test -run Test${function}Corpus -v $tags -coverpkg $fuzzed_repo/... -coverprofile \$1 " >> $OUT/$fuzzer |