| 1 |
[short] skip |
| 2 |
|
| 3 |
# Set up fresh GOCACHE. |
| 4 |
env GOCACHE=$WORK/gocache |
| 5 |
mkdir $GOCACHE |
| 6 |
|
| 7 |
# Building trivial non-main package should run preprofile the first time. |
| 8 |
go build -x -pgo=default.pgo lib.go |
| 9 |
stderr 'preprofile.*default\.pgo' |
| 10 |
|
| 11 |
# ... but not again ... |
| 12 |
go build -x -pgo=default.pgo lib.go |
| 13 |
! stderr 'preprofile.*default\.pgo' |
| 14 |
|
| 15 |
# ... unless we use -a. |
| 16 |
go build -a -x -pgo=default.pgo lib.go |
| 17 |
stderr 'preprofile.*default\.pgo' |
| 18 |
|
| 19 |
# ... building a different package should not run preprofile again, instead |
| 20 |
# using a profile from cache. |
| 21 |
# |
| 22 |
# Note we can't directly look for $GOCACHE in the regex below because the |
| 23 |
# Windows slashes would need to be escaped. Instead just look for the "gocache" |
| 24 |
# component (specified above) as an approximation. |
| 25 |
go build -x -pgo=default.pgo lib2.go |
| 26 |
! stderr 'preprofile.*default\.pgo' |
| 27 |
stderr 'compile.*-pgoprofile=\S+gocache.*lib2.go' |
| 28 |
|
| 29 |
-- lib.go -- |
| 30 |
package lib |
| 31 |
-- lib2.go -- |
| 32 |
package lib2 |
| 33 |
-- default.pgo -- |