]> Cypherpunks repositories - gostls13.git/commit
cmd/go: fix objdir for run actions for -cover no-test packages
authorThan McIntosh <thanm@google.com>
Wed, 4 Oct 2023 13:29:48 +0000 (09:29 -0400)
committerThan McIntosh <thanm@google.com>
Wed, 4 Oct 2023 17:02:36 +0000 (17:02 +0000)
commite47cab13a5acfb99ed6e62eeb51772af94c5f526
tree6aa1cbe7e940109de006aaee7bcb60895fae159a
parent3a69dcdc9f487f79fdce82536c97b49ba7f216c7
cmd/go: fix objdir for run actions for -cover no-test packages

As of CL 495447 we now synthesize coverage data (including coverage
profiles) for packages that have no tests, if they are included in a
"go test -cover" run. The code that set up the "run" actions for such
tests wasn't setting the objdir for the action, which meant that the
coverage profile temp file fragment ("_cover_.out") was being created
in the dir where the test was run, and in addition the same fragment
could be written to by more than one package (which could lead to a
corrupted file). This CL updates the code to properly set the objdir,
and to create the dir when needed.

Updates #24570.
Fixes #63356.

Change-Id: Iffe131cf50f07ce91085b816a039308e0ca84776
Reviewed-on: https://go-review.googlesource.com/c/go/+/532555
Reviewed-by: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/cmd/go/internal/test/test.go
src/cmd/go/testdata/script/cover_coverprofile_multipkg.txt [new file with mode: 0644]