Commit ebdba42d authored by Ian Lance Taylor's avatar Ian Lance Taylor

runtime: check tgkill error in Debug tests

Updates #25519

Change-Id: Ibcdf948fd38d8d02d467b62213566ec0d7ce0d6a
Reviewed-on: https://go-review.googlesource.com/123180
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarAustin Clements <austin@google.com>
parent 5201b1ad
...@@ -69,8 +69,8 @@ func debugCallWorker2(stop *uint32, x *int) { ...@@ -69,8 +69,8 @@ func debugCallWorker2(stop *uint32, x *int) {
*x = 1 *x = 1
} }
func debugCallTKill(tid int) { func debugCallTKill(tid int) error {
syscall.Tgkill(syscall.Getpid(), tid, syscall.SIGTRAP) return syscall.Tgkill(syscall.Getpid(), tid, syscall.SIGTRAP)
} }
func TestDebugCall(t *testing.T) { func TestDebugCall(t *testing.T) {
......
...@@ -20,7 +20,7 @@ import ( ...@@ -20,7 +20,7 @@ import (
// //
// On success, InjectDebugCall returns the panic value of fn or nil. // On success, InjectDebugCall returns the panic value of fn or nil.
// If fn did not panic, its results will be available in args. // If fn did not panic, its results will be available in args.
func InjectDebugCall(gp *g, fn, args interface{}, tkill func(tid int)) (interface{}, error) { func InjectDebugCall(gp *g, fn, args interface{}, tkill func(tid int) error) (interface{}, error) {
if gp.lockedm == 0 { if gp.lockedm == 0 {
return nil, plainError("goroutine not locked to thread") return nil, plainError("goroutine not locked to thread")
} }
...@@ -54,7 +54,9 @@ func InjectDebugCall(gp *g, fn, args interface{}, tkill func(tid int)) (interfac ...@@ -54,7 +54,9 @@ func InjectDebugCall(gp *g, fn, args interface{}, tkill func(tid int)) (interfac
defer func() { testSigtrap = nil }() defer func() { testSigtrap = nil }()
testSigtrap = h.inject testSigtrap = h.inject
tkill(tid) if err := tkill(tid); err != nil {
return nil, err
}
// Wait for completion. // Wait for completion.
notetsleepg(&h.done, -1) notetsleepg(&h.done, -1)
if len(h.err) != 0 { if len(h.err) != 0 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment