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 (and thus still stale).
16
17 env GOCACHE=$WORK/cache # Use a fresh cache to avoid interference between runs.
18
19 go build -x .
20 stderr '[/\\]cgo'$GOEXE'["]? .* -importpath runtime/cgo'
21 stale runtime/cgo
22
23
24 # After runtime/cgo has been rebuilt and cached, it should not be rebuilt again
25 # even though it is still reported as stale.
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