| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 } | 87 } |
| 88 if (test.info.hasRuntimeError) { | 88 if (test.info.hasRuntimeError) { |
| 89 output.add('Runtime error expected.'); | 89 output.add('Runtime error expected.'); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 for (var i = 0; i < test.commands.length; i++) { | 93 for (var i = 0; i < test.commands.length; i++) { |
| 94 var command = test.commands[i]; | 94 var command = test.commands[i]; |
| 95 var commandOutput = test.commandOutputs[command]; | 95 var commandOutput = test.commandOutputs[command]; |
| 96 if (commandOutput != null) { | 96 if (commandOutput != null) { |
| 97 output.add("CommandOutput[$i]:"); | 97 output.add("CommandOutput[${command.displayName}]:"); |
| 98 if (!commandOutput.diagnostics.isEmpty) { | 98 if (!commandOutput.diagnostics.isEmpty) { |
| 99 String prefix = 'diagnostics:'; | 99 String prefix = 'diagnostics:'; |
| 100 for (var s in commandOutput.diagnostics) { | 100 for (var s in commandOutput.diagnostics) { |
| 101 output.add('$prefix ${s}'); | 101 output.add('$prefix ${s}'); |
| 102 prefix = ' '; | 102 prefix = ' '; |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 if (!commandOutput.stdout.isEmpty) { | 105 if (!commandOutput.stdout.isEmpty) { |
| 106 output.add(''); | 106 output.add(''); |
| 107 output.add('stdout:'); | 107 output.add('stdout:'); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 | 196 |
| 197 class SummaryPrinter extends EventListener { | 197 class SummaryPrinter extends EventListener { |
| 198 void allTestsKnown() { | 198 void allTestsKnown() { |
| 199 if (SummaryReport.total > 0) { | 199 if (SummaryReport.total > 0) { |
| 200 SummaryReport.printReport(); | 200 SummaryReport.printReport(); |
| 201 } | 201 } |
| 202 } | 202 } |
| 203 } | 203 } |
| 204 | 204 |
| 205 class TimingPrinter extends EventListener { | 205 class TimingPrinter extends EventListener { |
| 206 List<TestCase> _tests = <TestCase>[]; | 206 List<CommandOutput> _commandOutputs = <CommandOutput>[]; |
| 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 for (var commandOutput in testCase.commandOutputs.values) { |
| 213 _commandOutputs.add(commandOutput); |
| 214 } |
| 213 } | 215 } |
| 214 | 216 |
| 215 void allDone() { | 217 void allDone() { |
| 216 // TODO: We should take all the commands into account | |
| 217 Duration d = (new DateTime.now()).difference(_startTime); | 218 Duration d = (new DateTime.now()).difference(_startTime); |
| 218 print('\n--- Total time: ${_timeString(d)} ---'); | 219 print('\n--- Total time: ${_timeString(d)} ---'); |
| 219 _tests.sort((a, b) { | 220 _commandOutputs.sort((a, b) { |
| 220 Duration aDuration = a.lastCommandOutput.time; | 221 return b.time.inMilliseconds - a.time.inMilliseconds; |
| 221 Duration bDuration = b.lastCommandOutput.time; | |
| 222 return bDuration.inMilliseconds - aDuration.inMilliseconds; | |
| 223 }); | 222 }); |
| 224 for (int i = 0; i < 20 && i < _tests.length; i++) { | 223 for (int i = 0; i < 20 && i < _commandOutputs.length; i++) { |
| 225 var name = _tests[i].displayName; | 224 var commandOutput = _commandOutputs[i]; |
| 226 var duration = _tests[i].lastCommandOutput.time; | 225 var command = commandOutput.command; |
| 227 var configuration = _tests[i].configurationString; | 226 var testCase = commandOutput.testCase; |
| 228 print('${duration} - $configuration $name'); | 227 var duration = commandOutput.time; |
| 228 var configuration = testCase.configurationString; |
| 229 print('${commandOutput.time} - $configuration' |
| 230 ' - ${testCase.displayName} (${command.displayName})'); |
| 229 } | 231 } |
| 230 } | 232 } |
| 231 } | 233 } |
| 232 | 234 |
| 233 class StatusFileUpdatePrinter extends EventListener { | 235 class StatusFileUpdatePrinter extends EventListener { |
| 234 var statusToConfigs = new Map<String, List<String>>(); | 236 var statusToConfigs = new Map<String, List<String>>(); |
| 235 var _failureSummary = <String>[]; | 237 var _failureSummary = <String>[]; |
| 236 | 238 |
| 237 void done(TestCase test) { | 239 void done(TestCase test) { |
| 238 if (test.lastCommandOutput.unexpectedOutput) { | 240 if (test.lastCommandOutput.unexpectedOutput) { |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 return new VerboseProgressIndicator(startTime); | 539 return new VerboseProgressIndicator(startTime); |
| 538 case 'status': | 540 case 'status': |
| 539 return new ProgressIndicator(startTime); | 541 return new ProgressIndicator(startTime); |
| 540 case 'buildbot': | 542 case 'buildbot': |
| 541 return new BuildbotProgressIndicator(startTime); | 543 return new BuildbotProgressIndicator(startTime); |
| 542 default: | 544 default: |
| 543 assert(false); | 545 assert(false); |
| 544 break; | 546 break; |
| 545 } | 547 } |
| 546 } | 548 } |
| OLD | NEW |