aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/testdata
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2016-05-17 18:16:47 -0700
committerIan Lance Taylor <iant@golang.org>2016-05-18 04:08:08 +0000
commit23a59ba17cbfeb5380845f309f88165b2e38930b (patch)
treebd3d670a5b6b8a9b551973aed7ea2cec82cf549c /src/runtime/testdata
parentac66bb343181bef154342638d45dcc2c695ded00 (diff)
downloadgo-23a59ba17cbfeb5380845f309f88165b2e38930b.tar.xz
runtime: deflake TestSignalExitStatus
The signal might get delivered to a different thread, and that thread might not run again before the currently running thread returns and exits. Sleep to give the other thread time to pick up the signal and crash. Not tested for all cases, but, optimistically: Fixes #14063. Change-Id: Iff58669ac6185ad91cce85e0e86f17497a3659fd Reviewed-on: https://go-review.googlesource.com/23203 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Diffstat (limited to 'src/runtime/testdata')
-rw-r--r--src/runtime/testdata/testprog/signal.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/runtime/testdata/testprog/signal.go b/src/runtime/testdata/testprog/signal.go
index 7926908828..2ccbada57b 100644
--- a/src/runtime/testdata/testprog/signal.go
+++ b/src/runtime/testdata/testprog/signal.go
@@ -6,7 +6,10 @@
package main
-import "syscall"
+import (
+ "syscall"
+ "time"
+)
func init() {
register("SignalExitStatus", SignalExitStatus)
@@ -14,4 +17,13 @@ func init() {
func SignalExitStatus() {
syscall.Kill(syscall.Getpid(), syscall.SIGTERM)
+
+ // Should die immediately, but we've seen flakiness on various
+ // systems (see issue 14063). It's possible that the signal is
+ // being delivered to a different thread and we are returning
+ // and exiting before that thread runs again. Give the program
+ // a little while to die to make sure we pick up the signal
+ // before we return and exit the program. The time here
+ // shouldn't matter--we'll never really sleep this long.
+ time.Sleep(time.Second)
}