| OLD | NEW |
| 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 #library("test_progress"); | 5 #library("test_progress"); |
| 6 | 6 |
| 7 #import("test_runner.dart"); | 7 #import("test_runner.dart"); |
| 8 #import("test_suite.dart"); | 8 #import("test_suite.dart"); |
| 9 | 9 |
| 10 class ProgressIndicator { | 10 class ProgressIndicator { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 Duration d = (new Date.now()).difference(_startTime); | 62 Duration d = (new Date.now()).difference(_startTime); |
| 63 print('\n--- Total time: ${_timeString(d)} ---'); | 63 print('\n--- Total time: ${_timeString(d)} ---'); |
| 64 _tests.sort((a, b) { | 64 _tests.sort((a, b) { |
| 65 Duration aDuration = a.output.time; | 65 Duration aDuration = a.output.time; |
| 66 Duration bDuration = b.output.time; | 66 Duration bDuration = b.output.time; |
| 67 return bDuration.inMilliseconds - aDuration.inMilliseconds; | 67 return bDuration.inMilliseconds - aDuration.inMilliseconds; |
| 68 }); | 68 }); |
| 69 for (int i = 0; i < 20 && i < _tests.length; i++) { | 69 for (int i = 0; i < 20 && i < _tests.length; i++) { |
| 70 var name = _tests[i].displayName; | 70 var name = _tests[i].displayName; |
| 71 var duration = _tests[i].output.time; | 71 var duration = _tests[i].output.time; |
| 72 print('${duration} - $name'); | 72 var configuration = _tests[i].configurationString; |
| 73 print('${duration} - $configuration $name'); |
| 73 } | 74 } |
| 74 } | 75 } |
| 75 } | 76 } |
| 76 | 77 |
| 77 void allDone() { | 78 void allDone() { |
| 78 _printFailureSummary(); | 79 _printFailureSummary(); |
| 79 _printStatus(); | 80 _printStatus(); |
| 80 _printTimingInformation(); | 81 _printTimingInformation(); |
| 81 exit(_failedTests > 0 ? 1 : 0); | 82 exit(_failedTests > 0 ? 1 : 0); |
| 82 } | 83 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 105 | 106 |
| 106 String _timeString(Duration d) { | 107 String _timeString(Duration d) { |
| 107 var min = d.inMinutes; | 108 var min = d.inMinutes; |
| 108 var sec = d.inSeconds % 60; | 109 var sec = d.inSeconds % 60; |
| 109 return '${_padTime(min)}:${_padTime(sec)}'; | 110 return '${_padTime(min)}:${_padTime(sec)}'; |
| 110 } | 111 } |
| 111 | 112 |
| 112 void _printFailureOutput(TestCase test) { | 113 void _printFailureOutput(TestCase test) { |
| 113 List<String> output = new List<String>(); | 114 List<String> output = new List<String>(); |
| 114 output.add(''); | 115 output.add(''); |
| 115 output.add('FAILED: ${test.displayName}'); | 116 output.add('FAILED: ${test.configurationString} ${test.displayName}'); |
| 116 StringBuffer expected = new StringBuffer(); | 117 StringBuffer expected = new StringBuffer(); |
| 117 expected.add('Expected: '); | 118 expected.add('Expected: '); |
| 118 for (var expectation in test.expectedOutcomes) { | 119 for (var expectation in test.expectedOutcomes) { |
| 119 expected.add('$expectation '); | 120 expected.add('$expectation '); |
| 120 } | 121 } |
| 121 output.add(expected.toString()); | 122 output.add(expected.toString()); |
| 122 output.add('Actual: ${test.output.result}'); | 123 output.add('Actual: ${test.output.result}'); |
| 123 if (!test.output.stdout.isEmpty()) { | 124 if (!test.output.stdout.isEmpty()) { |
| 124 output.add(''); | 125 output.add(''); |
| 125 output.add('stdout:'); | 126 output.add('stdout:'); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 : super(startTime, printTiming); | 273 : super(startTime, printTiming); |
| 273 | 274 |
| 274 void _printStartProgress(TestCase test) { | 275 void _printStartProgress(TestCase test) { |
| 275 } | 276 } |
| 276 | 277 |
| 277 void _printDoneProgress(TestCase test) { | 278 void _printDoneProgress(TestCase test) { |
| 278 var status = 'pass'; | 279 var status = 'pass'; |
| 279 if (test.output.unexpectedOutput) { | 280 if (test.output.unexpectedOutput) { |
| 280 status = 'fail'; | 281 status = 'fail'; |
| 281 } | 282 } |
| 282 print('Done ${test.displayName}: $status'); | 283 print('Done ${test.configurationString} ${test.displayName}: $status'); |
| 283 } | 284 } |
| 284 } | 285 } |
| 285 | 286 |
| 286 | 287 |
| 287 class VerboseProgressIndicator extends ProgressIndicator { | 288 class VerboseProgressIndicator extends ProgressIndicator { |
| 288 VerboseProgressIndicator(Date startTime, bool printTiming) | 289 VerboseProgressIndicator(Date startTime, bool printTiming) |
| 289 : super(startTime, printTiming); | 290 : super(startTime, printTiming); |
| 290 | 291 |
| 291 void _printStartProgress(TestCase test) { | 292 void _printStartProgress(TestCase test) { |
| 292 print('Starting ${test.displayName}...'); | 293 print('Starting ${test.configurationString} ${test.displayName}...'); |
| 293 } | 294 } |
| 294 | 295 |
| 295 void _printDoneProgress(TestCase test) { | 296 void _printDoneProgress(TestCase test) { |
| 296 var status = 'pass'; | 297 var status = 'pass'; |
| 297 if (test.output.unexpectedOutput) { | 298 if (test.output.unexpectedOutput) { |
| 298 status = 'fail'; | 299 status = 'fail'; |
| 299 } | 300 } |
| 300 print('Done ${test.displayName}: $status'); | 301 print('Done ${test.configurationString} ${test.displayName}: $status'); |
| 301 } | 302 } |
| 302 } | 303 } |
| 303 | 304 |
| 304 | 305 |
| 305 class StatusProgressIndicator extends ProgressIndicator { | 306 class StatusProgressIndicator extends ProgressIndicator { |
| 306 StatusProgressIndicator(Date startTime, bool printTiming) | 307 StatusProgressIndicator(Date startTime, bool printTiming) |
| 307 : super(startTime, printTiming); | 308 : super(startTime, printTiming); |
| 308 | 309 |
| 309 void _printStartProgress(TestCase test) { | 310 void _printStartProgress(TestCase test) { |
| 310 } | 311 } |
| 311 | 312 |
| 312 void _printDoneProgress(TestCase test) { | 313 void _printDoneProgress(TestCase test) { |
| 313 } | 314 } |
| 314 } | 315 } |
| 315 | 316 |
| 316 | 317 |
| 317 class BuildbotProgressIndicator extends ProgressIndicator { | 318 class BuildbotProgressIndicator extends ProgressIndicator { |
| 318 BuildbotProgressIndicator(Date startTime, bool printTiming) | 319 BuildbotProgressIndicator(Date startTime, bool printTiming) |
| 319 : super(startTime, printTiming); | 320 : super(startTime, printTiming); |
| 320 | 321 |
| 321 void _printStartProgress(TestCase test) { | 322 void _printStartProgress(TestCase test) { |
| 322 } | 323 } |
| 323 | 324 |
| 324 void _printDoneProgress(TestCase test) { | 325 void _printDoneProgress(TestCase test) { |
| 325 var status = 'pass'; | 326 var status = 'pass'; |
| 326 if (test.output.unexpectedOutput) { | 327 if (test.output.unexpectedOutput) { |
| 327 status = 'fail'; | 328 status = 'fail'; |
| 328 } | 329 } |
| 329 var percent = ((_completedTests() / _foundTests) * 100).toInt().toString(); | 330 var percent = ((_completedTests() / _foundTests) * 100).toInt().toString(); |
| 330 print('Done ${test.displayName}: $status'); | 331 print('Done ${test.configurationString} ${test.displayName}: $status'); |
| 331 print('@@@STEP_CLEAR@@@'); | 332 print('@@@STEP_CLEAR@@@'); |
| 332 print('@@@STEP_TEXT@ $percent% +$_passedTests -$_failedTests @@@'); | 333 print('@@@STEP_TEXT@ $percent% +$_passedTests -$_failedTests @@@'); |
| 333 } | 334 } |
| 334 } | 335 } |
| OLD | NEW |