]> Cypherpunks repositories - gostls13.git/commitdiff
misc/cgo/testcarchive: fix C include path for darwin/arm
authorCherry Zhang <cherryyz@google.com>
Wed, 27 Apr 2016 22:03:49 +0000 (18:03 -0400)
committerDavid Crawshaw <crawshaw@golang.org>
Fri, 29 Apr 2016 12:21:27 +0000 (12:21 +0000)
After CL 22461, c-archive build on darwin/arm is by default compiled
with -shared and installed in pkg/darwin_arm_shared.

Fix build (2nd time...)

Change-Id: Ia2bb09bb6e1ebc9bc74f7570dd80c81d05eaf744
Reviewed-on: https://go-review.googlesource.com/22534
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

misc/cgo/testcarchive/carchive_test.go

index 19c746d49a5e97ad920a1fc798fea364927aaa12..0f3432650a5e5285e9a2d353e64664232f0ae80b 100644 (file)
@@ -31,6 +31,7 @@ var gopathEnv []string
 var exeSuffix string
 
 var GOOS, GOARCH string
+var libgodir string
 
 func init() {
        bin = []string{"./testp"}
@@ -84,7 +85,11 @@ func init() {
                // TODO(crawshaw): can we do better?
                cc = append(cc, []string{"-framework", "CoreFoundation", "-framework", "Foundation"}...)
        }
-       cc = append(cc, "-I", filepath.Join("pkg", GOOS+"_"+GOARCH))
+       libgodir = GOOS + "_" + GOARCH
+       if GOOS == "darwin" && GOARCH == "arm" {
+               libgodir = GOOS + "_" + GOARCH + "_shared"
+       }
+       cc = append(cc, "-I", filepath.Join("pkg", libgodir))
 
        // Build an environment with GOPATH=$(pwd)
        env := os.Environ()
@@ -147,11 +152,7 @@ func TestInstall(t *testing.T) {
                t.Fatal(err)
        }
 
-       libgopath := filepath.Join("pkg", GOOS+"_"+GOARCH, "libgo.a")
-       if GOOS == "darwin" && GOARCH == "arm" {
-               libgopath = filepath.Join("pkg", GOOS+"_"+GOARCH+"_shared", "libgo.a")
-       }
-       compilemain(t, libgopath)
+       compilemain(t, filepath.Join("pkg", libgodir, "libgo.a"))
 
        binArgs := append(bin, "arg1", "arg2")
        if out, err := exec.Command(binArgs[0], binArgs[1:]...).CombinedOutput(); err != nil {