go/src/testing
Damien Neil 81a74b4e8d testing: provide additional information when test funcs panic
Flush the output log up to the root when a test panics. Prior to
this change, only the current test's output log was flushed to its
parent, resulting in no output when a subtest panics.

For the following test function:

	func Test(t *testing.T) {
		for i, test := range []int{1, 0, 2} {
			t.Run(fmt.Sprintf("%v/%v", i, test), func(t *testing.T) {
				_ = 1 / test
			})
		}
	}

Output before this change:

	panic: runtime error: integer divide by zero [recovered]
		panic: runtime error: integer divide by zero
	(stack trace follows)

Output after this change:

	--- FAIL: Test (0.00s)
	    --- FAIL: Test/1/0 (0.00s)
	panic: runtime error: integer divide by zero [recovered]
	(stack trace follows)

Fixes #32121

Change-Id: Ifee07ccc005f0493a902190a8be734943123b6b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/179599
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-30 20:46:44 +00:00
..
internal/testdeps testing/internal/testdeps: delete didSetLogger variable 2019-05-28 16:07:50 +00:00
iotest
quick all: shorten some tests 2019-05-22 12:54:00 +00:00
allocs.go
allocs_test.go
benchmark.go testing: stream log output in verbose mode 2019-10-22 19:21:02 +00:00
benchmark_test.go testing: shorten go test -short testing 2019-05-16 03:25:08 +00:00
cover.go testing/cover: improve message when a package has no statements 2019-03-13 04:11:58 +00:00
example.go testing: enable examples on js/wasm with non os.Pipe runExample 2019-03-11 18:59:53 +00:00
export_test.go testing: stop rounding b.N 2019-03-20 21:19:16 +00:00
helper_test.go testing: allow marking subtest and subbenchmark functions as Helpers 2018-05-14 17:59:59 +00:00
helperfuncs_test.go testing: allow marking subtest and subbenchmark functions as Helpers 2018-05-14 17:59:59 +00:00
match.go testing: fix typo mistake 2018-04-27 13:29:12 +00:00
match_test.go
panic_test.go testing: provide additional information when test funcs panic 2019-10-30 20:46:44 +00:00
run_example.go testing: enable examples on js/wasm with non os.Pipe runExample 2019-03-11 18:59:53 +00:00
run_example_js.go testing: enable examples on js/wasm with non os.Pipe runExample 2019-03-11 18:59:53 +00:00
sub_test.go testing: stream log output in verbose mode 2019-10-22 19:21:02 +00:00
testing.go testing: provide additional information when test funcs panic 2019-10-30 20:46:44 +00:00
testing_test.go