Skip to content

Commit 41f485b

Browse files
Bryan C. Millsrsc
Bryan C. Mills
authored andcommitted
cmd/go: rewrite TestScript/cgo_stale_precompiled to be agnostic to staleness
The configuration set by x/build/cmd/releasebot causes runtime/cgo to be stale in the darwin/amd64 release (see #36025, #35459). That staleness is mostly benign because we can reasonably assume that users on macOS will either disable CGO entirely or have a C compiler installed to rebuild (and cache) the stale packages if needed. Fixes #50892 Fixes #50893 Updates #46347 Change-Id: Ib9ce6b5014de436264238f680f7ca4ae02c9a220 Reviewed-on: https://go-review.googlesource.com/c/go/+/381854 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
1 parent a5c0b19 commit 41f485b

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/cmd/go/testdata/script/cgo_stale_precompiled.txt

+15-4
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,25 @@
44

55
[!cgo] skip
66

7-
# Control case: net must not already be stale.
8-
! stale net
7+
# This test may start with the runtime/cgo package already stale.
8+
# Explicitly rebuild it to ensure that it is cached.
9+
# (See https://go.dev/issue/50892.)
10+
#
11+
# If running in non-short mode, explicitly vary CGO_CFLAGS
12+
# as a control case (to ensure that our regexps do catch rebuilds).
13+
14+
[!short] env GOCACHE=$WORK/cache
15+
[!short] env CGO_CFLAGS=-DTestScript_cgo_stale_precompiled=true
16+
go build -x runtime/cgo
17+
[!short] stderr '[/\\]cgo'$GOEXE'["]? .* -importpath runtime/cgo'
918

1019
# https://go.dev/issue/47215: a missing $(go env CC) caused the precompiled net to be stale.
1120
[!plan9] env PATH='' # Guaranteed not to include $(go env CC)!
1221
[plan9] env path=''
13-
! stale net # issue #47215
22+
go build -x runtime/cgo
23+
! stderr '[/\\]cgo'$GOEXE'["]? .* -importpath runtime/cgo'
1424

1525
# https://go.dev/issue/50183: a mismatched GOROOT_FINAL caused net to be stale.
1626
env GOROOT_FINAL=$WORK${/}goroot
17-
! stale net
27+
go build -x runtime/cgo
28+
! stderr '[/\\]cgo'$GOEXE'["]? .* -importpath runtime/cgo'

0 commit comments

Comments
 (0)