diff options
author | Catena cyber <35799796+catenacyber@users.noreply.github.com> | 2020-11-19 23:18:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-19 14:18:25 -0800 |
commit | 217175212ba1d484017c32fe6518f85c1aa1273f (patch) | |
tree | bf48c327c2cd39c6fd02f1469190c90b2f2ed5ec /projects/go-dns | |
parent | 772d0efef58adee26223efeac80a9c8c44de496a (diff) | |
download | oss-fuzz-217175212ba1d484017c32fe6518f85c1aa1273f.tar.gz |
[infra] Use generic compile_go_fuzzer for golang projects (#4659)
* Use generic compile_go_fuzzer for golang projects
* fix the copyright in the new script
Co-authored-by: Max Moroz <mmoroz@chromium.org>
Diffstat (limited to 'projects/go-dns')
-rwxr-xr-x | projects/go-dns/build.sh | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/projects/go-dns/build.sh b/projects/go-dns/build.sh index 873a291d6..d274ad9ac 100755 --- a/projects/go-dns/build.sh +++ b/projects/go-dns/build.sh @@ -15,34 +15,7 @@ # ################################################################################ -function compile_fuzzer { - path=$1 - function=$2 - fuzzer=$3 - - if [[ $SANITIZER = *coverage* ]]; then - cd $GOPATH/src/$path - fuzzed_package=`pwd | rev | cut -d'/' -f 1 | rev` - 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 "go test -run Test${function}Corpus -v -tags fuzz -coverprofile \$1 " >> $OUT/$fuzzer - chmod +x $OUT/$fuzzer - - cd - - return 0 - fi - # Compile and instrument all Go files relevant to this fuzz target. - go-fuzz -tags fuzz -func $function -o $fuzzer.a $path - - # Link Go code ($fuzzer.a) with fuzzing engine to produce fuzz target binary. - $CXX $CXXFLAGS $LIB_FUZZING_ENGINE $fuzzer.a -o $OUT/$fuzzer -} # Same as usual except for added -tags fuzz. -compile_fuzzer github.com/miekg/dns FuzzNewRR fuzz_newrr -compile_fuzzer github.com/miekg/dns Fuzz fuzz_msg_unpack +compile_go_fuzzer github.com/miekg/dns FuzzNewRR fuzz_newrr fuzz +compile_go_fuzzer github.com/miekg/dns Fuzz fuzz_msg_unpack fuzz |