mirror of
https://github.com/golang/go
synced 2024-11-26 08:38:01 -07:00
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>
This commit is contained in:
parent
b73cc4b02b
commit
460900a7b5
@ -32,6 +32,11 @@ import (
|
|||||||
// The current value is set based on flakes observed in the Go builders.
|
// The current value is set based on flakes observed in the Go builders.
|
||||||
var settleTime = 100 * time.Millisecond
|
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() {
|
func init() {
|
||||||
if testenv.Builder() == "solaris-amd64-oraclerel" {
|
if testenv.Builder() == "solaris-amd64-oraclerel" {
|
||||||
// The solaris-amd64-oraclerel builder has been observed to time out in
|
// 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
|
// 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
|
// SIGURG, but since os/signal is tightly coupled to the runtime it seems
|
||||||
// appropriate to be stricter here.
|
// appropriate to be stricter here.
|
||||||
for time.Since(start) < settleTime {
|
for time.Since(start) < fatalWaitingTime {
|
||||||
select {
|
select {
|
||||||
case s := <-c:
|
case s := <-c:
|
||||||
if s == sig {
|
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)
|
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
|
// quiesce waits until we can be reasonably confident that all pending signals
|
||||||
|
Loading…
Reference in New Issue
Block a user