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 13521002: Remove \r in command stdout/stderr when building failure a failure output. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 String failed(String msg) => _color(msg, RED); 54 String failed(String msg) => _color(msg, RED);
55 55
56 static String _color(String msg, int color) { 56 static String _color(String msg, int color) {
57 return "$ESCAPE[${color}m$msg$ESCAPE[0m"; 57 return "$ESCAPE[${color}m$msg$ESCAPE[0m";
58 } 58 }
59 } 59 }
60 60
61 61
62 List<String> _buildFailureOutput(TestCase test, 62 List<String> _buildFailureOutput(TestCase test,
63 [Formatter formatter = const Formatter()]) { 63 [Formatter formatter = const Formatter()]) {
64
65 List<String> getLinesWithoutCarriageReturn(List<int> output) {
66 return decodeUtf8(output).replaceAll('\r\n', '\n')
67 .replaceAll('\r', '\n').split('\n');
68 }
69
64 List<String> output = new List<String>(); 70 List<String> output = new List<String>();
65 output.add(''); 71 output.add('');
66 output.add(formatter.failed('FAILED: ${test.configurationString}' 72 output.add(formatter.failed('FAILED: ${test.configurationString}'
67 ' ${test.displayName}')); 73 ' ${test.displayName}'));
68 StringBuffer expected = new StringBuffer(); 74 StringBuffer expected = new StringBuffer();
69 expected.write('Expected: '); 75 expected.write('Expected: ');
70 for (var expectation in test.expectedOutcomes) { 76 for (var expectation in test.expectedOutcomes) {
71 expected.write('$expectation '); 77 expected.write('$expectation ');
72 } 78 }
73 output.add(expected.toString()); 79 output.add(expected.toString());
(...skipping 17 matching lines...) Expand all
91 prefix = ' '; 97 prefix = ' ';
92 } 98 }
93 } 99 }
94 if (!test.lastCommandOutput.stdout.isEmpty) { 100 if (!test.lastCommandOutput.stdout.isEmpty) {
95 output.add(''); 101 output.add('');
96 output.add('stdout:'); 102 output.add('stdout:');
97 if (test.lastCommandOutput.command.isPixelTest) { 103 if (test.lastCommandOutput.command.isPixelTest) {
98 output.add('DRT pixel test failed! stdout is not printed because it ' 104 output.add('DRT pixel test failed! stdout is not printed because it '
99 'contains binary data!'); 105 'contains binary data!');
100 } else { 106 } else {
101 output.add(decodeUtf8(test.lastCommandOutput.stdout)); 107 output.addAll(
108 getLinesWithoutCarriageReturn(test.lastCommandOutput.stdout));
102 } 109 }
103 } 110 }
104 if (!test.lastCommandOutput.stderr.isEmpty) { 111 if (!test.lastCommandOutput.stderr.isEmpty) {
105 output.add(''); 112 output.add('');
106 output.add('stderr:'); 113 output.add('stderr:');
107 output.add(decodeUtf8(test.lastCommandOutput.stderr)); 114 output.addAll(getLinesWithoutCarriageReturn(test.lastCommandOutput.stderr));
108 } 115 }
109 if (test is BrowserTestCase) { 116 if (test is BrowserTestCase) {
110 // Additional command for rerunning the steps locally after the fact. 117 // Additional command for rerunning the steps locally after the fact.
111 var command = 118 var command =
112 test.configuration["_servers_"].httpServerCommandline(); 119 test.configuration["_servers_"].httpServerCommandline();
113 output.add('To retest, run: $command'); 120 output.add('To retest, run: $command');
114 } 121 }
115 for (Command c in test.commands) { 122 for (Command c in test.commands) {
116 output.add(''); 123 output.add('');
117 String message = (c == test.commands.last 124 String message = (c == test.commands.last
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 print('@@@BUILD_STEP $stepName failures@@@'); 517 print('@@@BUILD_STEP $stepName failures@@@');
511 } 518 }
512 for (String line in _failureSummary) { 519 for (String line in _failureSummary) {
513 print(line); 520 print(line);
514 } 521 }
515 print(''); 522 print('');
516 } 523 }
517 super.allDone(); 524 super.allDone();
518 } 525 }
519 } 526 }
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