mirror of https://github.com/golang/go.git
cmd/go: run the real test binary if the test link was cached
Fixes #23150 Change-Id: Ia82c2d482a8dc53cabb3f173e4301fee66288821 Reviewed-on: https://go-review.googlesource.com/84376 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
ba1018b454
commit
4a28707d55
|
|
@ -5590,3 +5590,24 @@ func init() {}
|
|||
tg.run("build", "-o", tg.path("a.exe"), "a")
|
||||
tg.run("test", "a")
|
||||
}
|
||||
|
||||
// Issue 23150.
|
||||
func TestCpuprofileTwice(t *testing.T) {
|
||||
tg := testgo(t)
|
||||
defer tg.cleanup()
|
||||
tg.parallel()
|
||||
tg.tempFile("prof/src/x/x_test.go", `
|
||||
package x_test
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
func TestSleep(t *testing.T) { time.Sleep(10 * time.Millisecond) }`)
|
||||
tg.setenv("GOPATH", tg.path("prof"))
|
||||
bin := tg.path("x.test")
|
||||
out := tg.path("cpu.out")
|
||||
tg.run("test", "-o="+bin, "-cpuprofile="+out, "x")
|
||||
tg.must(os.Remove(out))
|
||||
tg.run("test", "-o="+bin, "-cpuprofile="+out, "x")
|
||||
tg.mustExist(out)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1321,7 +1321,7 @@ func (c *runCache) builderRunTest(b *work.Builder, a *work.Action) error {
|
|||
if !c.disableCache && len(execCmd) == 0 {
|
||||
testlogArg = []string{"-test.testlogfile=" + a.Objdir + "testlog.txt"}
|
||||
}
|
||||
args := str.StringList(execCmd, a.Deps[0].Target, testlogArg, testArgs)
|
||||
args := str.StringList(execCmd, a.Deps[0].BuiltTarget(), testlogArg, testArgs)
|
||||
|
||||
if testCoverProfile != "" {
|
||||
// Write coverage to temporary profile, for merging later.
|
||||
|
|
|
|||
|
|
@ -98,6 +98,10 @@ func (a *Action) BuildContentID() string { return contentID(a.buildID) }
|
|||
// BuildID returns a's build ID.
|
||||
func (a *Action) BuildID() string { return a.buildID }
|
||||
|
||||
// BuiltTarget returns the actual file that was built. This differs
|
||||
// from Target when the result was cached.
|
||||
func (a *Action) BuiltTarget() string { return a.built }
|
||||
|
||||
// An actionQueue is a priority queue of actions.
|
||||
type actionQueue []*Action
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue