aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cmd/go/testdata/script/cgo_stale_precompiled.txt19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/cmd/go/testdata/script/cgo_stale_precompiled.txt b/src/cmd/go/testdata/script/cgo_stale_precompiled.txt
index cda804070a..80ed751afc 100644
--- a/src/cmd/go/testdata/script/cgo_stale_precompiled.txt
+++ b/src/cmd/go/testdata/script/cgo_stale_precompiled.txt
@@ -4,14 +4,25 @@
[!cgo] skip
-# Control case: net must not already be stale.
-! stale net
+# This test may start with the runtime/cgo package already stale.
+# Explicitly rebuild it to ensure that it is cached.
+# (See https://go.dev/issue/50892.)
+#
+# If running in non-short mode, explicitly vary CGO_CFLAGS
+# as a control case (to ensure that our regexps do catch rebuilds).
+
+[!short] env GOCACHE=$WORK/cache
+[!short] env CGO_CFLAGS=-DTestScript_cgo_stale_precompiled=true
+go build -x runtime/cgo
+[!short] stderr '[/\\]cgo'$GOEXE'["]? .* -importpath runtime/cgo'
# https://go.dev/issue/47215: a missing $(go env CC) caused the precompiled net to be stale.
[!plan9] env PATH='' # Guaranteed not to include $(go env CC)!
[plan9] env path=''
-! stale net # issue #47215
+go build -x runtime/cgo
+! stderr '[/\\]cgo'$GOEXE'["]? .* -importpath runtime/cgo'
# https://go.dev/issue/50183: a mismatched GOROOT_FINAL caused net to be stale.
env GOROOT_FINAL=$WORK${/}goroot
-! stale net
+go build -x runtime/cgo
+! stderr '[/\\]cgo'$GOEXE'["]? .* -importpath runtime/cgo'