From 94e523cb522959f10b345bf27a32bf087c094108 Mon Sep 17 00:00:00 2001 From: Cherry Zhang Date: Wed, 27 Apr 2016 18:03:49 -0400 Subject: [PATCH] misc/cgo/testcarchive: fix C include path for darwin/arm 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 Reviewed-by: David Crawshaw Run-TryBot: David Crawshaw TryBot-Result: Gobot Gobot --- misc/cgo/testcarchive/carchive_test.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/misc/cgo/testcarchive/carchive_test.go b/misc/cgo/testcarchive/carchive_test.go index 19c746d49a..0f3432650a 100644 --- a/misc/cgo/testcarchive/carchive_test.go +++ b/misc/cgo/testcarchive/carchive_test.go @@ -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 { -- 2.48.1