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

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

Issue 11369216: Added support for skipping redundant dart2js compilations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 } 46 }
47 47
48 void done(TestCase test) { 48 void done(TestCase test) {
49 if (test.isFlaky && test.lastCommandOutput.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 for (var commandOutput in test.commandOutputs.values) {
57 if (commandOutput.compilationSkipped)
58 _skippedCompilations++;
59 }
56 60
57 if (test.lastCommandOutput.unexpectedOutput) { 61 if (test.lastCommandOutput.unexpectedOutput) {
58 _failedTests++; 62 _failedTests++;
59 _printFailureOutput(test); 63 _printFailureOutput(test);
60 } else { 64 } else {
61 _passedTests++; 65 _passedTests++;
62 } 66 }
63 _printDoneProgress(test); 67 _printDoneProgress(test);
64 // If we need to print timing information we hold on to all completed 68 // If we need to print timing information we hold on to all completed
65 // tests. 69 // tests.
66 if (_printTiming) _tests.add(test); 70 if (_printTiming) _tests.add(test);
67 } 71 }
68 72
69 void allTestsKnown() { 73 void allTestsKnown() {
70 if (!_allTestsKnown) SummaryReport.printReport(); 74 if (!_allTestsKnown) SummaryReport.printReport();
71 _allTestsKnown = true; 75 _allTestsKnown = true;
72 } 76 }
73 77
78 void _printSkippedCompilationInfo() {
79 if (_skippedCompilations > 0) {
80 print('\n$_skippedCompilations compilations were skipped because '
81 'the previous output was already up to date\n');
82 }
83 }
84
74 void _printTimingInformation() { 85 void _printTimingInformation() {
75 if (_printTiming) { 86 if (_printTiming) {
76 // TODO: We should take all the commands into account 87 // TODO: We should take all the commands into account
77 Duration d = (new Date.now()).difference(_startTime); 88 Duration d = (new Date.now()).difference(_startTime);
78 print('\n--- Total time: ${_timeString(d)} ---'); 89 print('\n--- Total time: ${_timeString(d)} ---');
79 _tests.sort((a, b) { 90 _tests.sort((a, b) {
80 Duration aDuration = a.lastCommandOutput.time; 91 Duration aDuration = a.lastCommandOutput.time;
81 Duration bDuration = b.lastCommandOutput.time; 92 Duration bDuration = b.lastCommandOutput.time;
82 return bDuration.inMilliseconds - aDuration.inMilliseconds; 93 return bDuration.inMilliseconds - aDuration.inMilliseconds;
83 }); 94 });
84 for (int i = 0; i < 20 && i < _tests.length; i++) { 95 for (int i = 0; i < 20 && i < _tests.length; i++) {
85 var name = _tests[i].displayName; 96 var name = _tests[i].displayName;
86 var duration = _tests[i].lastCommandOutput.time; 97 var duration = _tests[i].lastCommandOutput.time;
87 var configuration = _tests[i].configurationString; 98 var configuration = _tests[i].configurationString;
88 print('${duration} - $configuration $name'); 99 print('${duration} - $configuration $name');
89 } 100 }
90 } 101 }
91 } 102 }
92 103
93 void allDone() { 104 void allDone() {
94 _printFailureSummary(); 105 _printFailureSummary();
95 _printStatus(); 106 _printStatus();
107 _printSkippedCompilationInfo();
96 _printTimingInformation(); 108 _printTimingInformation();
97 stdout.close(); 109 stdout.close();
98 stderr.close(); 110 stderr.close();
99 if (_failedTests > 0) exit(1); 111 if (_failedTests > 0) exit(1);
100 } 112 }
101 113
102 void _printStartProgress(TestCase test) {} 114 void _printStartProgress(TestCase test) {}
103 void _printDoneProgress(TestCase test) {} 115 void _printDoneProgress(TestCase test) {}
104 116
105 String _pad(String s, int length) { 117 String _pad(String s, int length) {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 fd.closeSync(); 230 fd.closeSync();
219 } 231 }
220 232
221 int get numFailedTests => _failedTests; 233 int get numFailedTests => _failedTests;
222 234
223 int _completedTests() => _passedTests + _failedTests; 235 int _completedTests() => _passedTests + _failedTests;
224 236
225 int _foundTests = 0; 237 int _foundTests = 0;
226 int _passedTests = 0; 238 int _passedTests = 0;
227 int _failedTests = 0; 239 int _failedTests = 0;
240 int _skippedCompilations = 0;
228 bool _allTestsKnown = false; 241 bool _allTestsKnown = false;
229 Date _startTime; 242 Date _startTime;
230 bool _printTiming; 243 bool _printTiming;
231 List<TestCase> _tests; 244 List<TestCase> _tests;
232 List<String> _failureSummary; 245 List<String> _failureSummary;
233 } 246 }
234 247
235 248
236 class SilentProgressIndicator extends ProgressIndicator { 249 class SilentProgressIndicator extends ProgressIndicator {
237 SilentProgressIndicator(Date startTime, bool printTiming) 250 SilentProgressIndicator(Date startTime, bool printTiming)
238 : super(startTime, printTiming); 251 : super(startTime, printTiming);
239 void testAdded() { } 252 void testAdded() { }
240 void start(TestCase test) { } 253 void start(TestCase test) { }
241 void done(TestCase test) { } 254 void done(TestCase test) { }
242 void _printStartProgress(TestCase test) { } 255 void _printStartProgress(TestCase test) { }
243 void _printDoneProgress(TestCase test) { } 256 void _printDoneProgress(TestCase test) { }
244 void allTestsKnown() { } 257 void allTestsKnown() { }
245 void allDone() { } 258 void allDone() { }
246 } 259 }
247 260
248 abstract class CompactIndicator extends ProgressIndicator { 261 abstract class CompactIndicator extends ProgressIndicator {
249 CompactIndicator(Date startTime, bool printTiming) 262 CompactIndicator(Date startTime, bool printTiming)
250 : super(startTime, printTiming); 263 : super(startTime, printTiming);
251 264
252 void allDone() { 265 void allDone() {
253 stdout.write('\n'.charCodes); 266 stdout.write('\n'.charCodes);
254 _printFailureSummary(); 267 _printFailureSummary();
268 _printSkippedCompilationInfo();
255 _printTimingInformation(); 269 _printTimingInformation();
256 if (_failedTests > 0) { 270 if (_failedTests > 0) {
257 // We may have printed many failure logs, so reprint the summary data. 271 // We may have printed many failure logs, so reprint the summary data.
258 _printProgress(); 272 _printProgress();
259 print(''); 273 print('');
260 } 274 }
261 stdout.close(); 275 stdout.close();
262 stderr.close(); 276 stderr.close();
263 if (_failedTests > 0) exit(1); 277 if (_failedTests > 0) exit(1);
264 } 278 }
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 print(''); 477 print('');
464 print('$config:'); 478 print('$config:');
465 statuses.sort((a, b) => a.compareTo(b)); 479 statuses.sort((a, b) => a.compareTo(b));
466 for (String status in statuses) { 480 for (String status in statuses) {
467 print(' $status'); 481 print(' $status');
468 } 482 }
469 }); 483 });
470 _printStatus(); 484 _printStatus();
471 } 485 }
472 } 486 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698