Skip to content

Commit

Permalink
runtime: set GODEBUG=asyncpreemptoff=1 in TestCrashDumpsAllThreads
Browse files Browse the repository at this point in the history
Fixes #35356

Change-Id: I67b9e57b88d00ed98cbc3aa0aeb26b5f2d75a3f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/205720
Run-TryBot: Ian Lance Taylor <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Brad Fitzpatrick <[email protected]>
Reviewed-by: Cherry Zhang <[email protected]>
  • Loading branch information
ianlancetaylor committed Nov 7, 2019
1 parent ee2268c commit 05aa4a7
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions src/runtime/crash_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"os/exec"
"path/filepath"
"runtime"
"strings"
"sync"
"syscall"
"testing"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 05aa4a7

Please sign in to comment.