[CFE et al] Presubmit should give details of unexpected results

For instance before this CL one might just be told

```
1 failed:
lint/front_end/lib/src/fasta/type_inference/type_constraint_gatherer/ExplicitType: Fail
```

which isn't very actionable.

With this CL it will also print the error, giving something like

```
[...]/pkg/front_end/lib/src/fasta/type_inference/type_constraint_gatherer.dart:136:5: No explicit type.
    var isMatch = _isNullabilityObliviousSubtypeMatch(subtype, supertype);
    ^^^
1 failed:
lint/front_end/lib/src/fasta/type_inference/type_constraint_gatherer/ExplicitType: Fail
```

which is actually actionable.

Change-Id: I1e906a899b14678ae4f8625da6dc32d295a32ec6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352223
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
This commit is contained in:
Jens Johansen 2024-02-13 10:08:17 +00:00 committed by Commit Queue
parent 3d1f22a79b
commit b2815eeb60

View file

@ -195,17 +195,37 @@ class ErrorNotingLogger implements Logger {
@override
void logUncaughtError(error, StackTrace stackTrace) {
print("Uncaught Error: $error\n$stackTrace");
gotFailure = true;
}
// package:testing logs the result twice: As it happens and at the end.
// I don't want that so for now I'll maintain a set of already reported
// test results.
Set<testing.Result> alreadyReportedResults = {};
@override
void logUnexpectedResult(Suite suite, testing.TestDescription description,
testing.Result result, Set<testing.Expectation> expectedOutcomes) {
if (!alreadyReportedResults.add(result)) return;
String log = result.log;
if (log.isNotEmpty) {
print(log);
}
if (result.error != null) {
print(result.error);
if (result.trace != null) {
print(result.trace);
}
}
gotFailure = true;
}
@override
void noticeFrameworkCatchError(error, StackTrace stackTrace) {
print("Framework Catch Error: $error\n$StackTrace");
gotFailure = true;
}
}