diff options
author | Ian Lance Taylor <iant@golang.org> | 2020-04-18 20:11:46 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2020-04-22 00:01:14 +0000 |
commit | e5bd6e1c7944713c816cf94ae412a700c271cfca (patch) | |
tree | 2fd972e8b6e0e72379e5a6adc626e034416efa9d /src/runtime/crash_cgo_test.go | |
parent | 5a75f7c0b0789fe04ea4879a524cc95dbe734636 (diff) | |
download | go-e5bd6e1c7944713c816cf94ae412a700c271cfca.tar.gz go-e5bd6e1c7944713c816cf94ae412a700c271cfca.zip |
runtime: crash on SI_USER SigPanic signal
Clean up the code a little bit to make it clearer:
Don't check throwsplit for a SI_USER signal.
If throwsplit is set for a SigPanic signal, always throw;
discard any other flags.
Fixes #36420
Change-Id: Ic9dcd1108603d241f71c040504dfdc6e528f9767
Reviewed-on: https://go-review.googlesource.com/c/go/+/228900
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/runtime/crash_cgo_test.go')
-rw-r--r-- | src/runtime/crash_cgo_test.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/runtime/crash_cgo_test.go b/src/runtime/crash_cgo_test.go index a09ecd8e42..a4d0ebfcd6 100644 --- a/src/runtime/crash_cgo_test.go +++ b/src/runtime/crash_cgo_test.go @@ -555,3 +555,21 @@ func findTrace(text, top string) []string { } return nil } + +func TestSegv(t *testing.T) { + switch runtime.GOOS { + case "plan9", "windows": + t.Skipf("no signals on %s", runtime.GOOS) + } + + for _, test := range []string{"Segv", "SegvInCgo"} { + t.Run(test, func(t *testing.T) { + t.Parallel() + got := runTestProg(t, "testprogcgo", test) + t.Log(got) + if !strings.Contains(got, "SIGSEGV") { + t.Errorf("expected crash from signal") + } + }) + } +} |