]> Cypherpunks repositories - gostls13.git/commitdiff
os/exec: set traceback to "system" in TestContextCancel
authorBryan C. Mills <bcmills@google.com>
Wed, 12 Oct 2022 15:15:45 +0000 (11:15 -0400)
committerGopher Robot <gobot@golang.org>
Thu, 13 Oct 2022 20:12:51 +0000 (20:12 +0000)
This will dump more goroutines if the test happens to fail.

For #50138.

Change-Id: Ifae30b5ba8bddcdaa9250dd90be8d8ba7d5604d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/442476
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>

src/os/exec/exec_test.go

index d79befa19a13fe10448ec57c5a7d2a746cb6bd7e..f38ce4e72c9a3362de3a37f81283b272f90bdedd 100644 (file)
@@ -27,6 +27,7 @@ import (
        "path/filepath"
        "reflect"
        "runtime"
+       "runtime/debug"
        "strconv"
        "strings"
        "sync"
@@ -988,6 +989,7 @@ func TestContextCancel(t *testing.T) {
                if time.Since(start) > time.Minute {
                        // Panic instead of calling t.Fatal so that we get a goroutine dump.
                        // We want to know exactly what the os/exec goroutines got stuck on.
+                       debug.SetTraceback("system")
                        panic("canceling context did not stop program")
                }