diff --git a/src/internal/cpu/cpu_arm64_test.go b/src/internal/cpu/cpu_arm64_test.go deleted file mode 100644 index f4c419a23f3..00000000000 --- a/src/internal/cpu/cpu_arm64_test.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cpu_test - -import ( - . "internal/cpu" - "runtime" - "testing" -) - -func TestARM64minimalFeatures(t *testing.T) { - switch runtime.GOOS { - case "linux", "android": - default: - t.Skipf("%s/arm64 is not supported", runtime.GOOS) - } - - if !ARM64.HasASIMD { - t.Fatalf("HasASIMD expected true, got false") - } - if !ARM64.HasFP { - t.Fatalf("HasFP expected true, got false") - } -} diff --git a/src/internal/cpu/cpu_ppc64x.go b/src/internal/cpu/cpu_ppc64x.go index f59bb9dc8d0..6bb83bb6671 100644 --- a/src/internal/cpu/cpu_ppc64x.go +++ b/src/internal/cpu/cpu_ppc64x.go @@ -40,6 +40,7 @@ func doinit() { {Name: "scv", Feature: &PPC64.HasSCV}, // These capabilities should always be enabled on ppc64 and ppc64le: + {Name: "power8", Feature: &PPC64.IsPOWER8, Required: true}, {Name: "vmx", Feature: &PPC64.HasVMX, Required: true}, {Name: "dfp", Feature: &PPC64.HasDFP, Required: true}, {Name: "vsx", Feature: &PPC64.HasVSX, Required: true}, diff --git a/src/internal/cpu/cpu_ppc64x_test.go b/src/internal/cpu/cpu_ppc64x_test.go deleted file mode 100644 index 9c43d1e8049..00000000000 --- a/src/internal/cpu/cpu_ppc64x_test.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build ppc64 ppc64le - -package cpu_test - -import ( - . "internal/cpu" - "testing" -) - -func TestPPC64minimalFeatures(t *testing.T) { - if !PPC64.IsPOWER8 { - t.Fatalf("IsPOWER8 expected true, got false") - } - if !PPC64.HasVMX { - t.Fatalf("HasVMX expected true, got false") - } - if !PPC64.HasDFP { - t.Fatalf("HasDFP expected true, got false") - } - if !PPC64.HasVSX { - t.Fatalf("HasVSX expected true, got false") - } - if !PPC64.HasISEL { - t.Fatalf("HasISEL expected true, got false") - } - if !PPC64.HasVCRYPTO { - t.Fatalf("HasVCRYPTO expected true, got false") - } -} diff --git a/src/internal/cpu/cpu_test.go b/src/internal/cpu/cpu_test.go index 46a351cfbc7..b01e212ce8b 100644 --- a/src/internal/cpu/cpu_test.go +++ b/src/internal/cpu/cpu_test.go @@ -9,10 +9,27 @@ import ( "internal/testenv" "os" "os/exec" + "runtime" "strings" "testing" ) +func TestMinimalFeatures(t *testing.T) { + if runtime.GOARCH == "arm64" { + switch runtime.GOOS { + case "linux", "android": + default: + t.Skipf("%s/%s is not supported", runtime.GOOS, runtime.GOARCH) + } + } + + for _, o := range Options { + if o.Required && !*o.Feature { + t.Errorf("%v expected true, got false", o.Name) + } + } +} + func MustHaveDebugOptionsSupport(t *testing.T) { if !DebugOptions { t.Skipf("skipping test: cpu feature options not supported by OS") diff --git a/src/internal/cpu/cpu_x86_test.go b/src/internal/cpu/cpu_x86_test.go index a8d0466e06f..a79be41811f 100644 --- a/src/internal/cpu/cpu_x86_test.go +++ b/src/internal/cpu/cpu_x86_test.go @@ -13,16 +13,6 @@ import ( "testing" ) -func TestAMD64minimalFeatures(t *testing.T) { - if runtime.GOARCH != "amd64" { - return - } - - if !X86.HasSSE2 { - t.Fatalf("HasSSE2 expected true, got false") - } -} - func TestX86ifAVX2hasAVX(t *testing.T) { if X86.HasAVX2 && !X86.HasAVX { t.Fatalf("HasAVX expected true when HasAVX2 is true, got false")