From: Michael Pratt Date: Thu, 18 Apr 2024 17:52:44 +0000 (-0400) Subject: cmd/go: only attempt to match subset of $GOCACHE in test X-Git-Tag: go1.23rc1~584 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=68c0ad3a689833344fada8acc1f36a06c343caa4;p=gostls13.git 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 Auto-Submit: Michael Pratt Reviewed-by: Cherry Mui TryBot-Bypass: Michael Pratt --- diff --git a/src/cmd/go/testdata/script/build_cache_pgo.txt b/src/cmd/go/testdata/script/build_cache_pgo.txt index 5efecab49e..cedae03cf8 100644 --- a/src/cmd/go/testdata/script/build_cache_pgo.txt +++ b/src/cmd/go/testdata/script/build_cache_pgo.txt @@ -16,10 +16,15 @@ go build -x -pgo=default.pgo lib.go 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