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 <thanm@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Bypass: Michael Pratt <mpratt@google.com>
go build -a -x -pgo=default.pgo lib.go
stderr 'preprofile.*default\.pgo'
-# ... building a different package should not run preprofile again, instead using a profile from cache.
+# ... building a different package should not run preprofile again, instead
+# using a profile from cache.
+#
+# Note we can't directly look for $GOCACHE in the regex below because the
+# Windows slashes would need to be escaped. Instead just look for the "gocache"
+# component (specified above) as an approximation.
go build -x -pgo=default.pgo lib2.go
! stderr 'preprofile.*default\.pgo'
-stderr 'compile.*-pgoprofile=.*'$GOCACHE'.*lib2.go'
+stderr 'compile.*-pgoprofile=\S+gocache.*lib2.go'
-- lib.go --
package lib