]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go, internal/cpu: use internal/godebug in tests
authorBrad Fitzpatrick <bradfitz@golang.org>
Tue, 2 Nov 2021 03:25:48 +0000 (20:25 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 2 Nov 2021 06:19:33 +0000 (06:19 +0000)
Change-Id: Ifdf67e778e88ee70780428aa5479d2e091752a3a
Reviewed-on: https://go-review.googlesource.com/c/go/+/360605
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/go/go_test.go
src/internal/cpu/cpu_test.go
src/internal/cpu/cpu_x86_test.go

index c13d77a1afb5fb4b193d697a421399ce5a7e7dbd..d8bed1dac03c3924cbc7f1cd11ef89e663f5bcca 100644 (file)
@@ -13,6 +13,7 @@ import (
        "flag"
        "fmt"
        "go/format"
+       "internal/godebug"
        "internal/race"
        "internal/testenv"
        "io"
@@ -2281,7 +2282,7 @@ func TestUpxCompression(t *testing.T) {
 
 func TestCacheListStale(t *testing.T) {
        tooSlow(t)
-       if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") {
+       if godebug.Get("gocacheverify") == "1" {
                t.Skip("GODEBUG gocacheverify")
        }
        tg := testgo(t)
@@ -2304,7 +2305,7 @@ func TestCacheListStale(t *testing.T) {
 func TestCacheCoverage(t *testing.T) {
        tooSlow(t)
 
-       if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") {
+       if godebug.Get("gocacheverify") == "1" {
                t.Skip("GODEBUG gocacheverify")
        }
 
@@ -2336,7 +2337,7 @@ func TestIssue22588(t *testing.T) {
 
 func TestIssue22531(t *testing.T) {
        tooSlow(t)
-       if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") {
+       if godebug.Get("gocacheverify") == "1" {
                t.Skip("GODEBUG gocacheverify")
        }
        tg := testgo(t)
@@ -2365,7 +2366,7 @@ func TestIssue22531(t *testing.T) {
 
 func TestIssue22596(t *testing.T) {
        tooSlow(t)
-       if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") {
+       if godebug.Get("gocacheverify") == "1" {
                t.Skip("GODEBUG gocacheverify")
        }
        tg := testgo(t)
@@ -2395,7 +2396,7 @@ func TestIssue22596(t *testing.T) {
 func TestTestCache(t *testing.T) {
        tooSlow(t)
 
-       if strings.Contains(os.Getenv("GODEBUG"), "gocacheverify") {
+       if godebug.Get("gocacheverify") == "1" {
                t.Skip("GODEBUG gocacheverify")
        }
        tg := testgo(t)
index 06ad20800f9c6a3dd5efe539bc5a87cfeb619c02..8c21256b34825e4972c97814cc5740dee034f8b3 100644 (file)
@@ -6,6 +6,7 @@ package cpu_test
 
 import (
        . "internal/cpu"
+       "internal/godebug"
        "internal/testenv"
        "os"
        "os/exec"
@@ -52,7 +53,7 @@ func TestDisableAllCapabilities(t *testing.T) {
 func TestAllCapabilitiesDisabled(t *testing.T) {
        MustHaveDebugOptionsSupport(t)
 
-       if os.Getenv("GODEBUG") != "cpu.all=off" {
+       if godebug.Get("cpu.all") != "off" {
                t.Skipf("skipping test: GODEBUG=cpu.all=off not set")
        }
 
index 0fef065f2066975b0c2d6ad365dcbc5bdd544a52..c8be210055c6e2ad3c3ad3ece9e358e9f40626b2 100644 (file)
@@ -8,7 +8,7 @@ package cpu_test
 
 import (
        . "internal/cpu"
-       "os"
+       "internal/godebug"
        "testing"
 )
 
@@ -25,7 +25,7 @@ func TestDisableSSE3(t *testing.T) {
 func TestSSE3DebugOption(t *testing.T) {
        MustHaveDebugOptionsSupport(t)
 
-       if os.Getenv("GODEBUG") != "cpu.sse3=off" {
+       if godebug.Get("cpu.sse3") != "off" {
                t.Skipf("skipping test: GODEBUG=cpu.sse3=off not set")
        }