Commit 2f9c9e55 authored by David Crawshaw's avatar David Crawshaw

cmd/go: link cgo into tests on darwin/arm

We currently have only one supported darwin/arm device, a locked iOS
machine. It requires cgo binaries.

Change-Id: If36a152e6a743e4a58ea3470e62cccb742630a5d
Reviewed-on: https://go-review.googlesource.com/5443Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
parent 48469a2c
...@@ -772,6 +772,10 @@ func (b *builder) test(p *Package) (buildAction, runAction, printAction *action, ...@@ -772,6 +772,10 @@ func (b *builder) test(p *Package) (buildAction, runAction, printAction *action,
recompileForTest(pmain, p, ptest, testDir) recompileForTest(pmain, p, ptest, testDir)
} }
if buildContext.GOOS == "darwin" && buildContext.GOARCH == "arm" {
t.NeedCgo = true
}
for _, cp := range pmain.imports { for _, cp := range pmain.imports {
if len(cp.coverVars) > 0 { if len(cp.coverVars) > 0 {
t.Cover = append(t.Cover, coverInfo{cp, cp.coverVars}) t.Cover = append(t.Cover, coverInfo{cp, cp.coverVars})
...@@ -1207,6 +1211,7 @@ type testFuncs struct { ...@@ -1207,6 +1211,7 @@ type testFuncs struct {
NeedTest bool NeedTest bool
ImportXtest bool ImportXtest bool
NeedXtest bool NeedXtest bool
NeedCgo bool
Cover []coverInfo Cover []coverInfo
} }
...@@ -1310,6 +1315,10 @@ import ( ...@@ -1310,6 +1315,10 @@ import (
{{range $i, $p := .Cover}} {{range $i, $p := .Cover}}
_cover{{$i}} {{$p.Package.ImportPath | printf "%q"}} _cover{{$i}} {{$p.Package.ImportPath | printf "%q"}}
{{end}} {{end}}
{{if .NeedCgo}}
_ "runtime/cgo"
{{end}}
) )
var tests = []testing.InternalTest{ var tests = []testing.InternalTest{
......
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