Commit 1b873f5f authored by Russ Cox's avatar Russ Cox

cmd/go: declare runtime/cgo dependency for darwin/arm, darwin/arm64 tests

I don't know why these tests must import runtime/cgo
in _testmain.go, but if they must, they must also tell the
rest of the go command that they are doing so.

Should fix the newly-broken darwin/arm and darwin/arm64 builders.

Change-Id: I9b183f8c84c6f403bf3a90cbfc838d6ef428e16f
Reviewed-on: https://go-review.googlesource.com/67230
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
parent c56434f6
...@@ -885,10 +885,16 @@ func builderTest(b *work.Builder, p *load.Package) (buildAction, runAction, prin ...@@ -885,10 +885,16 @@ func builderTest(b *work.Builder, p *load.Package) (buildAction, runAction, prin
}, },
} }
// The generated main also imports testing, regexp, and os. // The generated main also imports testing, regexp, os, and maybe runtime/cgo.
stk.Push("testmain") stk.Push("testmain")
forceCgo := false
if cfg.BuildContext.GOOS == "darwin" {
if cfg.BuildContext.GOARCH == "arm" || cfg.BuildContext.GOARCH == "arm64" {
forceCgo = true
}
}
deps := testMainDeps deps := testMainDeps
if cfg.ExternalLinkingForced() { if cfg.ExternalLinkingForced() || forceCgo {
deps = str.StringList(deps, "runtime/cgo") deps = str.StringList(deps, "runtime/cgo")
} }
for _, dep := range deps { for _, dep := range deps {
...@@ -950,11 +956,7 @@ func builderTest(b *work.Builder, p *load.Package) (buildAction, runAction, prin ...@@ -950,11 +956,7 @@ func builderTest(b *work.Builder, p *load.Package) (buildAction, runAction, prin
recompileForTest(pmain, p, ptest, testDir) recompileForTest(pmain, p, ptest, testDir)
} }
if cfg.BuildContext.GOOS == "darwin" { t.NeedCgo = forceCgo
if cfg.BuildContext.GOARCH == "arm" || cfg.BuildContext.GOARCH == "arm64" {
t.NeedCgo = true
}
}
for _, cp := range pmain.Internal.Imports { for _, cp := range pmain.Internal.Imports {
if len(cp.Internal.CoverVars) > 0 { if len(cp.Internal.CoverVars) > 0 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment