diff options
author | Catena cyber <35799796+catenacyber@users.noreply.github.com> | 2020-11-21 16:11:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-21 07:11:43 -0800 |
commit | 2db56c41743333db03e811b6687dca05620210d5 (patch) | |
tree | fc2d2ba21d3f39915216ac9158238236922b071b /infra | |
parent | e534f4fecc7c0992b105a79123ec97bb55ae2396 (diff) | |
download | oss-fuzz-2db56c41743333db03e811b6687dca05620210d5.tar.gz |
Golang project uses compile_go_fuzzer script (#4685)
* Golang project uses compile_go_fuzzer script
* Kubernetes project uses compile_go_fuzzer script
* Adds golang to ci covergae builds
* fixup
* Golang coverage with go modules
cf coredns project
Diffstat (limited to 'infra')
-rwxr-xr-x | infra/base-images/base-builder/compile_go_fuzzer | 8 | ||||
-rwxr-xr-x | infra/ci/build.py | 2 | ||||
-rw-r--r-- | infra/ci/build_test.py | 4 |
3 files changed, 10 insertions, 4 deletions
diff --git a/infra/base-images/base-builder/compile_go_fuzzer b/infra/base-images/base-builder/compile_go_fuzzer index 5fc8b70f0..c6cc3dd8f 100755 --- a/infra/base-images/base-builder/compile_go_fuzzer +++ b/infra/base-images/base-builder/compile_go_fuzzer @@ -24,7 +24,13 @@ if [[ $# -eq 4 ]]; then fi if [[ $SANITIZER = *coverage* ]]; then - cd $GOPATH/src/$path + if [[ $GO111MODULE = on ]]; then + basemod=`echo $path | cut -d/ -f1-3` + cd $GOPATH/pkg/mod/`go list -m $basemod | sed 's/ /@/'` + cd ./`echo $path | cut -d/ -f4-` + else + cd $GOPATH/src/$path + fi 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 diff --git a/infra/ci/build.py b/infra/ci/build.py index 67a975873..a1a22836a 100755 --- a/infra/ci/build.py +++ b/infra/ci/build.py @@ -32,7 +32,7 @@ DEFAULT_ENGINES = ['afl', 'honggfuzz', 'libfuzzer'] DEFAULT_SANITIZERS = ['address', 'undefined'] # Languages from project.yaml that have code coverage support. -LANGUAGES_WITH_COVERAGE_SUPPORT = ['c', 'c++'] +LANGUAGES_WITH_COVERAGE_SUPPORT = ['c', 'c++', 'go'] def get_changed_files(): diff --git a/infra/ci/build_test.py b/infra/ci/build_test.py index ef2d3a804..59fa3cf5c 100644 --- a/infra/ci/build_test.py +++ b/infra/ci/build_test.py @@ -73,11 +73,11 @@ class TestShouldBuild(unittest.TestCase): self.assertTrue(build.should_build(project_yaml)) def test_go_coverage_build(self): - """Tests that should_build returns False for coverage build of a project + """Tests that should_build returns True for coverage build of a project specifying 'libfuzzer' and for fuzzing_engines.""" _set_coverage_build() project_yaml = {'language': 'go'} - self.assertFalse(build.should_build(project_yaml)) + self.assertTrue(build.should_build(project_yaml)) def test_engine_project_none_build(self): """Tests that should_build returns False for an engine: 'none' build when |