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

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

Issue 12902035: Added --failure-summary option to test.dart (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 | « tools/testing/dart/test_options.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 void done(TestCase test) { 307 void done(TestCase test) {
308 var status = 'pass'; 308 var status = 'pass';
309 if (test.lastCommandOutput.unexpectedOutput) { 309 if (test.lastCommandOutput.unexpectedOutput) {
310 status = 'fail'; 310 status = 'fail';
311 } 311 }
312 print('Done ${test.configurationString} ${test.displayName}: $status'); 312 print('Done ${test.configurationString} ${test.displayName}: $status');
313 } 313 }
314 } 314 }
315 315
316 class TestFailurePrinter extends EventListener { 316 class TestFailurePrinter extends EventListener {
317 bool _printSummary;
317 var _formatter; 318 var _formatter;
319 var _failureSummary = <String>[];
318 320
319 TestFailurePrinter([this._formatter = const Formatter()]); 321 TestFailurePrinter(this._printSummary,
322 [this._formatter = const Formatter()]);
320 323
321 void done(TestCase test) { 324 void done(TestCase test) {
322 if (test.lastCommandOutput.unexpectedOutput) { 325 if (test.lastCommandOutput.unexpectedOutput) {
323 for (var line in _buildFailureOutput(test, _formatter)) { 326 var lines = _buildFailureOutput(test, _formatter);
327 for (var line in lines) {
324 print(line); 328 print(line);
325 } 329 }
326 print(''); 330 print('');
331 if (_printSummary) {
332 _failureSummary.addAll(lines);
333 _failureSummary.add('');
334 }
335 }
336 }
337
338 void allDone() {
339 if (_printSummary) {
340 print('\n=== Failure summary:\n');
341 if (!_failureSummary.isEmpty) {
342 for (String line in _failureSummary) {
343 print(line);
344 }
345 print('');
346 }
327 } 347 }
328 } 348 }
329 } 349 }
330 350
331 class ProgressIndicator extends EventListener { 351 class ProgressIndicator extends EventListener {
332 ProgressIndicator(this._startTime); 352 ProgressIndicator(this._startTime);
333 353
334 factory ProgressIndicator.fromName(String name, 354 factory ProgressIndicator.fromName(String name,
335 DateTime startTime, 355 DateTime startTime,
336 Formatter formatter) { 356 Formatter formatter) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 int _failedTests = 0; 419 int _failedTests = 0;
400 bool _allTestsKnown = false; 420 bool _allTestsKnown = false;
401 DateTime _startTime; 421 DateTime _startTime;
402 } 422 }
403 423
404 abstract class CompactIndicator extends ProgressIndicator { 424 abstract class CompactIndicator extends ProgressIndicator {
405 CompactIndicator(DateTime startTime) 425 CompactIndicator(DateTime startTime)
406 : super(startTime); 426 : super(startTime);
407 427
408 void allDone() { 428 void allDone() {
409 stdout.writeln('');
410 if (_failedTests > 0) { 429 if (_failedTests > 0) {
411 // We may have printed many failure logs, so reprint the summary data. 430 // We may have printed many failure logs, so reprint the summary data.
412 _printProgress(); 431 _printProgress();
413 print(''); 432 print('');
414 } 433 }
415 stdout.close(); 434 stdout.close();
416 stderr.close(); 435 stderr.close();
417 } 436 }
418 437
419 void _printStartProgress(TestCase test) => _printProgress(); 438 void _printStartProgress(TestCase test) => _printProgress();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 print('@@@STEP_FAILURE@@@'); 510 print('@@@STEP_FAILURE@@@');
492 print('@@@BUILD_STEP $stepName failures@@@'); 511 print('@@@BUILD_STEP $stepName failures@@@');
493 for (String line in _failureSummary) { 512 for (String line in _failureSummary) {
494 print(line); 513 print(line);
495 } 514 }
496 print(''); 515 print('');
497 } 516 }
498 super.allDone(); 517 super.allDone();
499 } 518 }
500 } 519 }
OLDNEW
« no previous file with comments | « tools/testing/dart/test_options.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698