aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/testdata
diff options
context:
space:
mode:
authorCuong Manh Le <cuong.manhle.vn@gmail.com>2022-09-19 05:48:35 +0000
committerGopher Robot <gobot@golang.org>2022-09-19 13:56:07 +0000
commitfc1cddcfe916eff82b7c6a0e82765e9b9fe29980 (patch)
treeafc75e6ed97a32ac813329638709acea5e1d7141 /src/runtime/testdata
parent00bee6d9a4c3ed6168350fc6551043ff7a1895f2 (diff)
downloadgo-fc1cddcfe916eff82b7c6a0e82765e9b9fe29980.tar.xz
Revert "runtime: treat SI_TKILL like SI_USER on Linux"
This reverts CL 431255. Reason for revert: breaks darwin-arm and linux-noopt builders. Change-Id: I29332b935cc1e35fa039af3d70465e496361fcc9 Reviewed-on: https://go-review.googlesource.com/c/go/+/431715 Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/runtime/testdata')
-rw-r--r--src/runtime/testdata/testprogcgo/segv.go18
-rw-r--r--src/runtime/testdata/testprogcgo/segv_linux.go51
2 files changed, 10 insertions, 59 deletions
diff --git a/src/runtime/testdata/testprogcgo/segv.go b/src/runtime/testdata/testprogcgo/segv.go
index bf5aa313b3..0632475228 100644
--- a/src/runtime/testdata/testprogcgo/segv.go
+++ b/src/runtime/testdata/testprogcgo/segv.go
@@ -2,16 +2,18 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build unix
-// +build unix
+//go:build !plan9 && !windows
+// +build !plan9,!windows
package main
-// #include <unistd.h>
// static void nop() {}
import "C"
-import "syscall"
+import (
+ "syscall"
+ "time"
+)
func init() {
register("Segv", Segv)
@@ -33,8 +35,8 @@ func Segv() {
syscall.Kill(syscall.Getpid(), syscall.SIGSEGV)
- // Wait for the OS to deliver the signal.
- C.pause()
+ // Give the OS time to deliver the signal.
+ time.Sleep(time.Second)
}
func SegvInCgo() {
@@ -50,6 +52,6 @@ func SegvInCgo() {
syscall.Kill(syscall.Getpid(), syscall.SIGSEGV)
- // Wait for the OS to deliver the signal.
- C.pause()
+ // Give the OS time to deliver the signal.
+ time.Sleep(time.Second)
}
diff --git a/src/runtime/testdata/testprogcgo/segv_linux.go b/src/runtime/testdata/testprogcgo/segv_linux.go
deleted file mode 100644
index fe93778781..0000000000
--- a/src/runtime/testdata/testprogcgo/segv_linux.go
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2022 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package main
-
-// #include <unistd.h>
-// static void nop() {}
-import "C"
-
-import "syscall"
-
-func init() {
- register("TgkillSegv", TgkillSegv)
- register("TgkillSegvInCgo", TgkillSegvInCgo)
-}
-
-func TgkillSegv() {
- c := make(chan bool)
- go func() {
- close(c)
- for i := 0; ; i++ {
- // Sum defined in segv.go.
- Sum += i
- }
- }()
-
- <-c
-
- syscall.Tgkill(syscall.Getpid(), syscall.Gettid(), syscall.SIGSEGV)
-
- // Wait for the OS to deliver the signal.
- C.pause()
-}
-
-func TgkillSegvInCgo() {
- c := make(chan bool)
- go func() {
- close(c)
- for {
- C.nop()
- }
- }()
-
- <-c
-
- syscall.Tgkill(syscall.Getpid(), syscall.Gettid(), syscall.SIGSEGV)
-
- // Wait for the OS to deliver the signal.
- C.pause()
-}