Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Unified Diff: tools/testing/dart/test_runner.dart

Issue 11884054: Simplify the enqueuing of tests from all test suites (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/test-runtime.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/test_runner.dart
diff --git a/tools/testing/dart/test_runner.dart b/tools/testing/dart/test_runner.dart
index aa84ae9cd637787c501b69c64bf22ee0642571e5..c745eb62567eca95ab777537dcde8ae666b2a135 100644
--- a/tools/testing/dart/test_runner.dart
+++ b/tools/testing/dart/test_runner.dart
@@ -1426,15 +1426,14 @@ class BatchRunnerProcess {
*/
class ProcessQueue {
int _numProcesses = 0;
- int _activeTestListers = 0;
int _maxProcesses;
+ bool _allTestsWereEnqueued = false;
/** The number of tests we allow to actually fail before we stop retrying. */
int _MAX_FAILED_NO_RETRY = 4;
bool _verbose;
bool _listTests;
Function _allDone;
- EnqueueMoreWork _enqueueMoreWork;
Queue<TestCase> _tests;
ProgressIndicator _progress;
@@ -1468,7 +1467,7 @@ class ProcessQueue {
String progress,
Date startTime,
bool printTiming,
- this._enqueueMoreWork,
+ testSuites,
this._allDone,
[bool verbose = false,
bool listTests = false])
@@ -1480,20 +1479,7 @@ class ProcessQueue {
printTiming),
_batchProcesses = new Map<String, List<BatchRunnerProcess>>(),
_testCache = new Map<String, List<TestInformation>>() {
- _checkDone();
- }
-
- /**
- * Registers a TestSuite so that all of its tests will be run.
- */
- void addTestSuite(TestSuite testSuite) {
- _activeTestListers++;
- testSuite.forEachTest(_runTest, _testCache, _testListerDone);
- }
-
- void _testListerDone() {
- _activeTestListers--;
- _checkDone();
+ _runTests(testSuites);
}
/**
@@ -1510,18 +1496,28 @@ class ProcessQueue {
}
void _checkDone() {
- // When there are no more active test listers ask for more work
- // from process queue users.
- if (_activeTestListers == 0) {
- _enqueueMoreWork(this);
+ if (_allTestsWereEnqueued && _tests.isEmpty && _numProcesses == 0) {
+ _terminateBatchRunners().then((_) => _cleanupAndMarkDone());
}
- // If there is still no work, we are done.
- if (_activeTestListers == 0) {
- _progress.allTestsKnown();
- if (_tests.isEmpty && _numProcesses == 0) {
- _terminateBatchRunners().then((_) => _cleanupAndMarkDone());
+ }
+
+ void _runTests(List<TestSuite> testSuites) {
+ // FIXME: For some reason we cannot call this method on all test suites
+ // in parallel.
+ // If we do, not all tests get enqueued (if --arch=all was specified,
+ // we don't get twice the number of tests [tested on -rvm -cnone])
+ // Issue: 7927
+ Iterator<TestSuite> iterator = testSuites.iterator;
+ void enqueueNextSuite() {
+ if (!iterator.moveNext()) {
+ _allTestsWereEnqueued = true;
+ _progress.allTestsKnown();
+ _checkDone();
+ } else {
+ iterator.current.forEachTest(_runTest, _testCache, enqueueNextSuite);
}
}
+ enqueueNextSuite();
}
/**
« no previous file with comments | « tools/test-runtime.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698