]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: set GODEBUG=asyncpreemptoff=1 in TestCrashDumpsAllThreads
authorIan Lance Taylor <iant@golang.org>
Wed, 6 Nov 2019 23:45:17 +0000 (15:45 -0800)
committerIan Lance Taylor <iant@golang.org>
Thu, 7 Nov 2019 18:39:03 +0000 (18:39 +0000)
Fixes #35356

Change-Id: I67b9e57b88d00ed98cbc3aa0aeb26b5f2d75a3f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/205720
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/runtime/crash_unix_test.go

index 2944c9904c67600d2c2d6ea72ce4c82e61768ca8..234da6d52c71ddbea5d03755f97e26b71b1b9f60 100644 (file)
@@ -15,7 +15,6 @@ import (
        "os/exec"
        "path/filepath"
        "runtime"
-       "strings"
        "sync"
        "syscall"
        "testing"
@@ -99,18 +98,17 @@ func TestCrashDumpsAllThreads(t *testing.T) {
 
        cmd = exec.Command(filepath.Join(dir, "a.exe"))
        cmd = testenv.CleanCmdEnv(cmd)
-       cmd.Env = append(cmd.Env, "GOTRACEBACK=crash")
-
-       // Set GOGC=off. Because of golang.org/issue/10958, the tight
-       // loops in the test program are not preemptible. If GC kicks
-       // in, it may lock up and prevent main from saying it's ready.
-       newEnv := []string{}
-       for _, s := range cmd.Env {
-               if !strings.HasPrefix(s, "GOGC=") {
-                       newEnv = append(newEnv, s)
-               }
-       }
-       cmd.Env = append(newEnv, "GOGC=off")
+       cmd.Env = append(cmd.Env,
+               "GOTRACEBACK=crash",
+               // Set GOGC=off. Because of golang.org/issue/10958, the tight
+               // loops in the test program are not preemptible. If GC kicks
+               // in, it may lock up and prevent main from saying it's ready.
+               "GOGC=off",
+               // Set GODEBUG=asyncpreemptoff=1. If a thread is preempted
+               // when it receives SIGQUIT, it won't show the expected
+               // stack trace. See issue 35356.
+               "GODEBUG=asyncpreemptoff=1",
+       )
 
        var outbuf bytes.Buffer
        cmd.Stdout = &outbuf