From 7ef10e8abc1315ba3148a0368cb68740645fdb14 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 25 Aug 2015 09:45:42 -0700 Subject: [PATCH 1/3] test: speed up test-child-process-spawnsync.js --- test/parallel/test-child-process-spawnsync.js | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/test/parallel/test-child-process-spawnsync.js b/test/parallel/test-child-process-spawnsync.js index d66c51c9c41b2f..b300ec2f98d7f6 100644 --- a/test/parallel/test-child-process-spawnsync.js +++ b/test/parallel/test-child-process-spawnsync.js @@ -4,21 +4,10 @@ var assert = require('assert'); var spawnSync = require('child_process').spawnSync; -var TIMER = 100; -var SLEEP = 1000; - -setTimeout(function() { - assert.ok(stop, 'timer should not fire before process exits'); -}, TIMER); - -console.log('sleep started'); -var start = process.hrtime(); -var ret = spawnSync('sleep', ['1']); -var stop = process.hrtime(start); +// Echo does different things on Windows and Unix, but in both cases, it does +// more-or-less nothing if there are no parameters +var ret = spawnSync('echo'); assert.strictEqual(ret.status, 0, 'exit status should be zero'); -console.log('sleep exited', stop); -assert.strictEqual(stop[0], 1, - 'sleep should not take longer or less than 1 second'); // Error test when command does not exist var ret_err = spawnSync('command_does_not_exist', ['bar']).error; From c273d2926f009bffd26875d69eb19196acbba4f9 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 25 Aug 2015 11:22:27 -0700 Subject: [PATCH 2/3] test: add parameter for correct status code on windows 2008 --- test/parallel/test-child-process-spawnsync.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-child-process-spawnsync.js b/test/parallel/test-child-process-spawnsync.js index b300ec2f98d7f6..6fd1e20bf26892 100644 --- a/test/parallel/test-child-process-spawnsync.js +++ b/test/parallel/test-child-process-spawnsync.js @@ -6,7 +6,7 @@ var spawnSync = require('child_process').spawnSync; // Echo does different things on Windows and Unix, but in both cases, it does // more-or-less nothing if there are no parameters -var ret = spawnSync('echo'); +var ret = spawnSync('echo', ['test_message']); assert.strictEqual(ret.status, 0, 'exit status should be zero'); // Error test when command does not exist From 12c064662408239d0b7f06c987aa05feede57233 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 25 Aug 2015 11:42:51 -0700 Subject: [PATCH 3/3] test: revert to sleep 0 --- test/parallel/test-child-process-spawnsync.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-child-process-spawnsync.js b/test/parallel/test-child-process-spawnsync.js index 6fd1e20bf26892..5cb4ec20db3588 100644 --- a/test/parallel/test-child-process-spawnsync.js +++ b/test/parallel/test-child-process-spawnsync.js @@ -6,7 +6,7 @@ var spawnSync = require('child_process').spawnSync; // Echo does different things on Windows and Unix, but in both cases, it does // more-or-less nothing if there are no parameters -var ret = spawnSync('echo', ['test_message']); +var ret = spawnSync('sleep', ['0']); assert.strictEqual(ret.status, 0, 'exit status should be zero'); // Error test when command does not exist