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

testing: -timeout affects benchmarks too (regression) #18845

Closed
evverx opened this issue Jan 29, 2017 · 3 comments

Comments

Projects
None yet
4 participants
@evverx
Copy link

commented Jan 29, 2017

This regression was introduced in ead08e9#diff-70e628298261565d825f7199d13042f2L758

package bench

import (
        "testing"
        "time"
)

func BenchmarkSleep10(b *testing.B) {
        time.Sleep(10 * time.Second)
}
go test -v -bench=. -timeout=1s
  • go version go1.7.5 linux/amd64
BenchmarkSleep10-2             1        10000282918 ns/op
PASS
  • go version devel +6bdb0c1 Sun Jan 29 00:49:56 2017 +0000 linux/amd64
panic: test timed out after 1s
@ALTree

This comment has been minimized.

Copy link
Member

commented Jan 29, 2017

Looks like stopAlarm() was removed by rsc between patch set 4 and 5, but in the CL discussion I see nothing that can explain why.

I've cooked up a quick patch and in theory just adding back a stopAlarm() call after runExamples() should fix the problem, but I'm not confident I'm not missing something.

@ALTree ALTree added the NeedsFix label Jan 29, 2017

@gopherbot

This comment has been minimized.

Copy link

commented Jan 29, 2017

CL https://golang.org/cl/35956 mentions this issue.

@gopherbot

This comment has been minimized.

Copy link

commented Feb 2, 2017

CL https://golang.org/cl/36125 mentions this issue.

gopherbot pushed a commit that referenced this issue Feb 2, 2017

[release-branch.go1.8] testing: stop timeout-timer after running tests
Fixes #18845

Fixes #18870 (Go 1.8 backport)

Change-Id: Icdc3e2067807781e42f2ffc94d1824aed94d3713
Reviewed-on: https://go-review.googlesource.com/35956
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
(cherry picked from commit 7d8bfdd)
Reviewed-on: https://go-review.googlesource.com/36125

@golang golang locked and limited conversation to collaborators Feb 2, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.