Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: test -fullpath prevents test caching #64638

Open
stapelberg opened this issue Dec 10, 2023 · 4 comments
Open

cmd/go: test -fullpath prevents test caching #64638

stapelberg opened this issue Dec 10, 2023 · 4 comments
Labels
GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@stapelberg
Copy link
Contributor

Go version

go version go1.21.4 linux/amd64

What operating system and processor architecture are you using (go env)?

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/michael/.cache/go-build'
GOENV='/home/michael/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/michael/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/michael/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/michael/sdk/go1.21.4'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/michael/sdk/go1.21.4/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.4'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build292685049=/tmp/go-build -gno-record-gcc-switches'

What did you do?

When I run go test ./..., the cache kicks in as expected:

% time CGO_ENABLED=0 go test ./...     
ok  	formmailer/cmd/formmailer	(cached)
CGO_ENABLED=0 go test ./...  2,64s user 1,02s system 561% cpu 0,651 total

But adding the -fullpath flag prevents caching:

% time CGO_ENABLED=0 go test -fullpath ./...
ok  	formmailer/cmd/formmailer	0.947s
CGO_ENABLED=0 go test -fullpath ./...  7,18s user 1,66s system 592% cpu 1,492 total

% time CGO_ENABLED=0 go test -fullpath ./...
ok  	formmailer/cmd/formmailer	0.924s
CGO_ENABLED=0 go test -fullpath ./...  7,60s user 1,69s system 620% cpu 1,496 total

go help test speaks of a restricted set of 'cacheable' test flags, defined as -benchtime, -cpu, -list, -parallel, -run, -short, -timeout, -failfast, and -v.

It seems to me like we should add -fullpath to the list of cacheable test flags.

What did you expect to see?

Caching should work even when using -fullpath

What did you see instead?

Caching did not work.

@raghvenders
Copy link
Contributor

@stapelberg - seems right.

cc @bcmills - Is this proposal ?

@bcmills bcmills added NeedsFix The path to resolution is known, but the work has not been done. GoCommand cmd/go labels Dec 11, 2023
@bcmills bcmills added this to the Backlog milestone Dec 11, 2023
@bcmills
Copy link
Contributor

bcmills commented Dec 11, 2023

@raghvenders, this doesn't need a proposal — it's just a bug.

@raghvenders
Copy link
Contributor

@bcmills - I will work on this.

@gopherbot
Copy link

Change https://go.dev/cl/548996 mentions this issue: cmd/go: fix for making test flag -fullpath to run test (cached)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants