]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: check tgkill error in Debug tests
authorIan Lance Taylor <iant@golang.org>
Wed, 11 Jul 2018 04:07:55 +0000 (21:07 -0700)
committerIan Lance Taylor <iant@golang.org>
Fri, 13 Jul 2018 17:17:54 +0000 (17:17 +0000)
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: Austin Clements <austin@google.com>
src/runtime/debug_test.go
src/runtime/export_debug_test.go

index 4181d59c1f1673a66a3cdfca46ec1869e758fd24..a34f4c77f7cbedd4a95e0827c02a0ecea8f0844c 100644 (file)
@@ -69,8 +69,8 @@ func debugCallWorker2(stop *uint32, x *int) {
        *x = 1
 }
 
-func debugCallTKill(tid int) {
-       syscall.Tgkill(syscall.Getpid(), tid, syscall.SIGTRAP)
+func debugCallTKill(tid int) error {
+       return syscall.Tgkill(syscall.Getpid(), tid, syscall.SIGTRAP)
 }
 
 func TestDebugCall(t *testing.T) {
index 78436f36cf8c51e0af2935a532c15a68582cc70b..d34c1fd7dc58dc40ee86a259f49d90e6ea259d14 100644 (file)
@@ -20,7 +20,7 @@ import (
 //
 // On success, InjectDebugCall returns the panic value of fn or nil.
 // 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 {
                return nil, plainError("goroutine not locked to thread")
        }
@@ -54,7 +54,9 @@ func InjectDebugCall(gp *g, fn, args interface{}, tkill func(tid int)) (interfac
 
        defer func() { testSigtrap = nil }()
        testSigtrap = h.inject
-       tkill(tid)
+       if err := tkill(tid); err != nil {
+               return nil, err
+       }
        // Wait for completion.
        notetsleepg(&h.done, -1)
        if len(h.err) != 0 {