]> Cypherpunks repositories - gostls13.git/commitdiff
internal/cpu: skip arm64 feature test on unsupported GOOS
authorMeng Zhuo <mengzhuo1203@gmail.com>
Sun, 8 Apr 2018 02:30:15 +0000 (10:30 +0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Sun, 8 Apr 2018 05:22:26 +0000 (05:22 +0000)
Fixes #24753

Change-Id: Ic6049da98b8eee41223df71ffafa71a894915bd7
Reviewed-on: https://go-review.googlesource.com/105455
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/internal/cpu/cpu_test.go

index 37ea39f31ee4b7cdfe23dd5f86be5c109ece3792..35d041bccbeaf2ca032e2f92ebe4a28cff69b4c2 100644 (file)
@@ -50,12 +50,21 @@ func TestPPC64minimalFeatures(t *testing.T) {
 }
 
 func TestARM64minimalFeatures(t *testing.T) {
-       if runtime.GOARCH == "arm64" {
-               if !cpu.ARM64.HasASIMD {
-                       t.Fatalf("HasASIMD expected true, got false")
-               }
-               if !cpu.ARM64.HasFP {
-                       t.Fatalf("HasFP expected true, got false")
-               }
+
+       if runtime.GOARCH != "arm64" {
+               return
+       }
+
+       switch runtime.GOOS {
+       case "linux", "android":
+       default:
+               t.Skipf("%s/arm64 is not supported", runtime.GOOS)
+       }
+
+       if !cpu.ARM64.HasASIMD {
+               t.Fatalf("HasASIMD expected true, got false")
+       }
+       if !cpu.ARM64.HasFP {
+               t.Fatalf("HasFP expected true, got false")
        }
 }