Skip to content

Commit

Permalink
cmd/go: rewrite TestScript/cgo_stale_precompiled to be agnostic to st…
Browse files Browse the repository at this point in the history
…aleness

The configuration set by x/build/cmd/releasebot causes runtime/cgo to
be stale in the darwin/amd64 release (see golang#36025, golang#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 golang#50892
Fixes golang#50893
Updates golang#46347

Change-Id: Ib9ce6b5014de436264238f680f7ca4ae02c9a220
Reviewed-on: https://go-review.googlesource.com/c/go/+/381854
Trust: Bryan Mills <[email protected]>
Run-TryBot: Bryan Mills <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Russ Cox <[email protected]>
  • Loading branch information
Bryan C. Mills authored and rsc committed Jan 31, 2022
1 parent a5c0b19 commit 41f485b
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/cmd/go/testdata/script/cgo_stale_precompiled.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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'

0 comments on commit 41f485b

Please sign in to comment.