mirror of
https://github.com/golang/go
synced 2024-11-22 09:24:41 -07:00
testing: use runtime/debug to format panics
Sorry, Mercurial failed me. TBR=r, dsymonds CC=golang-dev https://golang.org/cl/5649080
This commit is contained in:
parent
f735d2d9d3
commit
8bcfad269e
@ -248,13 +248,11 @@ func tRunner(t *T, test *InternalTest) {
|
|||||||
// a call to runtime.Goexit, record the duration and send
|
// a call to runtime.Goexit, record the duration and send
|
||||||
// a signal saying that the test is done.
|
// a signal saying that the test is done.
|
||||||
defer func() {
|
defer func() {
|
||||||
if false {
|
|
||||||
// Log and recover from panic instead of aborting binary.
|
// Log and recover from panic instead of aborting binary.
|
||||||
if err := recover(); err != nil {
|
if err := recover(); err != nil {
|
||||||
t.failed = true
|
t.failed = true
|
||||||
t.Logf("%s\n%s", err, debug.Stack())
|
t.Logf("%s\n%s", err, debug.Stack())
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
t.duration = time.Now().Sub(t.start)
|
t.duration = time.Now().Sub(t.start)
|
||||||
t.signal <- t
|
t.signal <- t
|
||||||
|
Loading…
Reference in New Issue
Block a user