From: Ian Lance Taylor Date: Fri, 8 Nov 2019 23:28:51 +0000 (-0800) Subject: os/signal: use a larger channel buffer for all signals in TestSignal X-Git-Tag: go1.14beta1~285 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=bde1968e4c1d0d43d1d558a364eb427ef2143c42;p=gostls13.git os/signal: use a larger channel buffer for all signals in TestSignal Now that the runtime can send preemption signals, it is possible that a channel that asks for all signals can see both SIGURG and SIGHUP before reading either, in which case one of the signals will be dropped. We have to use a larger buffer so that the test see the signal it expects. Fixes #35466 Change-Id: I36271eae0661c421780c72292a5bcbd443ada987 Reviewed-on: https://go-review.googlesource.com/c/go/+/206257 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot Reviewed-by: Bryan C. Mills --- diff --git a/src/os/signal/signal_test.go b/src/os/signal/signal_test.go index 184068c377..d9305a4b86 100644 --- a/src/os/signal/signal_test.go +++ b/src/os/signal/signal_test.go @@ -81,8 +81,10 @@ func TestSignal(t *testing.T) { syscall.Kill(syscall.Getpid(), syscall.SIGHUP) waitSig(t, c, syscall.SIGHUP) - // Ask for everything we can get. - c1 := make(chan os.Signal, 1) + // Ask for everything we can get. The buffer size has to be + // more than 1, since the runtime might send SIGURG signals. + // Using 10 is arbitrary. + c1 := make(chan os.Signal, 10) Notify(c1) // Send this process a SIGWINCH