"os/exec"
"path/filepath"
"runtime"
- "strings"
"sync"
"syscall"
"testing"
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