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

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..e471acc06dd8166236adfe9085235ae232eb3f84 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 = "failed_flaky_tests.log";
class ProgressIndicator {
ProgressIndicator(this._startTime, this._printTiming)
@@ -45,6 +48,23 @@ class ProgressIndicator {
}
void done(TestCase test) {
+ if (test.isExpectedToBeFlaky() && test.output.result != PASS) {
+ var report = new StringBuffer();
ricow1 2012/11/07 19:56:51 extract the body of this conditional into a separa
kustermann 2012/11/08 09:15:13 I refactored this instead
+ report.add("Flaky test ${test.displayName} failed: \n");
ricow1 2012/11/07 19:56:51 How about refactoring _printFailureOutput to call
kustermann 2012/11/08 09:15:13 Done.
+ report.add("--------------------------------------------------\n");
+ report.add("stdout of ${test.displayName} was:\n");
+ for (var s in test.output.stdout) {
+ report.add(" $s\n");
+ }
+ report.add("\n");
+ report.add("stderr of ${test.displayName} was:\n");
+ for (var s in test.output.stderr) {
+ report.add(" $s\n");
+ }
+ report.add("\n\n");
+ appendToFlakyFile(report.toString());
+ }
+
if (test.output.unexpectedOutput) {
_failedTests++;
_printFailureOutput(test);
@@ -196,6 +216,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