Commit 7aebb802db for golang
commit 7aebb802db1e361cb6808bdeb1071ec2baff2393
Author: Michael Matloob <matloob@golang.org>
Date: Tue Dec 1 10:56:43 2026 -0500
cmd/dist: skip the additional testdir test for js/wasip1 in compileonly
We already build cmd/internal/testdir as part of go build std cmd: we
skip the test when it actually runs. So this is redundant in compileonly
mode.
Change-Id: I0467a04fe77035c74c176966281131026a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/868721
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go
index ee8976f433..fc748ecfe8 100644
--- a/src/cmd/dist/test.go
+++ b/src/cmd/dist/test.go
@@ -1034,7 +1034,7 @@ func (t *tester) registerTests() {
t.registerCgoTests(cgoHeading)
}
- if goos == "wasip1" {
+ if !t.compileOnly && goos == "wasip1" {
t.registerTest("wasip1 host tests",
&goTest{
variant: "host",
@@ -1068,7 +1068,7 @@ func (t *tester) registerTests() {
// These tests will be skipped as part of the initial go test std cmd invocation for
// js and wasip1 and need to be run on the host. Register them specially here.
- if goos == "js" || goos == "wasip1" {
+ if !t.compileOnly && (goos == "js" || goos == "wasip1") {
t.registerTest("../test",
&goTest{
variant: "host",
@@ -1224,6 +1224,9 @@ func (rtSkipFunc) isRegisterTestOpt() {}
// heading and test.variant must be non-empty.
func (t *tester) registerTest(heading string, test *goTest, opts ...registerTestOpt) {
var skipFunc func(*distTest) (string, bool)
+ if test.runOnHost && t.compileOnly {
+ panic("test registered with runOnHost in compileOnly mode")
+ }
for _, opt := range opts {
switch opt := opt.(type) {
case rtSkipFunc: