github.com/primecitizens/pcz/std@v0.2.1/core/cpu/cpu_test.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 // 4 // Copyright 2017 The Go Authors. All rights reserved. 5 // Use of this source code is governed by a BSD-style 6 // license that can be found in the LICENSE file. 7 8 package cpu_test 9 10 import ( 11 "testing" 12 13 . "github.com/primecitizens/pcz/std/core/cpu" 14 ) 15 16 func MustHaveDebugOptionsSupport(t *testing.T) { 17 if !DebugOptions { 18 t.Skipf("skipping test: cpu feature options not supported by OS") 19 } 20 } 21 22 func MustSupportFeatureDetection(t *testing.T) { 23 // TODO: add platforms that do not have CPU feature detection support. 24 } 25 26 // func runDebugOptionsTest(t *testing.T, test string, options string) { 27 // MustHaveDebugOptionsSupport(t) 28 // 29 // testenv.MustHaveExec(t) 30 // 31 // env := "GODEBUG=" + options 32 // 33 // cmd := exec.Command(os.Args[0], "-test.run="+test) 34 // cmd.Env = append(cmd.Env, env) 35 // 36 // output, err := cmd.CombinedOutput() 37 // if err != nil { 38 // t.Fatalf("%s with %s: run failed: %v output:\n%s\n", 39 // test, env, err, string(output)) 40 // } 41 // } 42 // 43 // func TestDisableAllCapabilities(t *testing.T) { 44 // MustSupportFeatureDetection(t) 45 // runDebugOptionsTest(t, "TestAllCapabilitiesDisabled", "cpu.all=off") 46 // } 47 48 // func TestAllCapabilitiesDisabled(t *testing.T) { 49 // MustHaveDebugOptionsSupport(t) 50 // 51 // if godebug.Get("cpu.all") != "off" { 52 // t.Skipf("skipping test: GODEBUG=cpu.all=off not set") 53 // } 54 // 55 // // for _, o := range Options { 56 // // want := false 57 // // if got := *o.Feature; got != want { 58 // // t.Errorf("%v: expected %v, got %v", o.Name, want, got) 59 // // } 60 // // } 61 // }