From af1f3b008281c61c54a5d203ffb69334b7af007c Mon Sep 17 00:00:00 2001 From: Cherry Zhang Date: Wed, 26 Feb 2020 10:24:39 -0500 Subject: [PATCH] cmd/dist: enable cgo and PIE tests on android/arm64 Now that android/arm64 supports internal linking PIE, enable the test. While here, I realized that some cgo tests are also not enabled on android/arm64. Enable them as well. Let's see if it works. Change-Id: Ibf186fe402ebf0bbec82873fd56d0eb752b48180 Reviewed-on: https://go-review.googlesource.com/c/go/+/221099 Run-TryBot: Cherry Zhang Reviewed-by: Elias Naur Reviewed-by: Ian Lance Taylor --- src/cmd/dist/test.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go index 1869fb5b2d..ca617e917e 100644 --- a/src/cmd/dist/test.go +++ b/src/cmd/dist/test.go @@ -894,7 +894,7 @@ func (t *tester) extLink() bool { pair := gohostos + "-" + goarch switch pair { case "aix-ppc64", - "android-arm", + "android-arm", "android-arm64", "darwin-386", "darwin-amd64", "darwin-arm", "darwin-arm64", "dragonfly-amd64", "freebsd-386", "freebsd-amd64", "freebsd-arm", @@ -937,7 +937,12 @@ func (t *tester) internalLink() bool { } func (t *tester) internalLinkPIE() bool { - return goos == "linux" && (goarch == "amd64" || goarch == "arm64") + switch goos + "-" + goarch { + case "linux-amd64", "linux-arm64", + "android-arm64": + return true + } + return false } func (t *tester) supportedBuildmode(mode string) bool { @@ -1066,7 +1071,7 @@ func (t *tester) cgoTest(dt *distTest) error { cmd = t.addCmd(dt, "misc/cgo/test", t.goTest(), "-ldflags", "-linkmode=external -s") case "aix-ppc64", - "android-arm", + "android-arm", "android-arm64", "dragonfly-amd64", "freebsd-386", "freebsd-amd64", "freebsd-arm", "linux-386", "linux-amd64", "linux-arm", "linux-ppc64le", "linux-s390x", @@ -1114,7 +1119,7 @@ func (t *tester) cgoTest(dt *distTest) error { if t.supportedBuildmode("pie") { t.addCmd(dt, "misc/cgo/test", t.goTest(), "-buildmode=pie") - if t.internalLinkPIE() { + if t.internalLink() && t.internalLinkPIE() { t.addCmd(dt, "misc/cgo/test", t.goTest(), "-buildmode=pie", "-ldflags=-linkmode=internal") } t.addCmd(dt, "misc/cgo/testtls", t.goTest(), "-buildmode=pie")