diff options
| author | Russ Cox <rsc@golang.org> | 2024-05-15 16:06:23 -0400 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-05-21 19:41:02 +0000 |
| commit | 180ea45566d19e60aa2d660f6139b7f6e18ff56b (patch) | |
| tree | e14f155a336e4f5888334d2e0c8076ac8353f49a /src/testing/testing.go | |
| parent | 647870becc230b022b431a4ef8b7c9b31382db6c (diff) | |
| download | go-180ea45566d19e60aa2d660f6139b7f6e18ff56b.tar.xz | |
runtime/coverage: remove uses of //go:linkname
Move code to internal/coverage/cfile, making it possible to
access directly from testing/internal/testdeps, so that we can
avoid needing //go:linkname hacks.
For #67401.
Change-Id: I10b23a9970164afd2165e718ef3b2d9e86783883
Reviewed-on: https://go-review.googlesource.com/c/go/+/585820
Auto-Submit: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/testing/testing.go')
| -rw-r--r-- | src/testing/testing.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/testing/testing.go b/src/testing/testing.go index 60f0c23137..78ad8dbaac 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -1855,6 +1855,10 @@ func (f matchStringOnly) CheckCorpus([]any, []reflect.Type) error { return nil } func (f matchStringOnly) ResetCoverage() {} func (f matchStringOnly) SnapshotCoverage() {} +func (f matchStringOnly) InitRuntimeCoverage() (mode string, tearDown func(string, string) (string, error), snapcov func() float64) { + return +} + // Main is an internal function, part of the implementation of the "go test" command. // It was exported because it is cross-package and predates "internal" packages. // It is no longer used by "go test" but preserved, as much as possible, for other @@ -1902,12 +1906,14 @@ type testDeps interface { CheckCorpus([]any, []reflect.Type) error ResetCoverage() SnapshotCoverage() + InitRuntimeCoverage() (mode string, tearDown func(coverprofile string, gocoverdir string) (string, error), snapcov func() float64) } // MainStart is meant for use by tests generated by 'go test'. // It is not meant to be called directly and is not subject to the Go 1 compatibility document. // It may change signature from release to release. func MainStart(deps testDeps, tests []InternalTest, benchmarks []InternalBenchmark, fuzzTargets []InternalFuzzTarget, examples []InternalExample) *M { + registerCover2(deps.InitRuntimeCoverage()) Init() return &M{ deps: deps, |
