| # Regression test for https://go.dev/issue/47215 and https://go.dev/issue/50183: |
| # A mismatched $GOROOT_FINAL or missing $CC caused the C dependencies of the net |
| # package to appear stale, and it could not be rebuilt due to a missing $CC. |
| |
| [!cgo] skip |
| |
| # 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='' |
| 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 |
| go build -x runtime/cgo |
| ! stderr '[/\\]cgo'$GOEXE'["]? .* -importpath runtime/cgo' |