summaryrefslogtreecommitdiff
path: root/libgo/go/runtime/crash_unix_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/runtime/crash_unix_test.go')
-rw-r--r--libgo/go/runtime/crash_unix_test.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/libgo/go/runtime/crash_unix_test.go b/libgo/go/runtime/crash_unix_test.go
index b925d028aaf..5284a37b0f1 100644
--- a/libgo/go/runtime/crash_unix_test.go
+++ b/libgo/go/runtime/crash_unix_test.go
@@ -133,3 +133,33 @@ func loop(i int, c chan bool) {
}
}
`
+
+func TestSignalExitStatus(t *testing.T) {
+ testenv.MustHaveGoBuild(t)
+ switch runtime.GOOS {
+ case "netbsd":
+ t.Skip("skipping on NetBSD; see https://golang.org/issue/14063")
+ }
+ exe, err := buildTestProg(t, "testprog")
+ if err != nil {
+ t.Fatal(err)
+ }
+ err = testEnv(exec.Command(exe, "SignalExitStatus")).Run()
+ if err == nil {
+ t.Error("test program succeeded unexpectedly")
+ } else if ee, ok := err.(*exec.ExitError); !ok {
+ t.Errorf("error (%v) has type %T; expected exec.ExitError", err, err)
+ } else if ws, ok := ee.Sys().(syscall.WaitStatus); !ok {
+ t.Errorf("error.Sys (%v) has type %T; expected syscall.WaitStatus", ee.Sys(), ee.Sys())
+ } else if !ws.Signaled() || ws.Signal() != syscall.SIGTERM {
+ t.Errorf("got %v; expected SIGTERM", ee)
+ }
+}
+
+func TestSignalIgnoreSIGTRAP(t *testing.T) {
+ output := runTestProg(t, "testprognet", "SignalIgnoreSIGTRAP")
+ want := "OK\n"
+ if output != want {
+ t.Fatalf("want %s, got %s\n", want, output)
+ }
+}