aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorDmitri Shuralyov <dmitshur@golang.org>2026-03-24 12:29:02 -0400
committerGopher Robot <gobot@golang.org>2026-03-25 07:58:43 -0700
commit98aaa9b0ee54ba197432458a6f344c14aa12c106 (patch)
treefc9a962b5cb876d7932d46a0d8a4ae96ad385891 /src/cmd
parente3bda445164c764aa95c7df271dff2170fa1a7ce (diff)
downloadgo-98aaa9b0ee54ba197432458a6f344c14aa12c106.tar.xz
cmd/dist: add GO_TEST_ASMFLAGS to set -asmflags during dist test
If we run into a need for finer control over when -asmflags gets set, there can be an asmflags field added to goTest, analogously to the existing gcflags and ldflags fields. Start with a minimal change for what is currently needed, since not adding something we ourselves don't use makes it easier to avoid inadvertently ending up maintaining it because we can't be sure whether someone else started to depend on it. For #77427. Change-Id: I5e80874861cadf95fe770af6712b2c3f172c990a Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-spectre Reviewed-on: https://go-review.googlesource.com/c/go/+/758740 Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/dist/test.go15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go
index 78213a7a55..b09c3f2ce8 100644
--- a/src/cmd/dist/test.go
+++ b/src/cmd/dist/test.go
@@ -30,6 +30,8 @@ func cmdtest() {
var t tester
+ t.asmflags = os.Getenv("GO_TEST_ASMFLAGS")
+
var noRebuild bool
flag.BoolVar(&t.listMode, "list", false, "list available tests")
flag.BoolVar(&t.rebuild, "rebuild", false, "rebuild everything first")
@@ -63,6 +65,10 @@ type tester struct {
failed bool
keepGoing bool
compileOnly bool // just try to compile all tests, but no need to run
+ short bool
+ cgoEnabled bool
+ asmflags string
+ json bool
runRxStr string
runRx *regexp.Regexp
runRxWant bool // want runRx to match (true) or not match (false)
@@ -70,10 +76,6 @@ type tester struct {
banner string // prefix, or "" for none
lastHeading string // last dir heading printed
- short bool
- cgoEnabled bool
- json bool
-
tests []distTest // use addTest to extend
testNames map[string]bool
timeoutScale int
@@ -478,6 +480,9 @@ func (opts *goTest) buildArgs(t *tester) (build, run, pkgs, testFlags []string,
if opts.ldflags != "" {
build = append(build, "-ldflags="+opts.ldflags)
}
+ if t.asmflags != "" {
+ build = append(build, "-asmflags="+t.asmflags)
+ }
if opts.buildmode != "" {
build = append(build, "-buildmode="+opts.buildmode)
}
@@ -806,7 +811,7 @@ func (t *tester) registerTests() {
}
// Spectre mitigation smoke test.
- if goos == "linux" && goarch == "amd64" {
+ if goos == "linux" && goarch == "amd64" && !(gogcflags == "-spectre=all" && t.asmflags == "all=-spectre=all") {
// Pick a bunch of packages known to have some assembly.
pkgs := []string{"internal/runtime/...", "reflect", "crypto/..."}
if !t.short {