From 15f2cbf43752cd69ba7b00a713f5db82fd535f1f Mon Sep 17 00:00:00 2001 From: Diogo Pinela Date: Sun, 22 Apr 2018 22:48:56 +0100 Subject: 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 TryBot-Result: Gobot Gobot Reviewed-by: Marcel van Lohuizen --- src/testing/helper_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/testing/helper_test.go') diff --git a/src/testing/helper_test.go b/src/testing/helper_test.go index f5cb27c317..fe8ff056ab 100644 --- a/src/testing/helper_test.go +++ b/src/testing/helper_test.go @@ -28,11 +28,11 @@ helperfuncs_test.go:33: 1 helperfuncs_test.go:21: 2 helperfuncs_test.go:35: 3 helperfuncs_test.go:42: 4 -helperfuncs_test.go:47: 5 --- FAIL: Test/sub (?s) -helperfuncs_test.go:50: 6 -helperfuncs_test.go:21: 7 -helperfuncs_test.go:53: 8 +helperfuncs_test.go:45: 5 +helperfuncs_test.go:21: 6 +helperfuncs_test.go:44: 7 +helperfuncs_test.go:56: 8 ` lines := strings.Split(buf.String(), "\n") durationRE := regexp.MustCompile(`\(.*\)$`) -- cgit v1.3-5-g9baa