...

Text file src/cmd/go/testdata/script/build_cache_pgo.txt

Documentation: cmd/go/testdata/script

     1[short] skip
     2
     3# Set up fresh GOCACHE.
     4env GOCACHE=$WORK/gocache
     5mkdir $GOCACHE
     6
     7# Building trivial non-main package should run preprofile the first time.
     8go build -x -pgo=default.pgo lib.go
     9stderr 'preprofile.*default\.pgo'
    10
    11# ... but not again ...
    12go build -x -pgo=default.pgo lib.go
    13! stderr 'preprofile.*default\.pgo'
    14
    15# ... unless we use -a.
    16go build -a -x -pgo=default.pgo lib.go
    17stderr '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.
    25go build -x -pgo=default.pgo lib2.go
    26! stderr 'preprofile.*default\.pgo'
    27stderr 'compile.*-pgoprofile=\S+gocache.*lib2.go'
    28
    29-- lib.go --
    30package lib
    31-- lib2.go --
    32package lib2
    33-- default.pgo --

View as plain text