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

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, 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
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 23 matching lines...) Expand all
34 case 'diff': 34 case 'diff':
35 return new DiffProgressIndicator(startTime, printTiming); 35 return new DiffProgressIndicator(startTime, printTiming);
36 default: 36 default:
37 assert(false); 37 assert(false);
38 break; 38 break;
39 } 39 }
40 } 40 }
41 41
42 void testAdded() { _foundTests++; } 42 void testAdded() { _foundTests++; }
43 43
44 void skippedCompilation() { _skippedCompilations++; }
Bill Hesse 2012/11/14 09:37:34 Maybe compilationSkipped is a better name (just fo
kustermann 2012/11/16 14:58:42 CommandOutput contains now a compilationSkipped fi
45
44 void start(TestCase test) { 46 void start(TestCase test) {
45 _printStartProgress(test); 47 _printStartProgress(test);
46 } 48 }
47 49
48 void done(TestCase test) { 50 void done(TestCase test) {
49 if (test.isFlaky && test.output.result != PASS) { 51 if (test.isFlaky && test.output.result != PASS) {
50 var buf = new StringBuffer(); 52 var buf = new StringBuffer();
51 for (var l in _buildFailureOutput(test)) { 53 for (var l in _buildFailureOutput(test)) {
52 buf.add("$l\n"); 54 buf.add("$l\n");
53 } 55 }
(...skipping 10 matching lines...) Expand all
64 // If we need to print timing information we hold on to all completed 66 // If we need to print timing information we hold on to all completed
65 // tests. 67 // tests.
66 if (_printTiming) _tests.add(test); 68 if (_printTiming) _tests.add(test);
67 } 69 }
68 70
69 void allTestsKnown() { 71 void allTestsKnown() {
70 if (!_allTestsKnown) SummaryReport.printReport(); 72 if (!_allTestsKnown) SummaryReport.printReport();
71 _allTestsKnown = true; 73 _allTestsKnown = true;
72 } 74 }
73 75
76 void _printSkippedCompilationInfo() {
77 if (_skippedCompilations > 0) {
78 print('\n$_skippedCompilations dart2js compilations were skipped because '
ricow1 2012/11/14 08:53:28 I think you should make the text a little more gen
kustermann 2012/11/16 14:58:42 Done.
79 'the previous output was already up to date\n');
ahe 2012/11/14 18:46:16 I would try to make this text shorter, for example
kustermann 2012/11/16 14:58:42 I think the current message is more descriptive. (
80 }
81 }
82
74 void _printTimingInformation() { 83 void _printTimingInformation() {
75 if (_printTiming) { 84 if (_printTiming) {
76 Duration d = (new Date.now()).difference(_startTime); 85 Duration d = (new Date.now()).difference(_startTime);
77 print('\n--- Total time: ${_timeString(d)} ---'); 86 print('\n--- Total time: ${_timeString(d)} ---');
78 _tests.sort((a, b) { 87 _tests.sort((a, b) {
79 Duration aDuration = a.output.time; 88 Duration aDuration = a.output.time;
80 Duration bDuration = b.output.time; 89 Duration bDuration = b.output.time;
81 return bDuration.inMilliseconds - aDuration.inMilliseconds; 90 return bDuration.inMilliseconds - aDuration.inMilliseconds;
82 }); 91 });
83 for (int i = 0; i < 20 && i < _tests.length; i++) { 92 for (int i = 0; i < 20 && i < _tests.length; i++) {
84 var name = _tests[i].displayName; 93 var name = _tests[i].displayName;
85 var duration = _tests[i].output.time; 94 var duration = _tests[i].output.time;
86 var configuration = _tests[i].configurationString; 95 var configuration = _tests[i].configurationString;
87 print('${duration} - $configuration $name'); 96 print('${duration} - $configuration $name');
88 } 97 }
89 } 98 }
90 } 99 }
91 100
92 void allDone() { 101 void allDone() {
93 _printFailureSummary(); 102 _printFailureSummary();
94 _printStatus(); 103 _printStatus();
104 _printSkippedCompilationInfo();
Bill Hesse 2012/11/14 09:37:34 In the long run, we may not want to print this out
ricow1 2012/11/14 09:47:32 I really think we should, at least have a flag tha
kustermann 2012/11/16 14:58:42 We could make it depend on '--report' but the Prog
95 _printTimingInformation(); 105 _printTimingInformation();
96 stdout.close(); 106 stdout.close();
97 stderr.close(); 107 stderr.close();
98 if (_failedTests > 0) exit(1); 108 if (_failedTests > 0) exit(1);
99 } 109 }
100 110
101 void _printStartProgress(TestCase test) {} 111 void _printStartProgress(TestCase test) {}
102 void _printDoneProgress(TestCase test) {} 112 void _printDoneProgress(TestCase test) {}
103 113
104 String _pad(String s, int length) { 114 String _pad(String s, int length) {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 fd.closeSync(); 227 fd.closeSync();
218 } 228 }
219 229
220 int get numFailedTests => _failedTests; 230 int get numFailedTests => _failedTests;
221 231
222 int _completedTests() => _passedTests + _failedTests; 232 int _completedTests() => _passedTests + _failedTests;
223 233
224 int _foundTests = 0; 234 int _foundTests = 0;
225 int _passedTests = 0; 235 int _passedTests = 0;
226 int _failedTests = 0; 236 int _failedTests = 0;
237 int _skippedCompilations = 0;
227 bool _allTestsKnown = false; 238 bool _allTestsKnown = false;
228 Date _startTime; 239 Date _startTime;
229 bool _printTiming; 240 bool _printTiming;
230 List<TestCase> _tests; 241 List<TestCase> _tests;
231 List<String> _failureSummary; 242 List<String> _failureSummary;
232 } 243 }
233 244
234 245
235 class SilentProgressIndicator extends ProgressIndicator { 246 class SilentProgressIndicator extends ProgressIndicator {
236 SilentProgressIndicator(Date startTime, bool printTiming) 247 SilentProgressIndicator(Date startTime, bool printTiming)
237 : super(startTime, printTiming); 248 : super(startTime, printTiming);
238 void testAdded() { } 249 void testAdded() { }
239 void start(TestCase test) { } 250 void start(TestCase test) { }
240 void done(TestCase test) { } 251 void done(TestCase test) { }
241 void _printStartProgress(TestCase test) { } 252 void _printStartProgress(TestCase test) { }
242 void _printDoneProgress(TestCase test) { } 253 void _printDoneProgress(TestCase test) { }
243 void allTestsKnown() { } 254 void allTestsKnown() { }
244 void allDone() { } 255 void allDone() { }
245 } 256 }
246 257
247 abstract class CompactIndicator extends ProgressIndicator { 258 abstract class CompactIndicator extends ProgressIndicator {
248 CompactIndicator(Date startTime, bool printTiming) 259 CompactIndicator(Date startTime, bool printTiming)
249 : super(startTime, printTiming); 260 : super(startTime, printTiming);
250 261
251 void allDone() { 262 void allDone() {
252 stdout.write('\n'.charCodes); 263 stdout.write('\n'.charCodes);
253 _printFailureSummary(); 264 _printFailureSummary();
265 _printSkippedCompilationInfo();
254 _printTimingInformation(); 266 _printTimingInformation();
255 if (_failedTests > 0) { 267 if (_failedTests > 0) {
256 // We may have printed many failure logs, so reprint the summary data. 268 // We may have printed many failure logs, so reprint the summary data.
257 _printProgress(); 269 _printProgress();
258 print(''); 270 print('');
259 } 271 }
260 stdout.close(); 272 stdout.close();
261 stderr.close(); 273 stderr.close();
262 if (_failedTests > 0) exit(1); 274 if (_failedTests > 0) exit(1);
263 } 275 }
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 print(''); 474 print('');
463 print('$config:'); 475 print('$config:');
464 statuses.sort((a, b) => a.compareTo(b)); 476 statuses.sort((a, b) => a.compareTo(b));
465 for (String status in statuses) { 477 for (String status in statuses) {
466 print(' $status'); 478 print(' $status');
467 } 479 }
468 }); 480 });
469 _printStatus(); 481 _printStatus();
470 } 482 }
471 } 483 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698