Commit 98f610fe authored by David Crawshaw's avatar David Crawshaw

misc/cgo/testcarchive: enable test on darwin/arm

Change-Id: I0d3f9841500e0a41f1c427244869bf3736a31e18
Reviewed-on: https://go-review.googlesource.com/9075Reviewed-by: default avatarHyang-Ah Hana Kim <hyangah@gmail.com>
parent 983a490e
...@@ -31,5 +31,6 @@ int main(void) { ...@@ -31,5 +31,6 @@ int main(void) {
CheckArgs(); CheckArgs();
fprintf(stderr, "PASS\n");
return 0; return 0;
} }
...@@ -7,7 +7,6 @@ package main ...@@ -7,7 +7,6 @@ package main
import ( import (
"fmt" "fmt"
"os" "os"
"reflect"
"syscall" "syscall"
"time" "time"
...@@ -47,9 +46,8 @@ func DidMainRun() bool { return ranMain } ...@@ -47,9 +46,8 @@ func DidMainRun() bool { return ranMain }
//export CheckArgs //export CheckArgs
func CheckArgs() { func CheckArgs() {
want := []string{"./testp", "arg1", "arg2"} if len(os.Args) != 3 || os.Args[1] != "arg1" || os.Args[2] != "arg2" {
if !reflect.DeepEqual(want, os.Args) { fmt.Printf("CheckArgs: want [_, arg1, arg2], got: %v\n", os.Args)
fmt.Printf("CheckArgs: want %v, got: %v\n", want, os.Args)
os.Exit(2) os.Exit(2)
} }
} }
...@@ -10,7 +10,7 @@ if [ "$(go env GOOS)" == "darwin" ]; then ...@@ -10,7 +10,7 @@ if [ "$(go env GOOS)" == "darwin" ]; then
ccargs="-Wl,-no_pie" ccargs="-Wl,-no_pie"
# For darwin/arm. # For darwin/arm.
# TODO(crawshaw): Can we do better? # TODO(crawshaw): Can we do better?
ccargs="$ccargs -framework CoreFoundation" ccargs="$ccargs -framework CoreFoundation -framework Foundation"
fi fi
# TODO(crawshaw): Consider a go env for exec script name. # TODO(crawshaw): Consider a go env for exec script name.
......
...@@ -352,6 +352,7 @@ func (t *tester) extLink() bool { ...@@ -352,6 +352,7 @@ func (t *tester) extLink() bool {
pair := t.gohostos + "-" + t.goarch pair := t.gohostos + "-" + t.goarch
switch pair { switch pair {
case "android-arm", case "android-arm",
"darwin-arm", "darwin-arm64",
"dragonfly-386", "dragonfly-amd64", "dragonfly-386", "dragonfly-amd64",
"freebsd-386", "freebsd-amd64", "freebsd-arm", "freebsd-386", "freebsd-amd64", "freebsd-arm",
"linux-386", "linux-amd64", "linux-arm", "linux-386", "linux-amd64", "linux-arm",
...@@ -378,9 +379,14 @@ func (t *tester) buildmode(mode string) bool { ...@@ -378,9 +379,14 @@ func (t *tester) buildmode(mode string) bool {
switch { switch {
case !t.extLink(): case !t.extLink():
return false return false
case t.goos == "darwin" && t.goarch == "amd64": case t.goos == "darwin":
// TODO(crawshaw): add darwin/arm{,64} switch t.goarch {
return true case "amd64", "arm":
// TODO(crawshaw): add darwin/arm64
return true
default:
return false
}
case t.goos == "linux" && (t.goarch == "amd64" || t.goarch == "386"): case t.goos == "linux" && (t.goarch == "amd64" || t.goarch == "386"):
return true return true
default: default:
......
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