1 # golang.org/issue/46347: a stale runtime/cgo should only force a single rebuild
2
3 [!cgo] skip
4 [short] skip
5
6
7 # If we set a unique CGO_CFLAGS, the installed copy of runtime/cgo
8 # should be reported as stale.
9
10 env CGO_CFLAGS=-DTestScript_cgo_stale=true
11 stale runtime/cgo
12
13
14 # If we then build a package that uses cgo, runtime/cgo should be rebuilt and
15 # cached with the new flag, but not installed to GOROOT.
16 # It has no install target, and thus is never stale.
17
18 env GOCACHE=$WORK/cache # Use a fresh cache to avoid interference between runs.
19
20 go build -x .
21 stderr '[/\\]cgo'$GOEXE'["]? .* -importpath runtime/cgo'
22 ! stale runtime/cgo
23
24
25 # After runtime/cgo has been rebuilt and cached, it should not be rebuilt again.
26
27 go build -x .
28 ! stderr '[/\\]cgo'$GOEXE'["]? .* -importpath runtime/cgo'
29 ! stale runtime/cgo
30
31
32 -- go.mod --
33 module example.com/m
34
35 go 1.17
36 -- m.go --
37 package m
38
39 import "C"
40
View as plain text