Permalink
Browse files

Fixed bug that executed tests in parallel, when they should be in series

  • Loading branch information...
derek committed Mar 20, 2013
1 parent c1a963e commit 4fe3af6b12d9b6432779b3455941d63b95b46f1c
Showing with 16 additions and 15 deletions.
  1. +16 −15 lib/cmds/benchmark.js
View
@@ -13,6 +13,7 @@ var util = require('../util'),
path = require('path'),
request = require('request'),
fs = require('fs'),
+ async = require('async'),
mods = {
init: function(options) {
var module = util.getPackage(true),
@@ -39,31 +40,22 @@ var util = require('../util'),
processYUI: function () {
- var self = this,
- testPaths = require(this.yuiRoot + '/src/common/tests/performance.json');
+ var testPaths = require(this.yuiRoot + '/src/common/tests/performance.json');
- log.info('Found ' + testPaths.length + ' test' + (testPaths.length > 1 ? 's' : ''));
- testPaths.forEach(function (testpath) {
- self._executeTest(path.join(self.yuiRoot, 'src', testpath));
- });
+ this._executeTests(testPaths);
},
processComponent: function (componentName) {
// this.parseResults(require('./benchmark-test-data.json')); return false;
- var self = this,
- testPaths = require(this.yuiRoot + '/src/common/tests/performance.json');
+ var testPaths = require(this.yuiRoot + '/src/common/tests/performance.json');
filtered = testPaths.filter(function (testpath) {
return testpath.match(new RegExp('^' + componentName + '/'));
});
- log.info('Found ' + filtered.length + ' test' + (filtered.length > 1 ? 's' : ''));
- filtered.forEach(function (testpath) {
- self._executeTest(path.join(self.yuiRoot, 'src', testpath));
- });
-
+ this._executeTests(filtered);
},
finish: function (plugin, results, testFile, sha) {
@@ -77,7 +69,16 @@ var util = require('../util'),
];
},
- _executeTest: function (testpath) {
+ _executeTests: function (testpaths) {
+ var self = this;
+
+ log.info('Found ' + testpaths.length + ' test' + (testpaths.length > 1 ? 's' : ''));
+ async.eachSeries(testpaths, function (testpath, next) {
+ self._executeTest(path.join(self.yuiRoot, 'src', testpath), next);
+ });
+ },
+
+ _executeTest: function (testpath, next) {
var self = this,
yuiRoot = this.yuiRoot,
componentRoot = this.componentRoot,
@@ -132,7 +133,7 @@ var util = require('../util'),
});
child.on('exit', function (error, stdout, stderr) {
-
+ next();
});
}
};

0 comments on commit 4fe3af6

Please sign in to comment.