+++ /dev/null
-// 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")
- }
-}
{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},
+++ /dev/null
-// 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")
- }
-}
"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")
"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")