Chromium Code Reviews| 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 "dart:io"; | 7 import "dart:io"; |
| 8 import "test_runner.dart"; | 8 import "test_runner.dart"; |
| 9 import "test_suite.dart"; | 9 import "test_suite.dart"; |
| 10 import "status_file_parser.dart"; | 10 import "status_file_parser.dart"; |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 293 | 293 |
| 294 void _printProgress(); | 294 void _printProgress(); |
| 295 } | 295 } |
| 296 | 296 |
| 297 | 297 |
| 298 class CompactProgressIndicator extends CompactIndicator { | 298 class CompactProgressIndicator extends CompactIndicator { |
| 299 CompactProgressIndicator(Date startTime, bool printTiming) | 299 CompactProgressIndicator(Date startTime, bool printTiming) |
| 300 : super(startTime, printTiming); | 300 : super(startTime, printTiming); |
| 301 | 301 |
| 302 void _printProgress() { | 302 void _printProgress() { |
| 303 var percent = ((_completedTests() / _foundTests) * 100).toInt().toString(); | 303 var percent = ((_completedTests() / _foundTests) * 100).truncate().toString( ); |
|
Lasse Reichstein Nielsen
2013/01/04 10:29:42
.truncate().toString() => toStringAsFixed(0) ?
| |
| 304 var progressPadded = _pad(_allTestsKnown ? percent : '--', 3); | 304 var progressPadded = _pad(_allTestsKnown ? percent : '--', 3); |
| 305 var passedPadded = _pad(_passedTests.toString(), 5); | 305 var passedPadded = _pad(_passedTests.toString(), 5); |
| 306 var failedPadded = _pad(_failedTests.toString(), 5); | 306 var failedPadded = _pad(_failedTests.toString(), 5); |
| 307 Duration d = (new Date.now()).difference(_startTime); | 307 Duration d = (new Date.now()).difference(_startTime); |
| 308 var progressLine = | 308 var progressLine = |
| 309 '\r[${_timeString(d)} | $progressPadded% | ' | 309 '\r[${_timeString(d)} | $progressPadded% | ' |
| 310 '+$passedPadded | -$failedPadded]'; | 310 '+$passedPadded | -$failedPadded]'; |
| 311 stdout.write(progressLine.charCodes); | 311 stdout.write(progressLine.charCodes); |
| 312 } | 312 } |
| 313 } | 313 } |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 324 | 324 |
| 325 addColorWrapped(List<int> codes, String string, int color) { | 325 addColorWrapped(List<int> codes, String string, int color) { |
| 326 codes.add(27); | 326 codes.add(27); |
| 327 codes.addAll('[${color}m'.charCodes); | 327 codes.addAll('[${color}m'.charCodes); |
| 328 codes.addAll(string.charCodes); | 328 codes.addAll(string.charCodes); |
| 329 codes.add(27); | 329 codes.add(27); |
| 330 codes.addAll('[0m'.charCodes); | 330 codes.addAll('[0m'.charCodes); |
| 331 } | 331 } |
| 332 | 332 |
| 333 void _printProgress() { | 333 void _printProgress() { |
| 334 var percent = ((_completedTests() / _foundTests) * 100).toInt().toString(); | 334 var percent = ((_completedTests() / _foundTests) * 100).truncate().toString( ); |
| 335 var progressPadded = _pad(_allTestsKnown ? percent : '--', 3); | 335 var progressPadded = _pad(_allTestsKnown ? percent : '--', 3); |
| 336 var passedPadded = _pad(_passedTests.toString(), 5); | 336 var passedPadded = _pad(_passedTests.toString(), 5); |
| 337 var failedPadded = _pad(_failedTests.toString(), 5); | 337 var failedPadded = _pad(_failedTests.toString(), 5); |
| 338 Duration d = (new Date.now()).difference(_startTime); | 338 Duration d = (new Date.now()).difference(_startTime); |
| 339 var progressLine = []; | 339 var progressLine = []; |
| 340 progressLine.addAll('\r[${_timeString(d)} | $progressPadded% | '.charCodes); | 340 progressLine.addAll('\r[${_timeString(d)} | $progressPadded% | '.charCodes); |
| 341 addColorWrapped(progressLine, '+$passedPadded ', GREEN); | 341 addColorWrapped(progressLine, '+$passedPadded ', GREEN); |
| 342 progressLine.addAll('| '.charCodes); | 342 progressLine.addAll('| '.charCodes); |
| 343 var failedColor = (_failedTests != 0) ? RED : NONE; | 343 var failedColor = (_failedTests != 0) ? RED : NONE; |
| 344 addColorWrapped(progressLine, '-$failedPadded', failedColor); | 344 addColorWrapped(progressLine, '-$failedPadded', failedColor); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 408 : super(startTime, printTiming); | 408 : super(startTime, printTiming); |
| 409 | 409 |
| 410 void _printStartProgress(TestCase test) { | 410 void _printStartProgress(TestCase test) { |
| 411 } | 411 } |
| 412 | 412 |
| 413 void _printDoneProgress(TestCase test) { | 413 void _printDoneProgress(TestCase test) { |
| 414 var status = 'pass'; | 414 var status = 'pass'; |
| 415 if (test.lastCommandOutput.unexpectedOutput) { | 415 if (test.lastCommandOutput.unexpectedOutput) { |
| 416 status = 'fail'; | 416 status = 'fail'; |
| 417 } | 417 } |
| 418 var percent = ((_completedTests() / _foundTests) * 100).toInt().toString(); | 418 var percent = ((_completedTests() / _foundTests) * 100).truncate().toString( ); |
| 419 print('Done ${test.configurationString} ${test.displayName}: $status'); | 419 print('Done ${test.configurationString} ${test.displayName}: $status'); |
| 420 print('@@@STEP_CLEAR@@@'); | 420 print('@@@STEP_CLEAR@@@'); |
| 421 print('@@@STEP_TEXT@ $percent% +$_passedTests -$_failedTests @@@'); | 421 print('@@@STEP_TEXT@ $percent% +$_passedTests -$_failedTests @@@'); |
| 422 } | 422 } |
| 423 | 423 |
| 424 void _printFailureSummary() { | 424 void _printFailureSummary() { |
| 425 if (!_failureSummary.isEmpty && stepName != null) { | 425 if (!_failureSummary.isEmpty && stepName != null) { |
| 426 print('@@@STEP_FAILURE@@@'); | 426 print('@@@STEP_FAILURE@@@'); |
| 427 print('@@@BUILD_STEP $stepName failures@@@'); | 427 print('@@@BUILD_STEP $stepName failures@@@'); |
| 428 } | 428 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 478 print(''); | 478 print(''); |
| 479 print('$config:'); | 479 print('$config:'); |
| 480 statuses.sort((a, b) => a.compareTo(b)); | 480 statuses.sort((a, b) => a.compareTo(b)); |
| 481 for (String status in statuses) { | 481 for (String status in statuses) { |
| 482 print(' $status'); | 482 print(' $status'); |
| 483 } | 483 } |
| 484 }); | 484 }); |
| 485 _printStatus(); | 485 _printStatus(); |
| 486 } | 486 } |
| 487 } | 487 } |
| OLD | NEW |