]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.21 cmd/go: attach PGO profile for test dependencies
authorCherry Mui <cherryyz@google.com>
Tue, 18 Jul 2023 20:23:27 +0000 (16:23 -0400)
committerCherry Mui <cherryyz@google.com>
Thu, 20 Jul 2023 20:44:54 +0000 (20:44 +0000)
commitc9f01f0ec7ce43a21bb7bbc65ec1a28a27187ce7
tree56a217046fba7bd4c7e5908d904effb8d69019c1
parent252f20b2c1f9d3675569cdf235de6716c9750a1a
[release-branch.go1.21 cmd/go: attach PGO profile for test dependencies

When running "go test" including a main package which has a PGO
profile, we currently build the package being tested and its
dependencies with PGO, but we failed to attach the profile to
test-only dependencies. If a package is (transitively) imported
by both the package being tested and the test, the PGO version
and the non-PGO version of the package are both linked into the
binary, causing link-time error.

This CL fixes this by attaching the PGO profile to dependencies of
the test.

Fixes #61376.

Change-Id: I2559db9843c4cdab596b31e2025d8475ffbf58ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/510835
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit af0609b080dd6d9101d8c6aa31ef6378ac70d60a)
Reviewed-on: https://go-review.googlesource.com/c/go/+/511698
src/cmd/go/internal/load/test.go
src/cmd/go/testdata/script/build_pgo_auto_multi.txt