aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2019-06-25 09:17:28 -0400
committerBryan C. Mills <bcmills@google.com>2019-06-25 16:43:17 +0000
commit3f83c83bd681861802ac07ec285cef28fd5766cb (patch)
tree93a421e0f19400b9a5ffe9523b70d23a48ec6bd7
parent98e1bd2b79bb7da0743450d9e6c0b622ff1e681f (diff)
downloadgo-3f83c83bd681861802ac07ec285cef28fd5766cb.tar.gz
go-3f83c83bd681861802ac07ec285cef28fd5766cb.zip
cmd/go: ensure that runtime/cgo is not stale in TestExecBuildX
Fixes #29004 Change-Id: Ifc8330b47fbec6f902057cb9b6db44f2c0082056 Reviewed-on: https://go-review.googlesource.com/c/go/+/183838 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
-rw-r--r--src/cmd/go/go_test.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go
index 9d82ac7dc8..e07f97d068 100644
--- a/src/cmd/go/go_test.go
+++ b/src/cmd/go/go_test.go
@@ -5061,6 +5061,11 @@ func TestExecBuildX(t *testing.T) {
tg.tempDir("cache")
tg.setenv("GOCACHE", tg.path("cache"))
+ // Before building our test main.go, ensure that an up-to-date copy of
+ // runtime/cgo is present in the cache. If it isn't, the 'go build' step below
+ // will fail with "can't open import". See golang.org/issue/29004.
+ tg.run("build", "runtime/cgo")
+
tg.tempFile("main.go", `package main; import "C"; func main() { print("hello") }`)
src := tg.path("main.go")
obj := tg.path("main")