]> Cypherpunks repositories - gostls13.git/commit
[dev.fuzz] cmd/go/internal: instrument imports of the test
authorKatie Hockman <katie@golang.org>
Tue, 25 May 2021 15:10:25 +0000 (11:10 -0400)
committerKatie Hockman <katie@golang.org>
Thu, 27 May 2021 19:16:13 +0000 (19:16 +0000)
commit2fed6926a152d67b5d001d68899edc5e97d599f1
tree6d053fe54e4fe5cd6ae0644247f9c6c26b65f3da
parenta573cbfa6c84c108d79330d062c345dc8d38dbfd
[dev.fuzz] cmd/go/internal: instrument imports of the test

Previously, the packages that were imported by the
test were not instrumented for coverage. This meant
that a fuzz target in a stand-alone test file would
not be able to perform coverage-guided fuzzing.

The fix uses all of the imports, including those
from the test files, when determining which packages
to instrument. However, certain package should
be ignored when walking the import graph. Otherwise,
packages like internal/fuzz, and its imports, may be
instrumented, which could lead to false positives for
"interesting" corpus values.

There was an additional bug which needed to be fixed
in order for this to work. The bug was in the fact that
the GcFlags which held `-d=libfuzzer` were being
overwritten in some cases. The fix updates the way these
flags are set in order to prevent this behavior.

Change-Id: I21d336c29a33db1181bbae0fd23678d127fe52a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/321960
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/cmd/go/internal/load/flag.go
src/cmd/go/internal/load/pkg.go
src/cmd/go/internal/test/test.go