-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
What version of Go are you using (go version
)?
$ go version go version devel +b7a85e0003 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/usr/local/google/home/mpratt/.cache/go-build" GOENV="/usr/local/google/home/mpratt/.config/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/usr/local/google/home/mpratt/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/usr/local/google/home/mpratt/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/lib/google-golang" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/lib/google-golang/pkg/tool/linux_amd64" GOVCS="" GOVERSION="devel +b7a85e0003" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/usr/local/google/home/mpratt/src/scratch/go_bench/go.mod" 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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1003331103=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Run a benchmark many, many times. (The intention here is to run benchmarks for hours)
https://play.golang.org/p/tKSzmTOK_-m
go test -bench=. -count=10000000
What did you expect to see?
Benchmarks start running immediately.
What did you see instead?
Nothing seems to happen for ~30s before the benchmarks start running. The issue appears to be that runTests
runs its count loop 10000000 times, even though there are no tests to run.
One quick fix may be for runTests
to exit immediately if len(tests) == 0
, though I've distilled this issue down from my initial problem of a long time waiting for benchmarks to start in a package that has tests which I skip with -run=none
. It would be nice to fix that case too. For that, perhaps the first pass through runTests
records if it ran any tests. If not, the next iteration immediately breaks.