Skip to content

Commit 560d8ee

Browse files
gireeshpunathilitaloacasas
authored andcommitted
test: delay child exit in AIX for pseudo-tty tests
The tests in pseudo-tty takes the form of child node writing some data and exiting, while parent python consume them through pseudo tty implementations, and validate the result. While there is no synchronization between child and parent, this works for most platforms, except AIX, where the child exits even before the parent could setup the read loop, under race conditions Fixing the race condition is ideally done through sending ACK messages to and forth, but involves massive changes and have side effect. The workaround is to address them in AIX alone, by adding a reasonable delay. PR-URL: #11715 Fixes: #7973 Fixes: #9765 Fixes: #11541 Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
1 parent f9c831f commit 560d8ee

4 files changed

+19
-10
lines changed

test/pseudo-tty/no_dropped_stdio.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// https://github.com/nodejs/node/issues/6456#issuecomment-219320599
22
// https://gist.github.com/isaacs/1495b91ec66b21d30b10572d72ad2cdd
33
'use strict';
4-
require('../common');
4+
const common = require('../common');
55

66
// 1000 bytes wrapped at 50 columns
77
// \n turns into a double-byte character
@@ -11,5 +11,9 @@ let out = ('o'.repeat(48) + '\n').repeat(20);
1111
// This results in 1025 bytes, just enough to overflow the 1kb OS X TTY buffer.
1212
out += 'o'.repeat(24) + 'O';
1313

14-
process.stdout.write(out);
15-
process.exit(0);
14+
// In AIX, the child exits even before the python parent
15+
// can setup the readloop. Provide a reasonable delay.
16+
setTimeout(function() {
17+
process.stdout.write(out);
18+
process.exit(0);
19+
}, common.isAix ? 200 : 0);

test/pseudo-tty/no_interleaved_stdio.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// https://github.com/nodejs/node/issues/6456#issuecomment-219320599
22
// https://gist.github.com/isaacs/1495b91ec66b21d30b10572d72ad2cdd
33
'use strict';
4-
require('../common');
4+
const common = require('../common');
55

66
// 1000 bytes wrapped at 50 columns
77
// \n turns into a double-byte character
@@ -13,5 +13,9 @@ out += 'o'.repeat(24) + 'O';
1313

1414
const err = '__This is some stderr__';
1515

16-
process.stdout.write(out);
17-
process.stderr.write(err);
16+
// In AIX, the child exits even before the python parent
17+
// can setup the readloop. Provide a reasonable delay.
18+
setTimeout(function() {
19+
process.stdout.write(out);
20+
process.stderr.write(err);
21+
}, common.isAix ? 200 : 0);

test/pseudo-tty/pseudo-tty.status

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
prefix pseudo-tty
22

33
[$system==aix]
4-
# test issue only, covered under https://github.com/nodejs/node/issues/7973
5-
no_dropped_stdio : SKIP
6-
no_interleaved_stdio : SKIP
74
# being investigated under https://github.com/nodejs/node/issues/9728
85
test-tty-wrap : FAIL, PASS

test/pseudo-tty/test-stderr-stdout-handle-sigwinch.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,8 @@ process.stdout._refreshSize = wrap(originalRefreshSizeStdout,
2727
process.stdout,
2828
'calling stdout._refreshSize');
2929

30-
process.emit('SIGWINCH');
30+
// In AIX, the child exits even before the python parent
31+
// can setup the readloop. Provide a reasonable delay.
32+
setTimeout(function() {
33+
process.emit('SIGWINCH');
34+
}, common.isAix ? 200 : 0);

0 commit comments

Comments
 (0)