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

Unified Diff: tools/testing/dart/test_progress.dart

Issue 11364129: Added support for logging the output of failed flaky tests. (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 side-by-side diff with in-line comments
Download patch
Index: tools/testing/dart/test_progress.dart
diff --git a/tools/testing/dart/test_progress.dart b/tools/testing/dart/test_progress.dart
index 44c94c8d287cf3d07e3e627c1eeb48df2b06860e..b8325c0f1a03388b8186b76a213589eccff3701f 100644
--- a/tools/testing/dart/test_progress.dart
+++ b/tools/testing/dart/test_progress.dart
@@ -7,6 +7,9 @@
#import("dart:io");
#import("test_runner.dart");
#import("test_suite.dart");
+#import("status_file_parser.dart");
+
+const FAILED_FLAKY_TESTS_LOGFILE = ".flaky.log";
ricow1 2012/11/08 09:49:13 Add comment stating explicitly what this is used f
kustermann 2012/11/08 10:24:41 Done.
class ProgressIndicator {
ProgressIndicator(this._startTime, this._printTiming)
@@ -45,6 +48,14 @@ class ProgressIndicator {
}
void done(TestCase test) {
+ if (test.isFlaky && test.output.result != PASS) {
+ var buf = new StringBuffer();
+ for (var l in _buildFailureOutput(test)) {
ricow1 2012/11/08 09:49:13 alternatively some thing like var buf = _buildFail
kustermann 2012/11/08 10:24:41 I think that this would not improve readability.
+ buf.add("${l}\n");
+ }
+ _appendToFlakyFile(buf.toString());
+ }
+
if (test.output.unexpectedOutput) {
_failedTests++;
_printFailureOutput(test);
@@ -120,6 +131,16 @@ class ProgressIndicator {
String _header(String header) => header;
void _printFailureOutput(TestCase test) {
+ var failureOutput = _buildFailureOutput(test);
+
+ for (var line in failureOutput) {
+ print(line);
+ }
+
ricow1 2012/11/08 09:49:13 remove whitespaces
kustermann 2012/11/08 10:24:41 Done.
+ _failureSummary.addAll(failureOutput);
+ }
+
ricow1 2012/11/08 09:49:13 remove whitespaces
kustermann 2012/11/08 10:24:41 Done.
+ List<String> _buildFailureOutput(TestCase test) {
List<String> output = new List<String>();
output.add('');
output.add(_header('FAILED: ${test.configurationString}'
@@ -170,10 +191,7 @@ class ProgressIndicator {
? "Command line" : "Compilation command");
output.add('$message: ${c.commandLine}');
}
- for (String line in output) {
- print(line);
- }
- _failureSummary.addAll(output);
+ return output;
}
void _printFailureSummary() {
@@ -196,6 +214,13 @@ class ProgressIndicator {
}
}
+ void _appendToFlakyFile(String msg) {
+ var file = new File(FAILED_FLAKY_TESTS_LOGFILE);
+ var fd = file.openSync(FileMode.APPEND);
+ fd.writeStringSync(msg);
+ fd.closeSync();
+ }
+
int get numFailedTests => _failedTests;
int _completedTests() => _passedTests + _failedTests;

Powered by Google App Engine
This is Rietveld 408576698