1
0
mirror of https://github.com/golang/go synced 2024-11-17 09:54:46 -07:00

os/signal: reset SIGURG in TestSignal

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 <iant@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
This commit is contained in:
Chaoqun Han 2021-11-23 22:05:40 +08:00 committed by Ian Lance Taylor
parent 0f64c21d90
commit e3eaedb5cf

View File

@ -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...")