]> Cypherpunks repositories - gostls13.git/commit
os/signal: rewrite TestTerminalSignal without bash
authorMichael Pratt <mpratt@google.com>
Tue, 4 Oct 2022 16:50:03 +0000 (12:50 -0400)
committerGopher Robot <gobot@golang.org>
Fri, 14 Oct 2022 15:34:49 +0000 (15:34 +0000)
commita8ca70ff98dd088ff6afe57eafd553aa79732086
tree066f9aa0a47d496513bb465e9ff70882775ab9e3
parentcba63ac03833c6eeaf4184ca2022d014b84db455
os/signal: rewrite TestTerminalSignal without bash

The existing version of this test contains several races it tries to
control with sleeps. Unfortunately, it is still flaky on darwin because
writing `fg` in bash too early can apparently result in failure to
actually continue the stopped child.

Rather than continuing to get perfect timing with bash, rewrite this to
eliminate bash and instead perform the same PTY operations that bash
would do.

This test is still quite complex because psuedo-terminals are
interminably complicated, but I believe it is no longer racy.
Technically there are still two races (waiting for child to enter read()
and waiting for the darwin kernel to wake the read after TIOCSPGRP), but
loss of either of these races should only mean we fail to test the
desired darwin EINTR case, not failure.

This test is skipped on DragonflyBSD, as it tickles a Wait hang bug
(#56132).

Updates #56132.
Fixes #37329.

Change-Id: I0ceaf5aa89f6be0f1bf68b2140f47db673cedb33
Reviewed-on: https://go-review.googlesource.com/c/go/+/440220
Run-TryBot: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
src/os/signal/signal_cgo_test.go