runtime: print output in case of segfault in goroutine leak tests

For #76526.

Change-Id: I017e5d4c06e5de23cccc59c4c347599fecdece03
Reviewed-on: https://go-review.googlesource.com/c/go/+/726524
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
Michael Anthony Knyszek 2025-12-03 22:21:07 +00:00 committed by Gopher Robot
parent 9616c33295
commit 54e5540014

View File

@ -487,9 +487,9 @@ func TestGoroutineLeakProfile(t *testing.T) {
testCases = append(testCases, patternTestCases...)
// Test cases must not panic or cause fatal exceptions.
failStates := regexp.MustCompile(`fatal|panic|DATA RACE`)
failStates := regexp.MustCompile(`segmentation fault|fatal|panic|DATA RACE`)
testApp := func(exepath string, testCases []testCase) {
runTests := func(exepath string, testCases []testCase) {
// Build the test program once.
exe, err := buildTestProg(t, exepath)
@ -598,6 +598,6 @@ func TestGoroutineLeakProfile(t *testing.T) {
}
}
testApp("testgoroutineleakprofile", testCases)
testApp("testgoroutineleakprofile/goker", gokerTestCases)
runTests("testgoroutineleakprofile", testCases)
runTests("testgoroutineleakprofile/goker", gokerTestCases)
}