1
0
mirror of https://github.com/golang/go synced 2024-11-17 05:44:52 -07:00

cmd/compile/internal/amd64: more robust detection of GOAMD64=v1

Using build tool tags instead of relying on GOAMD64 env, which can be
overriden at make.bash time.

Change-Id: I96bb4b7416ea0bd1ab552feec9ede45b89a584c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/422614
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Cuong Manh Le 2022-08-10 22:13:23 +07:00
parent cc9584b54b
commit 515040548c

View File

@ -14,6 +14,7 @@ import (
"debug/macho" "debug/macho"
"errors" "errors"
"fmt" "fmt"
"go/build"
"internal/testenv" "internal/testenv"
"io" "io"
"math" "math"
@ -36,10 +37,10 @@ func TestGoAMD64v1(t *testing.T) {
if runtime.GOOS != "linux" && runtime.GOOS != "darwin" { if runtime.GOOS != "linux" && runtime.GOOS != "darwin" {
t.Skip("test only works on elf or macho platforms") t.Skip("test only works on elf or macho platforms")
} }
if v := os.Getenv("GOAMD64"); v != "" && v != "v1" { for _, tag := range build.Default.ToolTags {
// Test runs only on v1 (which is the default). if tag == "amd64.v2" {
// TODO: use build tags from #45454 instead. t.Skip("compiling for GOAMD64=v2 or higher")
t.Skip("GOAMD64 already set") }
} }
if os.Getenv("TESTGOAMD64V1") != "" { if os.Getenv("TESTGOAMD64V1") != "" {
t.Skip("recursive call") t.Skip("recursive call")