mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
testing: use debug.SetTraceback("all") to show all goroutines at test timeout
Fixes #13681. Change-Id: I308930f4d9200fbe0f09cd08c38392ca1bb0db67 Reviewed-on: https://go-review.googlesource.com/18044 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
parent
bb0567b304
commit
57337da169
5 changed files with 12 additions and 7 deletions
|
|
@ -149,6 +149,7 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
"runtime/pprof"
|
||||
"runtime/trace"
|
||||
"strconv"
|
||||
|
|
@ -714,6 +715,7 @@ var timer *time.Timer
|
|||
func startAlarm() {
|
||||
if *timeout > 0 {
|
||||
timer = time.AfterFunc(*timeout, func() {
|
||||
debug.SetTraceback("all")
|
||||
panic(fmt.Sprintf("test timed out after %v", *timeout))
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue