Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library test_progress; | 5 library test_progress; |
| 6 | 6 |
| 7 import "dart:io"; | 7 import "dart:io"; |
| 8 import "dart:io" as io; | 8 import "dart:io" as io; |
| 9 import "http_server.dart" as http_server; | 9 import "http_server.dart" as http_server; |
| 10 import "status_file_parser.dart"; | 10 import "status_file_parser.dart"; |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 206 List<TestCase> _tests = <TestCase>[]; | 206 List<TestCase> _tests = <TestCase>[]; |
| 207 DateTime _startTime; | 207 DateTime _startTime; |
| 208 | 208 |
| 209 TimingPrinter(this._startTime); | 209 TimingPrinter(this._startTime); |
| 210 | 210 |
| 211 void done(TestCase testCase) { | 211 void done(TestCase testCase) { |
| 212 _tests.add(testCase); | 212 _tests.add(testCase); |
| 213 } | 213 } |
| 214 | 214 |
| 215 void allDone() { | 215 void allDone() { |
| 216 // TODO: We should take all the commands into account | 216 Duration durationOfTest(testCase) { |
| 217 var duration = const Duration(); | |
| 218 for (var output in testCase.commandOutputs.values) { | |
| 219 duration += output.time; | |
| 220 } | |
| 221 return duration; | |
| 222 } | |
|
kustermann
2013/07/16 14:48:47
This procedure will be called O(n*log n) which mea
| |
| 223 | |
| 217 Duration d = (new DateTime.now()).difference(_startTime); | 224 Duration d = (new DateTime.now()).difference(_startTime); |
| 218 print('\n--- Total time: ${_timeString(d)} ---'); | 225 print('\n--- Total time: ${_timeString(d)} ---'); |
| 219 _tests.sort((a, b) { | 226 _tests.sort((a, b) { |
| 220 Duration aDuration = a.lastCommandOutput.time; | 227 return |
| 221 Duration bDuration = b.lastCommandOutput.time; | 228 durationOfTest(b).inMilliseconds - durationOfTest(a).inMilliseconds; |
| 222 return bDuration.inMilliseconds - aDuration.inMilliseconds; | |
| 223 }); | 229 }); |
| 224 for (int i = 0; i < 20 && i < _tests.length; i++) { | 230 for (int i = 0; i < 20 && i < _tests.length; i++) { |
| 225 var name = _tests[i].displayName; | 231 var name = _tests[i].displayName; |
| 226 var duration = _tests[i].lastCommandOutput.time; | 232 var duration = durationOfTest(_tests[i]); |
| 227 var configuration = _tests[i].configurationString; | 233 var configuration = _tests[i].configurationString; |
| 228 print('${duration} - $configuration $name'); | 234 print('${duration} - $configuration $name'); |
| 229 } | 235 } |
| 230 } | 236 } |
| 231 } | 237 } |
| 232 | 238 |
| 233 class StatusFileUpdatePrinter extends EventListener { | 239 class StatusFileUpdatePrinter extends EventListener { |
| 234 var statusToConfigs = new Map<String, List<String>>(); | 240 var statusToConfigs = new Map<String, List<String>>(); |
| 235 var _failureSummary = <String>[]; | 241 var _failureSummary = <String>[]; |
| 236 | 242 |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 537 return new VerboseProgressIndicator(startTime); | 543 return new VerboseProgressIndicator(startTime); |
| 538 case 'status': | 544 case 'status': |
| 539 return new ProgressIndicator(startTime); | 545 return new ProgressIndicator(startTime); |
| 540 case 'buildbot': | 546 case 'buildbot': |
| 541 return new BuildbotProgressIndicator(startTime); | 547 return new BuildbotProgressIndicator(startTime); |
| 542 default: | 548 default: |
| 543 assert(false); | 549 assert(false); |
| 544 break; | 550 break; |
| 545 } | 551 } |
| 546 } | 552 } |
| OLD | NEW |