]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: link cgo into tests on darwin/arm
authorDavid Crawshaw <crawshaw@golang.org>
Fri, 20 Feb 2015 16:05:36 +0000 (11:05 -0500)
committerDavid Crawshaw <crawshaw@golang.org>
Mon, 23 Feb 2015 17:17:49 +0000 (17:17 +0000)
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>
src/cmd/go/test.go

index a8110f385dad8fae1c50968661f96312ab3d3ee6..c44a2199dc2a34cdd4ffe5e8148eabad7838503d 100644 (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{