diff options
author | Mark Pulford <mark@kyne.com.au> | 2020-02-14 08:34:31 +1100 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2020-03-01 14:57:24 +0000 |
commit | a908e09a34fff3c47efab69857d27bf6965b948a (patch) | |
tree | c165ab191543ca2a547191554460722674777334 /src/runtime/crash_cgo_test.go | |
parent | 1e9665da8fd8e2e095eb0e99a3b83118f600dc0b (diff) | |
download | go-a908e09a34fff3c47efab69857d27bf6965b948a.tar.gz go-a908e09a34fff3c47efab69857d27bf6965b948a.zip |
runtime: deflake CGO traceback tests
The CGO traceback function is called whenever CGO code is executing and
a signal is received. This occurs much more frequently now SIGURG
is used for preemption.
Disable signal preemption to significantly increase the likelihood that
a signal results in a profile sample during the test.
Updates #37201
Change-Id: Icb1a33ab0754d1a74882a4ee265b4026abe30bdc
Reviewed-on: https://go-review.googlesource.com/c/go/+/219417
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/crash_cgo_test.go')
-rw-r--r-- | src/runtime/crash_cgo_test.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/runtime/crash_cgo_test.go b/src/runtime/crash_cgo_test.go index 56cfb0856e..a09ecd8e42 100644 --- a/src/runtime/crash_cgo_test.go +++ b/src/runtime/crash_cgo_test.go @@ -275,7 +275,13 @@ func testCgoPprof(t *testing.T, buildArg, runArg, top, bottom string) { t.Fatal(err) } - got, err := testenv.CleanCmdEnv(exec.Command(exe, runArg)).CombinedOutput() + // pprofCgoTraceback is called whenever CGO code is executing and a signal + // is received. Disable signal preemption to increase the likelihood at + // least one SIGPROF signal fired to capture a sample. See issue #37201. + cmd := testenv.CleanCmdEnv(exec.Command(exe, runArg)) + cmd.Env = append(cmd.Env, "GODEBUG=asyncpreemptoff=1") + + got, err := cmd.CombinedOutput() if err != nil { if testenv.Builder() == "linux-amd64-alpine" { // See Issue 18243 and Issue 19938. |