]> Cypherpunks.ru repositories - gostls13.git/commit
testing: allow marking subtest and subbenchmark functions as Helpers
authorDiogo Pinela <diogoid7400@gmail.com>
Sun, 22 Apr 2018 21:48:56 +0000 (22:48 +0100)
committerIan Lance Taylor <iant@golang.org>
Mon, 14 May 2018 17:59:59 +0000 (17:59 +0000)
commit15f2cbf43752cd69ba7b00a713f5db82fd535f1f
tree3ebaceda9ff99542da2c8256ebb97b971617873f
parent05ca34093bc2d4a367743101ac2a17b697809e75
testing: allow marking subtest and subbenchmark functions as Helpers

Since subtests and subbenchmarks run in a separate goroutine, and thus
a separate stack, this entails capturing the stack trace at the point
tb.Run is called. The work of getting the file and line information from
this stack is only done when needed, however.

Continuing the search into the parent test also requires temporarily
holding its mutex. Since Run does not hold it while waiting for the
subtest to complete, there should be no risk of a deadlock due to this.

Fixes #24128

Change-Id: If0bb169f3ac96bd48794624e619ade7edb599f83
Reviewed-on: https://go-review.googlesource.com/108658
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
src/testing/benchmark.go
src/testing/helper_test.go
src/testing/helperfuncs_test.go
src/testing/testing.go