Skip to content

Commit 68c0ad3

Browse files
prattmicgopherbot
authored andcommitted
cmd/go: only attempt to match subset of $GOCACHE in test
This test attempted to be clever by looking for the entirety of $GOCACHE in the compile command line to ensure that the profile was coming from cache. Unfortunately, on Windows $GOCACHE contains \, which needs extra escaping in a regexp. As an approximate alternative, just look for the "gocache" component specified when defining GOCACHE. This fixes the Windows longtest builders. Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest Change-Id: If6c77cf066d8612431e0720405254e1fdf528e9b Reviewed-on: https://go-review.googlesource.com/c/go/+/580137 Reviewed-by: Than McIntosh <[email protected]> Auto-Submit: Michael Pratt <[email protected]> Reviewed-by: Cherry Mui <[email protected]> TryBot-Bypass: Michael Pratt <[email protected]>
1 parent ad87d44 commit 68c0ad3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,15 @@ go build -x -pgo=default.pgo lib.go
1616
go build -a -x -pgo=default.pgo lib.go
1717
stderr 'preprofile.*default\.pgo'
1818

19-
# ... building a different package should not run preprofile again, instead using a profile from cache.
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.
2025
go build -x -pgo=default.pgo lib2.go
2126
! stderr 'preprofile.*default\.pgo'
22-
stderr 'compile.*-pgoprofile=.*'$GOCACHE'.*lib2.go'
27+
stderr 'compile.*-pgoprofile=\S+gocache.*lib2.go'
2328

2429
-- lib.go --
2530
package lib

0 commit comments

Comments
 (0)