1
0
mirror of https://github.com/golang/go synced 2024-11-18 08:04:40 -07:00

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/5443
Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
David Crawshaw 2015-02-20 11:05:36 -05:00
parent 48469a2c86
commit 2f9c9e552d

View File

@ -772,6 +772,10 @@ func (b *builder) test(p *Package) (buildAction, runAction, printAction *action,
recompileForTest(pmain, p, ptest, testDir)
}
if buildContext.GOOS == "darwin" && buildContext.GOARCH == "arm" {
t.NeedCgo = true
}
for _, cp := range pmain.imports {
if len(cp.coverVars) > 0 {
t.Cover = append(t.Cover, coverInfo{cp, cp.coverVars})
@ -1207,6 +1211,7 @@ type testFuncs struct {
NeedTest bool
ImportXtest bool
NeedXtest bool
NeedCgo bool
Cover []coverInfo
}
@ -1310,6 +1315,10 @@ import (
{{range $i, $p := .Cover}}
_cover{{$i}} {{$p.Package.ImportPath | printf "%q"}}
{{end}}
{{if .NeedCgo}}
_ "runtime/cgo"
{{end}}
)
var tests = []testing.InternalTest{