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

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

Issue 15740034: Print output of all commands if a testcase failed (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 months 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 | « no previous file | no next file » | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "dart:io" as io; 8 import "dart:io" as io;
9 import "http_server.dart" as http_server; 9 import "http_server.dart" as http_server;
10 import "status_file_parser.dart"; 10 import "status_file_parser.dart";
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 output.add('Unexpected compile-time error.'); 83 output.add('Unexpected compile-time error.');
84 } else { 84 } else {
85 if (test.info.hasCompileError) { 85 if (test.info.hasCompileError) {
86 output.add('Compile-time error expected.'); 86 output.add('Compile-time error expected.');
87 } 87 }
88 if (test.info.hasRuntimeError) { 88 if (test.info.hasRuntimeError) {
89 output.add('Runtime error expected.'); 89 output.add('Runtime error expected.');
90 } 90 }
91 } 91 }
92 } 92 }
93 if (!test.lastCommandOutput.diagnostics.isEmpty) { 93 for (var i = 0; i < test.commands.length; i++) {
94 String prefix = 'diagnostics:'; 94 var command = test.commands[i];
95 for (var s in test.lastCommandOutput.diagnostics) { 95 var commandOutput = test.commandOutputs[command];
96 output.add('$prefix ${s}'); 96 if (commandOutput != null) {
97 prefix = ' '; 97 output.add("CommandOutput[$i]:");
kustermann 2013/05/30 13:03:34 Do we want to print this always or just if there w
ricow1 2013/05/30 13:14:10 Always
98 if (!commandOutput.diagnostics.isEmpty) {
99 String prefix = 'diagnostics:';
100 for (var s in commandOutput.diagnostics) {
101 output.add('$prefix ${s}');
102 prefix = ' ';
103 }
104 }
105 if (!commandOutput.stdout.isEmpty) {
106 output.add('');
107 output.add('stdout:');
108 if (command.isPixelTest) {
109 output.add('DRT pixel test failed! stdout is not printed because it '
110 'contains binary data!');
111 } else {
112 output.addAll(getLinesWithoutCarriageReturn(commandOutput.stdout));
113 }
114 }
115 if (!commandOutput.stderr.isEmpty) {
116 output.add('');
117 output.add('stderr:');
118 output.addAll(getLinesWithoutCarriageReturn(commandOutput.stderr));
119 }
98 } 120 }
99 } 121 }
100 if (!test.lastCommandOutput.stdout.isEmpty) {
101 output.add('');
102 output.add('stdout:');
103 if (test.lastCommandOutput.command.isPixelTest) {
104 output.add('DRT pixel test failed! stdout is not printed because it '
105 'contains binary data!');
106 } else {
107 output.addAll(
108 getLinesWithoutCarriageReturn(test.lastCommandOutput.stdout));
109 }
110 }
111 if (!test.lastCommandOutput.stderr.isEmpty) {
112 output.add('');
113 output.add('stderr:');
114 output.addAll(getLinesWithoutCarriageReturn(test.lastCommandOutput.stderr));
115 }
116 if (test is BrowserTestCase) { 122 if (test is BrowserTestCase) {
117 // Additional command for rerunning the steps locally after the fact. 123 // Additional command for rerunning the steps locally after the fact.
118 var command = 124 var command =
119 test.configuration["_servers_"].httpServerCommandline(); 125 test.configuration["_servers_"].httpServerCommandline();
126 output.add('');
120 output.add('To retest, run: $command'); 127 output.add('To retest, run: $command');
121 } 128 }
122 for (Command c in test.commands) { 129 for (var i = 0; i < test.commands.length; i++) {
130 var command = test.commands[i];
123 output.add(''); 131 output.add('');
124 String message = (c == test.commands.last 132 output.add('Command[$i]: $command');
125 ? "Command line" : "Compilation command");
126 output.add('$message: $c');
127 } 133 }
128 return output; 134 return output;
129 } 135 }
130 136
131 String _buildSummaryEnd(int failedTests) { 137 String _buildSummaryEnd(int failedTests) {
132 if (failedTests == 0) { 138 if (failedTests == 0) {
133 return '\n===\n=== All tests succeeded\n===\n'; 139 return '\n===\n=== All tests succeeded\n===\n';
134 } else { 140 } else {
135 var pluralSuffix = failedTests != 1 ? 's' : ''; 141 var pluralSuffix = failedTests != 1 ? 's' : '';
136 return '\n===\n=== ${failedTests} test$pluralSuffix failed\n===\n'; 142 return '\n===\n=== ${failedTests} test$pluralSuffix failed\n===\n';
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 print('@@@BUILD_STEP $stepName failures@@@'); 520 print('@@@BUILD_STEP $stepName failures@@@');
515 } 521 }
516 for (String line in _failureSummary) { 522 for (String line in _failureSummary) {
517 print(line); 523 print(line);
518 } 524 }
519 print(''); 525 print('');
520 } 526 }
521 print(_buildSummaryEnd(_failedTests)); 527 print(_buildSummaryEnd(_failedTests));
522 } 528 }
523 } 529 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698