node/test/pseudo-tty
Ben Noordhuis ada0ed55d1
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/28826
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-07-25 13:55:05 +01:00
..
console_colors.js console: auto-detect color support by default 2018-04-16 16:10:19 -07:00
console_colors.out console: auto-detect color support by default 2018-04-16 16:10:19 -07:00
no_dropped_stdio.js
no_dropped_stdio.out
no_interleaved_stdio.js
no_interleaved_stdio.out
pseudo-tty.status test: fix pty test hangs on aix 2019-07-25 13:55:05 +01:00
pty_helper.py test: fix pty test hangs on aix 2019-07-25 13:55:05 +01:00
ref_keeps_node_running.js
ref_keeps_node_running.out
stdin-setrawmode.js
stdin-setrawmode.out
test-assert-colors.js assert: make skipping indicator blue 2018-05-04 11:54:32 -04:00
test-assert-colors.out assert: fix diff color output 2018-03-27 01:20:19 +01:00
test-async-wrap-getasyncid-tty.js test: really test the ttywrap bits of getasyncid 2018-02-22 12:12:41 -05:00
test-async-wrap-getasyncid-tty.out test: really test the ttywrap bits of getasyncid 2018-02-22 12:12:41 -05:00
test-handle-wrap-isrefed-tty.js test: remove unnecessary assertions 2018-09-27 13:10:55 +02:00
test-handle-wrap-isrefed-tty.out
test-readable-tty-keepalive.js stream: fix readable behavior for highWaterMark === 0 2018-08-15 20:23:17 +10:00
test-readable-tty-keepalive.out stream: fix readable behavior for highWaterMark === 0 2018-08-15 20:23:17 +10:00
test-set-raw-mode-reset-process-exit.js test: check TTY mode reset on exit 2018-06-01 11:18:17 +02:00
test-set-raw-mode-reset-process-exit.out test: check TTY mode reset on exit 2018-06-01 11:18:17 +02:00
test-set-raw-mode-reset-signal.js test: check TTY mode reset on exit 2018-06-01 11:18:17 +02:00
test-set-raw-mode-reset-signal.out test: check TTY mode reset on exit 2018-06-01 11:18:17 +02:00
test-set-raw-mode-reset.js test: check TTY mode reset on exit 2018-06-01 11:18:17 +02:00
test-set-raw-mode-reset.out test: check TTY mode reset on exit 2018-06-01 11:18:17 +02:00
test-stderr-stdout-handle-sigwinch.js
test-stderr-stdout-handle-sigwinch.out
test-stdin-write.js test: add stdin writable regression test 2018-10-07 12:11:34 +02:00
test-stdin-write.out test: add stdin writable regression test 2018-10-07 12:11:34 +02:00
test-stdout-read.in test: fix pty test hangs on aix 2019-07-25 13:55:05 +01:00
test-stdout-read.js process: allow reading from stdout/stderr sockets 2018-10-07 12:11:34 +02:00
test-stdout-read.out test: fix pty test hangs on aix 2019-07-25 13:55:05 +01:00
test-tty-color-support.js tty: add hasColors function 2019-04-17 00:15:13 +01:00
test-tty-color-support.out tty: add hasColors function 2019-04-17 00:15:13 +01:00
test-tty-isatty.js tty,doc: add type-check to isatty 2017-10-22 16:51:10 -07:00
test-tty-isatty.out tty,doc: add type-check to isatty 2017-10-22 16:51:10 -07:00
test-tty-stdin-call-end.js test: add process.stdin.end() TTY regression test 2018-10-04 08:21:50 +02:00
test-tty-stdin-call-end.out test: add process.stdin.end() TTY regression test 2018-10-04 08:21:50 +02:00
test-tty-stdin-end.js src: remove kFlagNoShutdown flag 2018-05-08 14:22:25 -07:00
test-tty-stdin-end.out src: remove kFlagNoShutdown flag 2018-05-08 14:22:25 -07:00
test-tty-stdout-end.js test: remove unused uncaughtException handler 2019-05-16 14:56:53 -04:00
test-tty-stdout-end.out
test-tty-stdout-resize.js tty: fix 'resize' event regression 2017-11-15 12:18:58 +01:00
test-tty-stdout-resize.out tty: fix 'resize' event regression 2017-11-15 12:18:58 +01:00
test-tty-stream-constructors.js test: add coverage to tty module 2017-11-14 17:32:45 -05:00
test-tty-stream-constructors.out test: add coverage to tty module 2017-11-14 17:32:45 -05:00
test-tty-window-size.js test: add coverage to tty module 2017-11-14 17:32:45 -05:00
test-tty-window-size.out test: add coverage to tty module 2017-11-14 17:32:45 -05:00
test-tty-wrap.js
test-tty-wrap.out
testcfg.py test: fix pty test hangs on aix 2019-07-25 13:55:05 +01:00