From c70eba32372488d89506fe8cfbac2427d509af87 Mon Sep 17 00:00:00 2001 From: Bart van der Schoor Date: Sat, 8 Mar 2014 01:06:08 +0100 Subject: [PATCH 1/4] fixed async flaw in test runner silly flow problem could bypass concurrency limits --- _infrastructure/tests/runner.js | 19 +++++++++---------- _infrastructure/tests/runner.ts | 13 +++++-------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/_infrastructure/tests/runner.js b/_infrastructure/tests/runner.js index 649569923..9d6830f67 100644 --- a/_infrastructure/tests/runner.js +++ b/_infrastructure/tests/runner.js @@ -1035,9 +1035,6 @@ var DT; // add a closure to queue this.queue.push(function () { - // when activate, add test to active list - _this.active.push(test); - // run it var p = test.run(); p.then(defer.resolve.bind(defer), defer.reject.bind(defer)); @@ -1048,6 +1045,9 @@ var DT; } _this.step(); }); + + // return it + return test; }); this.step(); @@ -1056,13 +1056,9 @@ var DT; }; TestQueue.prototype.step = function () { - var _this = this; - // setTimeout to make it flush - setTimeout(function () { - while (_this.queue.length > 0 && _this.active.length < _this.concurrent) { - _this.queue.pop().call(null); - } - }, 1); + while (this.queue.length > 0 && this.active.length < this.concurrent) { + this.active.push(this.queue.pop().call(null)); + } }; return TestQueue; })(); @@ -1314,4 +1310,7 @@ var DT; process.exit(2); }); })(DT || (DT = {})); +//grunt-start +/// +//grunt-end //# sourceMappingURL=runner.js.map diff --git a/_infrastructure/tests/runner.ts b/_infrastructure/tests/runner.ts index 6e71d621a..ad3a77909 100644 --- a/_infrastructure/tests/runner.ts +++ b/_infrastructure/tests/runner.ts @@ -75,8 +75,6 @@ module DT { var defer = Promise.defer(); // add a closure to queue this.queue.push(() => { - // when activate, add test to active list - this.active.push(test); // run it var p = test.run(); p.then(defer.resolve.bind(defer), defer.reject.bind(defer)); @@ -87,6 +85,8 @@ module DT { } this.step(); }); + // return it + return test; }); this.step(); // defer it @@ -94,12 +94,9 @@ module DT { } private step(): void { - // setTimeout to make it flush - setTimeout(() => { - while (this.queue.length > 0 && this.active.length < this.concurrent) { - this.queue.pop().call(null); - } - }, 1); + while (this.queue.length > 0 && this.active.length < this.concurrent) { + this.active.push(this.queue.pop().call(null)); + } } } From 0119825e4a5c6a0fc470b8b5d7b59fa688569930 Mon Sep 17 00:00:00 2001 From: Bart van der Schoor Date: Sat, 8 Mar 2014 01:00:38 +0100 Subject: [PATCH 2/4] allow magic branch to run full test --- _infrastructure/tests/runner.js | 4 +++- _infrastructure/tests/runner.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/_infrastructure/tests/runner.js b/_infrastructure/tests/runner.js index 9d6830f67..81416ca01 100644 --- a/_infrastructure/tests/runner.js +++ b/_infrastructure/tests/runner.js @@ -1293,10 +1293,12 @@ var DT; process.exit(0); } + var testFull = process.env['TRAVIS_BRANCH'] ? /\w\/full$/.test(process.env['TRAVIS_BRANCH']) : false; + new TestRunner(dtPath, { concurrent: argv['single-thread'] ? 1 : Math.max(cpuCores, 2), tscVersion: argv['tsc-version'], - testChanges: argv['test-changes'], + testChanges: testFull ? false : argv['test-changes'], skipTests: argv['skip-tests'], printFiles: argv['print-files'], printRefMap: argv['print-refmap'], diff --git a/_infrastructure/tests/runner.ts b/_infrastructure/tests/runner.ts index ad3a77909..5d4f42815 100644 --- a/_infrastructure/tests/runner.ts +++ b/_infrastructure/tests/runner.ts @@ -336,10 +336,12 @@ module DT { process.exit(0); } + var testFull = process.env['TRAVIS_BRANCH'] ? /\w\/full$/.test(process.env['TRAVIS_BRANCH']) : false; + new TestRunner(dtPath, { concurrent: argv['single-thread'] ? 1 : Math.max(cpuCores, 2), tscVersion: argv['tsc-version'], - testChanges: argv['test-changes'], + testChanges: testFull ? false : argv['test-changes'], // allow magic branch skipTests: argv['skip-tests'], printFiles: argv['print-files'], printRefMap: argv['print-refmap'], From 751c92514bf9b284f1ffa7b2559f748d04e73ef3 Mon Sep 17 00:00:00 2001 From: Bart van der Schoor Date: Sat, 8 Mar 2014 01:00:02 +0100 Subject: [PATCH 3/4] added --sourcemap to compile bat --- _infrastructure/tests/compile-runner.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_infrastructure/tests/compile-runner.bat b/_infrastructure/tests/compile-runner.bat index e54803ec8..49f737c5d 100644 --- a/_infrastructure/tests/compile-runner.bat +++ b/_infrastructure/tests/compile-runner.bat @@ -1 +1 @@ -tsc runner.ts --target ES5 --out runner.js --module commonjs \ No newline at end of file +tsc runner.ts --target ES5 --out runner.js --module commonjs --sourcemap From 967dae3a6798f597d93dc9ff404d2dd75b1bb89d Mon Sep 17 00:00:00 2001 From: Bart van der Schoor Date: Sat, 8 Mar 2014 01:15:20 +0100 Subject: [PATCH 4/4] changed runner Syntax pass to only compile declarations --- _infrastructure/tests/runner.js | 2 +- _infrastructure/tests/src/suite/syntax.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/_infrastructure/tests/runner.js b/_infrastructure/tests/runner.js index 81416ca01..9a3647abd 100644 --- a/_infrastructure/tests/runner.js +++ b/_infrastructure/tests/runner.js @@ -850,7 +850,7 @@ var DT; var Promise = require('bluebird'); - var endDts = /\w\.ts$/i; + var endDts = /\w\.d\.ts$/i; ///////////////////////////////// // .d.ts syntax inspection diff --git a/_infrastructure/tests/src/suite/syntax.ts b/_infrastructure/tests/src/suite/syntax.ts index 9211c3fde..915fd18d0 100644 --- a/_infrastructure/tests/src/suite/syntax.ts +++ b/_infrastructure/tests/src/suite/syntax.ts @@ -6,7 +6,7 @@ module DT { var Promise: typeof Promise = require('bluebird'); - var endDts = /\w\.ts$/i; + var endDts = /\w\.d\.ts$/i; ///////////////////////////////// // .d.ts syntax inspection