Permalink
Browse files

Converted the fixed fan-out of 5 into a default of 5, for a user-conf…

…igurable setting via the --max-suites / -m flag.
  • Loading branch information...
1 parent 87569c0 commit fb98d8c0520965c594d011e32f0270cc44444e2d @sam-falvo sam-falvo committed Oct 11, 2012
Showing with 10 additions and 1 deletion.
  1. +1 −0 lib/constants.js
  2. +9 −1 lib/run.js
View
1 lib/constants.js
@@ -77,6 +77,7 @@ var DEFAULT_OPTIONS = [
var WHISKEY_OPTIONS = [
['-t', '--tests STRING', 'Whitespace separated list of test suites to run sequentially.'],
['-T', '--independent-tests STRING', 'Whitespace separated list of test suites capable of running independently and concurrently.'],
+ ['-m', '--max-suites NUMBER', 'The number of concurrently executing test suites (defaults to 5)'],
['-ti', '--test-init-file STRING', 'An initialization file which is run before each test file'],
['-c', '--chdir STRING', 'Directory to which each test process chdirs before running the tests'],
['-v', '--verbosity [NUMBER]', 'Test runner verbosity'],
View
10 lib/run.js
@@ -51,6 +51,7 @@ function TestRunner(options) {
Math.random() * 10000);
this._tests = options['tests'];
this._independent_tests = options['independent-tests'];
+ this._max_suites = options['max-suites'];
this._dependencies = options['dependencies'] || null;
this._onlyEssential = options['only-essential'] || false;
this._socketPath = options['socket-path'] || defaultSocketPath;
@@ -198,7 +199,7 @@ TestRunner.prototype.runTests = function(testInitFile, chdir,
function onBound() {
self._testReporter.handleTestsStart();
async.series([
- async.forEachLimit.bind(null, self._independent_tests, 5, runSuite),
+ async.forEachLimit.bind(null, self._independent_tests, self._max_suites, runSuite),
async.forEachSeries.bind(null, self._tests, runSuite)
], self._handleTestsCompleted.bind(self));
}
@@ -447,6 +448,13 @@ function run(cwd, argv) {
options.tests = options.tests ? options.tests.split(' ') : [];
options['independent-tests'] = options['independent-tests'] ? options['independent-tests'].split(' ') : [];
+ var ms = parseInt(options['max-suites']);
+ if(ms) {
+ options['max-suites'] = ms;
+ } else {
+ options['max-suites'] = 5;
+ }
+
intersection = underscore.intersection(options.tests, options['independent-tests']);
if(intersection.length > 0) {
util.puts(sprintf('The following tests cannot appear in both --tests and --independen-tests: %s', intersection));

0 comments on commit fb98d8c

Please sign in to comment.