1 # Regression test for https://go.dev/issue/47215 and https://go.dev/issue/50183:
2 # A missing $CC caused the C dependencies of the net
3 # package to appear stale, and it could not be rebuilt due to a missing $CC.
4
5 [!cgo] skip
6
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'
18
19 # https://go.dev/issue/47215: a missing $(go env CC) caused the precompiled net
20 # to be stale. But as of https://go.dev/cl/452457 the precompiled libraries are
21 # no longer installed anyway! Since we're requiring a C compiler in order to
22 # build and use cgo libraries in the standard library, we should make sure it
23 # matches what's in the cache.
24
25 [abscc] stop
26
27 env CGO_ENABLED=1
28 env CC=''
29 [!GOOS:plan9] env PATH='' # Guaranteed not to include $(go env CC)!
30 [GOOS:plan9] env path=''
31 ! go build -x runtime/cgo
32 stderr 'C compiler .* not found'
33
View as plain text