node/test/pseudo-tty
Ben Noordhuis 7aca9cb09b
test: fix pty test hangs on aix
Some pty tests persistently hung on the AIX CI buildbots. Fix that by
adding a helper script that properly sets up the pty before spawning
the script under test.

On investigation I discovered that the test runner hung when it tried
to close the slave pty's file descriptor, probably due to a bug in
AIX's pty implementation. I could reproduce it with a short C program.
The test runner also leaked file descriptors to the child process.

I couldn't convince python's `subprocess.Popen()` to do what I wanted
it to do so I opted to move the logic to a helper script that can do
fork/setsid/etc. without having to worry about stomping on state in
tools/test.py.

In the process I also uncovered some bugs in the pty module of the
python distro that ships with macOS 10.14, leading me to reimplement
a sizable chunk of the functionality of that module.

And last but not least, of course there are differences between ptys
on different platforms and the helper script has to paper over that.
Of course.

Really, this commit took me longer to put together than I care to admit.

Caveat emptor: this commit takes the hacky ^D feeding to the slave out
of tools/test.py and puts it in the *.in input files. You can also feed
other control characters to tests, like ^C or ^Z, simply by inserting
them into the corresponding input file. I think that's nice.

Fixes: https://github.com/nodejs/build/issues/1820
Fixes: https://github.com/nodejs/node/issues/28489

PR-URL: https://github.com/nodejs/node/pull/28600
Backport-PR-URL: https://github.com/nodejs/node/pull/29599
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-09-19 10:54:38 +01:00
..
no_dropped_stdio.js test: change isAix to isAIX 2017-07-24 18:52:38 +02:00
no_dropped_stdio.out
no_interleaved_stdio.js test: change isAix to isAIX 2017-07-24 18:52:38 +02:00
no_interleaved_stdio.out
pseudo-tty.status test: fix pty test hangs on aix 2019-09-19 10:54:38 +01:00
pty_helper.py test: fix pty test hangs on aix 2019-09-19 10:54:38 +01:00
ref_keeps_node_running.js test: remove common.noop 2017-07-19 15:02:25 -04:00
ref_keeps_node_running.out tty: add ref() so process.stdin.ref() etc. work 2017-02-28 18:44:05 +01:00
stdin-setrawmode.js test: add test for process.stdin.setRawMode() 2016-12-05 14:23:15 -08:00
stdin-setrawmode.out test: add stdin-setrawmode.out file 2016-12-09 15:20:51 +01:00
test-handle-wrap-isrefed-tty.js test: adjust indentation for stricter linting 2017-07-28 02:31:59 +02:00
test-handle-wrap-isrefed-tty.out tty: add ref() so process.stdin.ref() etc. work 2017-02-28 18:44:05 +01:00
test-set-raw-mode-reset-process-exit.js test: check TTY mode reset on exit 2018-08-16 11:38:51 +10:00
test-set-raw-mode-reset-process-exit.out test: check TTY mode reset on exit 2018-08-16 11:38:51 +10:00
test-set-raw-mode-reset-signal.js test: check TTY mode reset on exit 2018-08-16 11:38:51 +10:00
test-set-raw-mode-reset-signal.out test: check TTY mode reset on exit 2018-08-16 11:38:51 +10:00
test-set-raw-mode-reset.js test: check TTY mode reset on exit 2018-08-16 11:38:51 +10:00
test-set-raw-mode-reset.out test: check TTY mode reset on exit 2018-08-16 11:38:51 +10:00
test-stderr-stdout-handle-sigwinch.js test: change isAix to isAIX 2017-07-24 18:52:38 +02:00
test-stderr-stdout-handle-sigwinch.out test: add test for SIGWINCH handling by stdio.js 2016-12-27 21:21:35 -08:00
test-stdin-write.js test: add stdin writable regression test 2019-03-19 22:55:34 +00:00
test-stdin-write.out test: add stdin writable regression test 2019-03-19 22:55:34 +00:00
test-stdout-read.in test: fix pty test hangs on aix 2019-09-19 10:54:38 +01:00
test-stdout-read.js process: allow reading from stdout/stderr sockets 2019-03-19 22:55:13 +00:00
test-stdout-read.out test: fix pty test hangs on aix 2019-09-19 10:54:38 +01:00
test-tty-isatty.js tty,doc: add type-check to isatty 2017-10-23 17:35:51 -04:00
test-tty-isatty.out tty,doc: add type-check to isatty 2017-10-23 17:35:51 -04:00
test-tty-stdin-call-end.js test: add process.stdin.end() TTY regression test 2019-03-19 22:55:59 +00:00
test-tty-stdin-call-end.out test: add process.stdin.end() TTY regression test 2019-03-19 22:55:59 +00:00
test-tty-stdout-end.js stream: add destroy and _destroy methods. 2017-05-28 07:00:40 -07:00
test-tty-stdout-end.out test: fix old tty tests 2016-07-11 15:22:09 +02:00
test-tty-stdout-resize.js tty: fix 'resize' event regression 2017-12-20 22:44:12 +00:00
test-tty-stdout-resize.out tty: fix 'resize' event regression 2017-12-20 22:44:12 +00:00
test-tty-stream-constructors.js test: add coverage to tty module 2017-12-13 15:50:53 +00:00
test-tty-stream-constructors.out test: add coverage to tty module 2017-12-13 15:50:53 +00:00
test-tty-window-size.js test: add coverage to tty module 2017-12-13 15:50:53 +00:00
test-tty-window-size.out test: add coverage to tty module 2017-12-13 15:50:53 +00:00
test-tty-wrap.js test: fix old tty tests 2016-07-11 15:22:09 +02:00
test-tty-wrap.out test: fix old tty tests 2016-07-11 15:22:09 +02:00
testcfg.py test: fix pty test hangs on aix 2019-09-19 10:54:38 +01:00