aboutsummaryrefslogtreecommitdiff
path: root/src/os
diff options
context:
space:
mode:
authorAndrew G. Morgan <agm@google.com>2021-06-19 09:46:52 -0700
committerEmmanuel Odeke <emmanuel@orijtech.com>2021-06-20 11:17:27 +0000
commit460900a7b51f917888cb17608367979243178fe1 (patch)
tree59ec4aa81d76c284e62a8e38abe127b0300abb2b /src/os
parentb73cc4b02b3801603b3ce0bcc57cf01d6aa9a4dd (diff)
downloadgo-460900a7b51f917888cb17608367979243178fe1.tar.gz
go-460900a7b51f917888cb17608367979243178fe1.zip
os/signal: test with a significantly longer fatal timeout
We've observed some occasional os-arch specific timeouts in signal.TestSignalTrace(). While the main purpose of a short timeout is to ensure the passing tests complete quickly, the unexpected failure path can tolerate waiting longer (the test is not intended to test how slow or overloaded the OS is at the time it is run). Fixes #46736 Change-Id: Ib392fc6ce485a919612784ca88ed76c30f4898e2 Reviewed-on: https://go-review.googlesource.com/c/go/+/329502 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com> Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Diffstat (limited to 'src/os')
-rw-r--r--src/os/signal/signal_test.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/os/signal/signal_test.go b/src/os/signal/signal_test.go
index cea68742d2..649854b746 100644
--- a/src/os/signal/signal_test.go
+++ b/src/os/signal/signal_test.go
@@ -32,6 +32,11 @@ import (
// The current value is set based on flakes observed in the Go builders.
var settleTime = 100 * time.Millisecond
+// fatalWaitingTime is an absurdly long time to wait for signals to be
+// delivered but, using it, we (hopefully) eliminate test flakes on the
+// build servers. See #46736 for discussion.
+var fatalWaitingTime = 30 * time.Second
+
func init() {
if testenv.Builder() == "solaris-amd64-oraclerel" {
// The solaris-amd64-oraclerel builder has been observed to time out in
@@ -84,7 +89,7 @@ func waitSig1(t *testing.T, c <-chan os.Signal, sig os.Signal, all bool) {
// General user code should filter out all unexpected signals instead of just
// SIGURG, but since os/signal is tightly coupled to the runtime it seems
// appropriate to be stricter here.
- for time.Since(start) < settleTime {
+ for time.Since(start) < fatalWaitingTime {
select {
case s := <-c:
if s == sig {
@@ -97,7 +102,7 @@ func waitSig1(t *testing.T, c <-chan os.Signal, sig os.Signal, all bool) {
timer.Reset(settleTime / 10)
}
}
- t.Fatalf("timeout after %v waiting for %v", settleTime, sig)
+ t.Fatalf("timeout after %v waiting for %v", fatalWaitingTime, sig)
}
// quiesce waits until we can be reasonably confident that all pending signals