Skip to content

Commit

Permalink
test: increase bufsize in child process write test
Browse files Browse the repository at this point in the history
test-child-process-stdio-big-write-end was failing on ubuntu1604-arm64
because the while loop that was supposed to fill up the buffer ended up
being an infinite loop.

This increases the size of the writes in the loop by 1K until the buffer
fills up.

PR-URL: #13626
Fixes: #13603
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
Trott authored and MylesBorins committed Jul 17, 2017
1 parent c97b167 commit 9e9a9c3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions test/parallel/test-child-process-stdio-big-write-end.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
require('../common');
const assert = require('assert');
const BUFSIZE = 1024;
let bufsize = 0;

switch (process.argv[2]) {
case undefined:
Expand Down Expand Up @@ -30,14 +30,15 @@ function parent() {
// Write until the buffer fills up.
let buf;
do {
buf = Buffer.alloc(BUFSIZE, '.');
sent += BUFSIZE;
bufsize += 1024;
buf = Buffer.alloc(bufsize, '.');
sent += bufsize;
} while (child.stdin.write(buf));

// then write a bunch more times.
for (let i = 0; i < 100; i++) {
const buf = Buffer.alloc(BUFSIZE, '.');
sent += BUFSIZE;
const buf = Buffer.alloc(bufsize, '.');
sent += bufsize;
child.stdin.write(buf);
}

Expand Down

0 comments on commit 9e9a9c3

Please sign in to comment.