From e3eaedb5cf623d0836533573db4140749da42768 Mon Sep 17 00:00:00 2001 From: Chaoqun Han Date: Tue, 23 Nov 2021 22:05:40 +0800 Subject: [PATCH] os/signal: reset SIGURG in TestSignal MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Accepting SIGURG signals could cause SIGURG to take up the entire channel buffer. Enhance the stability of test cases by: 1. Stop accepting the SIGURG signal by adding ‘Reset(sys call.SIGURG)’ 2. Close the c1 chan by adding ‘defer Stop(c1)’ (Another bug, NOT this bug) Fixes #49724 Change-Id: I909a9993f0f6dd109c15e48a861683b87dfc4ab3 Reviewed-on: https://go-review.googlesource.com/c/go/+/366514 Reviewed-by: Ian Lance Taylor Reviewed-by: Bryan C. Mills Trust: Bryan C. Mills --- src/os/signal/signal_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/os/signal/signal_test.go b/src/os/signal/signal_test.go index 3e85d936f8..e6fb24c6a8 100644 --- a/src/os/signal/signal_test.go +++ b/src/os/signal/signal_test.go @@ -136,6 +136,9 @@ func TestSignal(t *testing.T) { // Using 10 is arbitrary. c1 := make(chan os.Signal, 10) Notify(c1) + // Stop relaying the SIGURG signals. See #49724 + Reset(syscall.SIGURG) + defer Stop(c1) // Send this process a SIGWINCH t.Logf("sigwinch...") -- 2.51.0