Browse Source

test: allow for slow hosts in spawnSync() test

test-child-process-spawnsync-timeout failed from time to time on
Raspberry Pi devices. Use common.platformTimeout() to allow a little
more time to run on resource-constrained hosts.

PR-URL: https://github.com/nodejs/node/pull/10998
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
v6.x
Rich Trott 8 years ago
committed by Myles Borins
parent
commit
8ff15a262d
No known key found for this signature in database GPG Key ID: 933B01F40B5CA946
  1. 11
      test/parallel/test-child-process-spawnsync-timeout.js

11
test/parallel/test-child-process-spawnsync-timeout.js

@ -1,11 +1,11 @@
'use strict';
require('../common');
var assert = require('assert');
const common = require('../common');
const assert = require('assert');
var spawnSync = require('child_process').spawnSync;
var TIMER = 200;
var SLEEP = 5000;
const TIMER = 200;
const SLEEP = common.platformTimeout(5000);
switch (process.argv[2]) {
case 'child':
@ -19,8 +19,7 @@ switch (process.argv[2]) {
var ret = spawnSync(process.execPath, [__filename, 'child'],
{timeout: TIMER});
assert.strictEqual(ret.error.errno, 'ETIMEDOUT');
console.log(ret);
var end = Date.now() - start;
const end = Date.now() - start;
assert(end < SLEEP);
assert(ret.status > 128 || ret.signal);
break;

Loading…
Cancel
Save