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 -bench tries to use "DO NOT USE - link" as an executable #23150

Closed
mvdan opened this issue Dec 15, 2017 · 6 comments
Closed

cmd/go: test -bench tries to use "DO NOT USE - link" as an executable #23150

mvdan opened this issue Dec 15, 2017 · 6 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@mvdan
Copy link
Member

mvdan commented Dec 15, 2017

What version of Go are you using (go version)?

go version devel +9d5f8eaa8a Fri Dec 15 02:48:35 2017 +0000 linux/amd64

Does this issue reproduce with the latest release?

Does not happen with 1.9 as far as I can tell.

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/mvdan/go/cache"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/mvdan/go/land:/home/mvdan/go"
GORACE=""
GOROOT="/home/mvdan/tip"
GOTMPDIR=""
GOTOOLDIR="/home/mvdan/tip/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1" 
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build043115483=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I was getting cpu and memory profiles from a benchmark multiple times, to update the profiles after every change and optimization that I was doing.

I'll use the bytes package below to make it simple to reproduce the bug, but it happens with any package that has benchmarks as far as I can see.

What did you expect to see?

go test -bench=Foo -cpuprofile=cpu.out to work when invocated multiple times.

What did you see instead?

$ go test -bench=ReadString -cpuprofile=cpu.out
goos: linux
goarch: amd64
pkg: bytes
BenchmarkReadString-4             200000              7618 ns/op        4301.26 MB/s
PASS
ok      bytes   2.715s
$ go test -bench=ReadString -cpuprofile=cpu.out
exec: "DO NOT USE - link": executable file not found in $PATH
FAIL    bytes   0.000s

Note that this gets fixed if I do rm bytes.test. Perhaps this is related to the recent build and/or test caching changes. /cc @rsc

@mvdan
Copy link
Member Author

mvdan commented Dec 15, 2017

Note that it doesn't happen without -cpuprofile, which is likely why noone ran into this yet. It happens with -memprofile too.

@gopherbot
Copy link

Change https://golang.org/cl/84376 mentions this issue: cmd/go: run the real test binary if the test link was cached

@ernado
Copy link
Contributor

ernado commented Dec 25, 2017

@ianlancetaylor any updates on that issue?
Also, I think that flags from #23147 should be copied here

@ianlancetaylor
Copy link
Contributor

I sent a change that fixes this, https://golang.org/cl/84376. @rsc has not reviewed it yet, presumably because of the holidays.

I'm sorry, I'm not sure what you mean with the reference to the flags. If CL 84376 fixes the problem, then we are done. If not, there may be a separate issue.

@ernado
Copy link
Contributor

ernado commented Dec 26, 2017

Sorry, @ianlancetaylor, tags, not flags :)
Just trying to ensure that issue will not be lost before release.

@bradfitz bradfitz added NeedsFix The path to resolution is known, but the work has not been done. release-blocker labels Jan 9, 2018
@bradfitz bradfitz added this to the Go1.10 milestone Jan 9, 2018
@bradfitz
Copy link
Contributor

bradfitz commented Jan 9, 2018

Note just benchmarks. From my dup bug:

bradfitz@gdev:~/go/src/strings$ go version
go version devel +9044f01 Tue Jan 9 01:53:38 2018 +0000 linux/amd64
bradfitz@gdev:~/go/src/strings$ go clean -testcache
bradfitz@gdev:~/go/src/strings$ go test
PASS
ok      strings 0.374s
bradfitz@gdev:~/go/src/strings$ go test
PASS
ok      strings 0.383s
bradfitz@gdev:~/go/src/strings$ go test   -test.memprofile=prof2.mem
PASS
ok      strings 0.378s
bradfitz@gdev:~/go/src/strings$ go test   -test.memprofile=prof2.mem
exec: "DO NOT USE - link": executable file not found in $PATH
FAIL    strings 0.000s

@golang golang locked and limited conversation to collaborators Jan 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Projects
None yet
Development

No branches or pull requests

6 participants