From: Ian Lance Taylor Date: Wed, 6 Nov 2019 23:45:17 +0000 (-0800) Subject: runtime: set GODEBUG=asyncpreemptoff=1 in TestCrashDumpsAllThreads X-Git-Tag: go1.14beta1~351 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=05aa4a7b7447051d187e0a86e53eee99fe065851;p=gostls13.git 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 TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick Reviewed-by: Cherry Zhang --- diff --git a/src/runtime/crash_unix_test.go b/src/runtime/crash_unix_test.go index 2944c9904c..234da6d52c 100644 --- a/src/runtime/crash_unix_test.go +++ b/src/runtime/crash_unix_test.go @@ -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