Commit 47070453 authored by Alberto Donizetti's avatar Alberto Donizetti Committed by Brad Fitzpatrick

[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: 's avatarIan Lance Taylor <iant@golang.org>
(cherry picked from commit 7d8bfdde)
Reviewed-on: https://go-review.googlesource.com/36125
parent 648bb344
......@@ -3744,6 +3744,13 @@ func TestMatchesOnlySubtestParallelIsOK(t *testing.T) {
tg.grepBoth(okPattern, "go test did not say ok")
}
// Issue 18845
func TestBenchTimeout(t *testing.T) {
tg := testgo(t)
defer tg.cleanup()
tg.run("test", "-bench", ".", "-timeout", "750ms", "testdata/timeoutbench_test.go")
}
func TestLinkXImportPathEscape(t *testing.T) {
// golang.org/issue/16710
tg := testgo(t)
......
package timeoutbench_test
import (
"testing"
"time"
)
func BenchmarkSleep1s(b *testing.B) {
time.Sleep(1 * time.Second)
}
......@@ -821,6 +821,7 @@ func (m *M) Run() int {
haveExamples = len(m.examples) > 0
testRan, testOk := runTests(m.deps.MatchString, m.tests)
exampleRan, exampleOk := runExamples(m.deps.MatchString, m.examples)
stopAlarm()
if !testRan && !exampleRan && *matchBenchmarks == "" {
fmt.Fprintln(os.Stderr, "testing: warning: no tests to run")
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment