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

Side by Side Diff: tools/testing/dart/test_runner.dart

Issue 26229005: Fixed (currently harmless) bug in test_runner and implemented separate dart2js compilation cache (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/testing/dart/test_suite.dart » ('j') | tools/testing/dart/test_suite.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Classes and methods for executing tests. 6 * Classes and methods for executing tests.
7 * 7 *
8 * This module includes: 8 * This module includes:
9 * - Managing parallel execution of tests, including timeout checks. 9 * - Managing parallel execution of tests, including timeout checks.
10 * - Evaluating the output of each test as pass/fail/crash/timeout. 10 * - Evaluating the output of each test as pass/fail/crash/timeout.
(...skipping 2137 matching lines...) Expand 10 before | Expand all | Expand 10 after
2148 bool _closed = false; 2148 bool _closed = false;
2149 StreamController<TestCase> _controller = new StreamController<TestCase>(); 2149 StreamController<TestCase> _controller = new StreamController<TestCase>();
2150 2150
2151 TestCaseCompleter(this.graph, this.enqueuer, this.commandQueue) { 2151 TestCaseCompleter(this.graph, this.enqueuer, this.commandQueue) {
2152 var eventCondition = graph.events.where; 2152 var eventCondition = graph.events.where;
2153 2153
2154 // Store all the command outputs -- they will be delivered synchronously 2154 // Store all the command outputs -- they will be delivered synchronously
2155 // (i.e. before state changes in the graph) 2155 // (i.e. before state changes in the graph)
2156 commandQueue.completedCommands.listen((CommandOutput output) { 2156 commandQueue.completedCommands.listen((CommandOutput output) {
2157 _outputs[output.command] = output; 2157 _outputs[output.command] = output;
2158 }, onDone: () {
2159 _completeTestCasesIfPossible(new List.from(enqueuer.remainingTestCases));
2160 assert(enqueuer.remainingTestCases.isEmpty);
2161 _checkDone();
2158 }); 2162 });
2159 2163
2160 // Listen for NodeState.Processing -> NodeState.{Successfull,Failed} 2164 // Listen for NodeState.Processing -> NodeState.{Successfull,Failed}
2161 // changes. 2165 // changes.
2162 eventCondition((event) => event is dgraph.StateChangedEvent) 2166 eventCondition((event) => event is dgraph.StateChangedEvent)
2163 .listen((dgraph.StateChangedEvent event) { 2167 .listen((dgraph.StateChangedEvent event) {
2164 if (event.from == dgraph.NodeState.Processing) { 2168 if (event.from == dgraph.NodeState.Processing) {
2169 var command = event.node.userData;
2170
2165 assert(COMPLETED_STATES.contains(event.to)); 2171 assert(COMPLETED_STATES.contains(event.to));
2166 _completeTestCasesIfPossible(event.node.userData); 2172 assert(_outputs[command] != null);
2167 2173
2168 if (!_closed && 2174 _completeTestCasesIfPossible(enqueuer.command2testCases[command]);
2169 graph.isSealed && 2175 _checkDone();
2170 enqueuer.remainingTestCases.isEmpty) {
2171 _controller.close();
2172 _closed = true;
2173 }
2174 } 2176 }
2175 }); 2177 });
2176 2178
2177 // Listen also for GraphSealedEvent's. If there is not a single node in the 2179 // Listen also for GraphSealedEvent's. If there is not a single node in the
2178 // graph, we still want to finish after the graph was sealed. 2180 // graph, we still want to finish after the graph was sealed.
2179 eventCondition((event) => event is dgraph.GraphSealedEvent) 2181 eventCondition((event) => event is dgraph.GraphSealedEvent)
2180 .listen((dgraph.GraphSealedEvent event) { 2182 .listen((dgraph.GraphSealedEvent event) {
2181 if (!_closed && enqueuer.remainingTestCases.isEmpty) { 2183 if (!_closed && enqueuer.remainingTestCases.isEmpty) {
2182 _controller.close(); 2184 _controller.close();
2183 _closed = true; 2185 _closed = true;
2184 } 2186 }
2185 }); 2187 });
2186 } 2188 }
2187 2189
2188 Stream<TestCase> get finishedTestCases => _controller.stream; 2190 Stream<TestCase> get finishedTestCases => _controller.stream;
2189 2191
2190 void _completeTestCasesIfPossible(Command command) { 2192 void _checkDone() {
2191 assert(_outputs[command] != null); 2193 if (!_closed && graph.isSealed && enqueuer.remainingTestCases.isEmpty) {
2194 _controller.close();
2195 _closed = true;
2196 }
2197 }
2192 2198
2193 var testCases = enqueuer.command2testCases[command]; 2199 void _completeTestCasesIfPossible(Iterable<TestCase> testCases){
2194
2195 // Update TestCases with command outputs 2200 // Update TestCases with command outputs
2196 for (TestCase test in testCases) { 2201 for (TestCase test in testCases) {
2197 for (var icommand in test.commands) { 2202 for (var icommand in test.commands) {
2198 var output = _outputs[icommand]; 2203 var output = _outputs[icommand];
2199 if (output != null) { 2204 if (output != null) {
2200 test.commandOutputs[icommand] = output; 2205 test.commandOutputs[icommand] = output;
2201 } 2206 }
2202 } 2207 }
2203 } 2208 }
2204 2209
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
2316 } 2321 }
2317 } 2322 }
2318 2323
2319 void eventAllTestsDone() { 2324 void eventAllTestsDone() {
2320 for (var listener in _eventListener) { 2325 for (var listener in _eventListener) {
2321 listener.allDone(); 2326 listener.allDone();
2322 } 2327 }
2323 _allDone(); 2328 _allDone();
2324 } 2329 }
2325 } 2330 }
OLDNEW
« no previous file with comments | « no previous file | tools/testing/dart/test_suite.dart » ('j') | tools/testing/dart/test_suite.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698