1
0
mirror of https://github.com/golang/go synced 2024-11-06 22:36:15 -07:00

runtime: set GODEBUG=asyncpreemptoff=1 in TestCrashDumpsAllThreads

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>
This commit is contained in:
Ian Lance Taylor 2019-11-06 15:45:17 -08:00
parent ee2268c6bc
commit 05aa4a7b74

View 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