mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 03:17:55 +00:00
add error message as a comment on the logs
BUG= Review-Url: https://codereview.chromium.org/2996543002 .
This commit is contained in:
parent
5241f37143
commit
06a929434e
|
@ -14,6 +14,7 @@ List<Record> parse(String log) {
|
|||
var config;
|
||||
var expected;
|
||||
var actual;
|
||||
var reason;
|
||||
bool reproIsNext = false;
|
||||
for (var line in log.split('\n')) {
|
||||
if (line.startsWith("FAILED: ")) {
|
||||
|
@ -36,10 +37,13 @@ List<Record> parse(String log) {
|
|||
if (line.startsWith("Actual: ")) {
|
||||
actual = line.substring("Actual: ".length).trim();
|
||||
}
|
||||
if (line.startsWith("The compiler crashed:")) {
|
||||
reason = line.substring("The compiler crashed:".length).trim();
|
||||
}
|
||||
if (reproIsNext) {
|
||||
records
|
||||
.add(new Record(suite, test, config, expected, actual, line.trim()));
|
||||
suite = test = config = expected = actual = null;
|
||||
records.add(new Record(
|
||||
suite, test, config, expected, actual, reason, line.trim()));
|
||||
suite = test = config = expected = actual = reason = null;
|
||||
reproIsNext = false;
|
||||
}
|
||||
if (line.startsWith("Short reproduction command (experimental):")) {
|
||||
|
|
|
@ -14,6 +14,7 @@ class Record implements Comparable<Record> {
|
|||
final String expected;
|
||||
final String actual;
|
||||
final String repro;
|
||||
final String reason;
|
||||
|
||||
// TODO(sigmund): extract also a failure reason if any (e.g. a stack trace or
|
||||
// error message for crashes).
|
||||
|
@ -21,7 +22,7 @@ class Record implements Comparable<Record> {
|
|||
bool get isPassing => actual == 'Pass';
|
||||
|
||||
Record(this.suite, this.test, this.config, this.expected, this.actual,
|
||||
this.repro);
|
||||
this.reason, this.repro);
|
||||
|
||||
int compareTo(Record other) {
|
||||
if (suite == null && other.suite != null) return -1;
|
||||
|
|
|
@ -83,8 +83,9 @@ void updateLogs(String mode, String log) {
|
|||
class ExistingEntry {
|
||||
final String test;
|
||||
final String status;
|
||||
final bool hasComment;
|
||||
|
||||
ExistingEntry(this.test, this.status);
|
||||
ExistingEntry(this.test, this.status, this.hasComment);
|
||||
|
||||
static parse(String line) {
|
||||
var colonIndex = line.indexOf(':');
|
||||
|
@ -94,7 +95,7 @@ class ExistingEntry {
|
|||
if (commentIndex != -1) {
|
||||
status = status.substring(0, commentIndex);
|
||||
}
|
||||
return new ExistingEntry(test, status);
|
||||
return new ExistingEntry(test, status, commentIndex != -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,7 +134,8 @@ class ConfigurationInSuiteSection {
|
|||
var newContents = new StringBuffer();
|
||||
newContents.write(_contents.substring(0, _begin));
|
||||
addFromRecord(Record record) {
|
||||
newContents.writeln('${record.test}: ${record.actual}');
|
||||
var comment = record.reason != null ? ' # ${record.reason}' : '';
|
||||
newContents.writeln('${record.test}: ${record.actual}$comment');
|
||||
}
|
||||
|
||||
int i = 0, j = 0;
|
||||
|
@ -162,9 +164,14 @@ class ConfigurationInSuiteSection {
|
|||
}
|
||||
j++;
|
||||
} else if (existing.status == record.actual) {
|
||||
if (!existing.hasComment && record.reason != null) {
|
||||
addFromRecord(record);
|
||||
changes++;
|
||||
} else {
|
||||
// This also should only happen if the patching has already been done.
|
||||
// We don't complain to make this script idempotent.
|
||||
newContents.writeln(existingLine);
|
||||
}
|
||||
ignored++;
|
||||
i++;
|
||||
j++;
|
||||
|
|
Loading…
Reference in a new issue