summaryrefslogtreecommitdiff
path: root/libgo/go/cmd/go/testdata/script/build_cache_output.txt
blob: ee4099e5f356cb8eec818ddaf5c7496c6d19d9a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
[!gc] skip

# Set up fresh GOCACHE.
env GOCACHE=$WORK/gocache
mkdir $GOCACHE

# Building a trivial non-main package should run compiler the first time.
go build -x -gcflags=-m lib.go
stderr 'compile( |\.exe"?)'
stderr 'lib.go:2.* can inline f'

# ... but not the second, even though it still prints the compiler output.
go build -x -gcflags=-m lib.go
! stderr 'compile( |\.exe"?)'
stderr 'lib.go:2.* can inline f'

# Building a trivial main package should run the compiler and linker the first time.
go build -x -gcflags=-m -ldflags='-v -w' main.go
stderr 'compile( |\.exe"?)'
stderr 'main.go:2.* can inline main' # from compiler
stderr 'link(\.exe"?)? -'
stderr '\d+ symbols' # from linker

# ... but not the second, even though it still prints the compiler and linker output.
go build -x -gcflags=-m -ldflags='-v -w' main.go
! stderr 'compile( |\.exe"?)'
stderr 'main.go:2.* can inline main' # from compiler
! stderr 'link(\.exe"?)? -'
stderr '\d+ symbols' # from linker

# Running a test should run the compiler, linker, and the test the first time.
go test -v -x -gcflags=-m -ldflags=-v p_test.go
stderr 'compile( |\.exe"?)'
stderr 'p_test.go:.*can inline Test' # from compile of p_test
stderr 'testmain\.go:.*inlin' # from compile of testmain
stderr 'link(\.exe"?)? -'
stderr '\d+ symbols' # from linker
stderr 'p\.test( |\.exe"?)'
stdout 'TEST' # from test

# ... but not the second, even though it still prints the compiler, linker, and test output.
go test -v -x -gcflags=-m -ldflags=-v p_test.go
! stderr 'compile( |\.exe"?)'
stderr 'p_test.go:.*can inline Test' # from compile of p_test
stderr 'testmain\.go:.*inlin' # from compile of testmain
! stderr 'link(\.exe"?)? -'
stderr '\d+ symbols' # from linker
! stderr 'p\.test( |\.exe"?)'
stdout 'TEST' # from test


-- lib.go --
package p
func f(x *int) *int { return x }

-- main.go --
package main
func main() {}

-- p_test.go --
package p
import "testing"
func Test(t *testing.T) {println("TEST")}