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

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

Issue 11348088: Changed: TestCase.output -> TestCase.commandOutputs[] (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 | « tests/standalone/io/test_runner_test.dart ('k') | tools/testing/dart/test_runner.dart » ('j') | 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) 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 28 matching lines...) Expand all
39 } 39 }
40 } 40 }
41 41
42 void testAdded() { _foundTests++; } 42 void testAdded() { _foundTests++; }
43 43
44 void start(TestCase test) { 44 void start(TestCase test) {
45 _printStartProgress(test); 45 _printStartProgress(test);
46 } 46 }
47 47
48 void done(TestCase test) { 48 void done(TestCase test) {
49 if (test.isFlaky && test.output.result != PASS) { 49 if (test.isFlaky && test.lastCommandOutput.result != PASS) {
50 var buf = new StringBuffer(); 50 var buf = new StringBuffer();
51 for (var l in _buildFailureOutput(test)) { 51 for (var l in _buildFailureOutput(test)) {
52 buf.add("$l\n"); 52 buf.add("$l\n");
53 } 53 }
54 _appendToFlakyFile(buf.toString()); 54 _appendToFlakyFile(buf.toString());
55 } 55 }
56 56
57 if (test.output.unexpectedOutput) { 57 if (test.lastCommandOutput.unexpectedOutput) {
58 _failedTests++; 58 _failedTests++;
59 _printFailureOutput(test); 59 _printFailureOutput(test);
60 } else { 60 } else {
61 _passedTests++; 61 _passedTests++;
62 } 62 }
63 _printDoneProgress(test); 63 _printDoneProgress(test);
64 // If we need to print timing information we hold on to all completed 64 // If we need to print timing information we hold on to all completed
65 // tests. 65 // tests.
66 if (_printTiming) _tests.add(test); 66 if (_printTiming) _tests.add(test);
67 } 67 }
68 68
69 void allTestsKnown() { 69 void allTestsKnown() {
70 if (!_allTestsKnown) SummaryReport.printReport(); 70 if (!_allTestsKnown) SummaryReport.printReport();
71 _allTestsKnown = true; 71 _allTestsKnown = true;
72 } 72 }
73 73
74 void _printTimingInformation() { 74 void _printTimingInformation() {
75 if (_printTiming) { 75 if (_printTiming) {
76 Duration d = (new Date.now()).difference(_startTime); 76 Duration d = (new Date.now()).difference(_startTime);
77 print('\n--- Total time: ${_timeString(d)} ---'); 77 print('\n--- Total time: ${_timeString(d)} ---');
78 _tests.sort((a, b) { 78 _tests.sort((a, b) {
ricow1 2012/11/16 10:36:56 add a todo here, we should take all the commands i
kustermann 2012/11/16 11:14:25 Done.
79 Duration aDuration = a.output.time; 79 Duration aDuration = a.lastCommandOutput.time;
80 Duration bDuration = b.output.time; 80 Duration bDuration = b.lastCommandOutput.time;
81 return bDuration.inMilliseconds - aDuration.inMilliseconds; 81 return bDuration.inMilliseconds - aDuration.inMilliseconds;
82 }); 82 });
83 for (int i = 0; i < 20 && i < _tests.length; i++) { 83 for (int i = 0; i < 20 && i < _tests.length; i++) {
84 var name = _tests[i].displayName; 84 var name = _tests[i].displayName;
85 var duration = _tests[i].output.time; 85 var duration = _tests[i].lastCommandOutput.time;
86 var configuration = _tests[i].configurationString; 86 var configuration = _tests[i].configurationString;
87 print('${duration} - $configuration $name'); 87 print('${duration} - $configuration $name');
88 } 88 }
89 } 89 }
90 } 90 }
91 91
92 void allDone() { 92 void allDone() {
93 _printFailureSummary(); 93 _printFailureSummary();
94 _printStatus(); 94 _printStatus();
95 _printTimingInformation(); 95 _printTimingInformation();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 List<String> output = new List<String>(); 140 List<String> output = new List<String>();
141 output.add(''); 141 output.add('');
142 output.add(_header('FAILED: ${test.configurationString}' 142 output.add(_header('FAILED: ${test.configurationString}'
143 ' ${test.displayName}')); 143 ' ${test.displayName}'));
144 StringBuffer expected = new StringBuffer(); 144 StringBuffer expected = new StringBuffer();
145 expected.add('Expected: '); 145 expected.add('Expected: ');
146 for (var expectation in test.expectedOutcomes) { 146 for (var expectation in test.expectedOutcomes) {
147 expected.add('$expectation '); 147 expected.add('$expectation ');
148 } 148 }
149 output.add(expected.toString()); 149 output.add(expected.toString());
150 output.add('Actual: ${test.output.result}'); 150 output.add('Actual: ${test.lastCommandOutput.result}');
151 if (!test.output.hasTimedOut && test.info != null) { 151 if (!test.lastCommandOutput.hasTimedOut && test.info != null) {
152 if (test.output.incomplete && !test.info.hasCompileError) { 152 if (test.lastCommandOutput.incomplete && !test.info.hasCompileError) {
153 output.add('Unexpected compile-time error.'); 153 output.add('Unexpected compile-time error.');
154 } else { 154 } else {
155 if (test.info.hasCompileError) { 155 if (test.info.hasCompileError) {
156 output.add('Compile-time error expected.'); 156 output.add('Compile-time error expected.');
157 } 157 }
158 if (test.info.hasRuntimeError) { 158 if (test.info.hasRuntimeError) {
159 output.add('Runtime error expected.'); 159 output.add('Runtime error expected.');
160 } 160 }
161 } 161 }
162 } 162 }
163 if (!test.output.diagnostics.isEmpty) { 163 if (!test.lastCommandOutput.diagnostics.isEmpty) {
164 String prefix = 'diagnostics:'; 164 String prefix = 'diagnostics:';
165 for (var s in test.output.diagnostics) { 165 for (var s in test.lastCommandOutput.diagnostics) {
166 output.add('$prefix ${s}'); 166 output.add('$prefix ${s}');
167 prefix = ' '; 167 prefix = ' ';
168 } 168 }
169 } 169 }
170 if (!test.output.stdout.isEmpty) { 170 if (!test.lastCommandOutput.stdout.isEmpty) {
171 output.add(''); 171 output.add('');
172 output.add('stdout:'); 172 output.add('stdout:');
173 for (var s in test.output.stdout) { 173 for (var s in test.lastCommandOutput.stdout) {
174 output.add(s); 174 output.add(s);
175 } 175 }
176 } 176 }
177 if (!test.output.stderr.isEmpty) { 177 if (!test.lastCommandOutput.stderr.isEmpty) {
178 output.add(''); 178 output.add('');
179 output.add('stderr:'); 179 output.add('stderr:');
180 for (var s in test.output.stderr) { 180 for (var s in test.lastCommandOutput.stderr) {
181 output.add(s); 181 output.add(s);
182 } 182 }
183 } 183 }
184 for (Command c in test.commands) { 184 for (Command c in test.commands) {
185 output.add(''); 185 output.add('');
186 String message = (c == test.commands.last 186 String message = (c == test.commands.last
187 ? "Command line" : "Compilation command"); 187 ? "Command line" : "Compilation command");
188 output.add('$message: ${c.commandLine}'); 188 output.add('$message: ${c.commandLine}');
189 } 189 }
190 return output; 190 return output;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 340
341 class LineProgressIndicator extends ProgressIndicator { 341 class LineProgressIndicator extends ProgressIndicator {
342 LineProgressIndicator(Date startTime, bool printTiming) 342 LineProgressIndicator(Date startTime, bool printTiming)
343 : super(startTime, printTiming); 343 : super(startTime, printTiming);
344 344
345 void _printStartProgress(TestCase test) { 345 void _printStartProgress(TestCase test) {
346 } 346 }
347 347
348 void _printDoneProgress(TestCase test) { 348 void _printDoneProgress(TestCase test) {
349 var status = 'pass'; 349 var status = 'pass';
350 if (test.output.unexpectedOutput) { 350 if (test.lastCommandOutput.unexpectedOutput) {
351 status = 'fail'; 351 status = 'fail';
352 } 352 }
353 print('Done ${test.configurationString} ${test.displayName}: $status'); 353 print('Done ${test.configurationString} ${test.displayName}: $status');
354 } 354 }
355 } 355 }
356 356
357 357
358 class VerboseProgressIndicator extends ProgressIndicator { 358 class VerboseProgressIndicator extends ProgressIndicator {
359 VerboseProgressIndicator(Date startTime, bool printTiming) 359 VerboseProgressIndicator(Date startTime, bool printTiming)
360 : super(startTime, printTiming); 360 : super(startTime, printTiming);
361 361
362 void _printStartProgress(TestCase test) { 362 void _printStartProgress(TestCase test) {
363 print('Starting ${test.configurationString} ${test.displayName}...'); 363 print('Starting ${test.configurationString} ${test.displayName}...');
364 } 364 }
365 365
366 void _printDoneProgress(TestCase test) { 366 void _printDoneProgress(TestCase test) {
367 var status = 'pass'; 367 var status = 'pass';
368 if (test.output.unexpectedOutput) { 368 if (test.lastCommandOutput.unexpectedOutput) {
369 status = 'fail'; 369 status = 'fail';
370 } 370 }
371 print('Done ${test.configurationString} ${test.displayName}: $status'); 371 print('Done ${test.configurationString} ${test.displayName}: $status');
372 } 372 }
373 } 373 }
374 374
375 375
376 class StatusProgressIndicator extends ProgressIndicator { 376 class StatusProgressIndicator extends ProgressIndicator {
377 StatusProgressIndicator(Date startTime, bool printTiming) 377 StatusProgressIndicator(Date startTime, bool printTiming)
378 : super(startTime, printTiming); 378 : super(startTime, printTiming);
(...skipping 10 matching lines...) Expand all
389 static String stepName; 389 static String stepName;
390 390
391 BuildbotProgressIndicator(Date startTime, bool printTiming) 391 BuildbotProgressIndicator(Date startTime, bool printTiming)
392 : super(startTime, printTiming); 392 : super(startTime, printTiming);
393 393
394 void _printStartProgress(TestCase test) { 394 void _printStartProgress(TestCase test) {
395 } 395 }
396 396
397 void _printDoneProgress(TestCase test) { 397 void _printDoneProgress(TestCase test) {
398 var status = 'pass'; 398 var status = 'pass';
399 if (test.output.unexpectedOutput) { 399 if (test.lastCommandOutput.unexpectedOutput) {
400 status = 'fail'; 400 status = 'fail';
401 } 401 }
402 var percent = ((_completedTests() / _foundTests) * 100).toInt().toString(); 402 var percent = ((_completedTests() / _foundTests) * 100).toInt().toString();
403 print('Done ${test.configurationString} ${test.displayName}: $status'); 403 print('Done ${test.configurationString} ${test.displayName}: $status');
404 print('@@@STEP_CLEAR@@@'); 404 print('@@@STEP_CLEAR@@@');
405 print('@@@STEP_TEXT@ $percent% +$_passedTests -$_failedTests @@@'); 405 print('@@@STEP_TEXT@ $percent% +$_passedTests -$_failedTests @@@');
406 } 406 }
407 407
408 void _printFailureSummary() { 408 void _printFailureSummary() {
409 if (!_failureSummary.isEmpty) { 409 if (!_failureSummary.isEmpty) {
410 print('@@@STEP_FAILURE@@@'); 410 print('@@@STEP_FAILURE@@@');
411 print('@@@BUILD_STEP $stepName failures@@@'); 411 print('@@@BUILD_STEP $stepName failures@@@');
412 } 412 }
413 super._printFailureSummary(); 413 super._printFailureSummary();
414 } 414 }
415 } 415 }
416 416
417 class DiffProgressIndicator extends ColorProgressIndicator { 417 class DiffProgressIndicator extends ColorProgressIndicator {
418 Map<String, List<String>> statusToConfigs = new Map<String, List<String>>(); 418 Map<String, List<String>> statusToConfigs = new Map<String, List<String>>();
419 419
420 DiffProgressIndicator(Date startTime, bool printTiming) 420 DiffProgressIndicator(Date startTime, bool printTiming)
421 : super(startTime, printTiming); 421 : super(startTime, printTiming);
422 422
423 void _printFailureOutput(TestCase test) { 423 void _printFailureOutput(TestCase test) {
424 String status = '${test.displayName}: ${test.output.result}'; 424 String status = '${test.displayName}: ${test.lastCommandOutput.result}';
425 List<String> configs = 425 List<String> configs =
426 statusToConfigs.putIfAbsent(status, () => <String>[]); 426 statusToConfigs.putIfAbsent(status, () => <String>[]);
427 configs.add(test.configurationString); 427 configs.add(test.configurationString);
428 if (test.output.hasTimedOut) { 428 if (test.lastCommandOutput.hasTimedOut) {
429 print('\n${test.displayName} timed out on ${test.configurationString}'); 429 print('\n${test.displayName} timed out on ${test.configurationString}');
430 } 430 }
431 } 431 }
432 432
433 String _extractRuntime(String configuration) { 433 String _extractRuntime(String configuration) {
434 // Extract runtime from a configuration, for example, 434 // Extract runtime from a configuration, for example,
435 // 'none-vm-checked release_ia32'. 435 // 'none-vm-checked release_ia32'.
436 List<String> runtime = configuration.split(' ')[0].split('-'); 436 List<String> runtime = configuration.split(' ')[0].split('-');
437 return '${runtime[0]}-${runtime[1]}'; 437 return '${runtime[0]}-${runtime[1]}';
438 } 438 }
(...skipping 23 matching lines...) Expand all
462 print(''); 462 print('');
463 print('$config:'); 463 print('$config:');
464 statuses.sort((a, b) => a.compareTo(b)); 464 statuses.sort((a, b) => a.compareTo(b));
465 for (String status in statuses) { 465 for (String status in statuses) {
466 print(' $status'); 466 print(' $status');
467 } 467 }
468 }); 468 });
469 _printStatus(); 469 _printStatus();
470 } 470 }
471 } 471 }
OLDNEW
« no previous file with comments | « tests/standalone/io/test_runner_test.dart ('k') | tools/testing/dart/test_runner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698