oss-fuzz
oss-fuzz copied to clipboard
`compile_native_go_fuzzer`: support _test suffixed packages
Go supports defining tests in package
and package_test
packages. (https://jdkaplan.dev/thinkin-logs/2021-10-07/). However, when using the latter form we end up with issues:
-: found packages mesh (mesh.go) and mesh_test (mesh_test.go_fuzz_.go) in /src/istio/pkg/config/mesh
cc @AdamKorcz
@AdamKorcz @DavidKorczynski friendly ping, thanks!
This will be fixed once Go fuzzing is fully integrated into Clusterfuzz.
The issue is not a blocker for running the fuzzers in OSS-Fuzz. Istio solved it by not placing tests in package_test
but just in package
, and their fuzzers are running fine.
I will see if I can find a temporary solution for this until Go fuzzing is fully integrated into Clusterfuzz. I haven't heard of any projects that have to have their tests in package_test
which IMO makes this a low-priority issue. If there are any such projects, feel free to leave a comment in this issue.
This will be fixed once Go fuzzing is fully integrated into Clusterfuzz.
@AdamKorcz do you know an issue in https://github.com/google/clusterfuzz to follow?
Similar issue - since we move out of the _test.go world, we cannot access things defined in other _test.go files.
example:
common_test.go:
type Foo struct {}
fuzz_test.go:
var x Foo
This compiles in normal go, but with compile_native_go_fuzzer we cannot access Foo.
The workaround is to move test only code into the main code, but that may have wider impacts