Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 6f7b939

Browse files
authored
Fail lazily when 1+ Skia gold comparions fail. (#51010)
(Speculative) fix for flutter/flutter#144238. @zanderso Could you review from a CLI angle? I realize this code is not great, but could I do something better here?
1 parent 249daf5 commit 6f7b939

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

testing/scenario_app/bin/run_android_tests.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ Future<void> _run({
157157
late final ServerSocket server;
158158
final List<Future<void>> pendingComparisons = <Future<void>>[];
159159
final List<Socket> pendingConnections = <Socket>[];
160+
int comparisonsFailed = 0;
160161
await step('Starting server...', () async {
161162
server = await ServerSocket.bind(InternetAddress.anyIPv4, _tcpPort);
162163
if (verbose) {
@@ -186,8 +187,9 @@ Future<void> _run({
186187
if (isSkiaGoldClientAvailable) {
187188
final Future<void> comparison = skiaGoldClient!
188189
.addImg(fileName, goldenFile, screenshotSize: screenshot.pixelCount)
189-
.catchError((dynamic err) {
190-
panic(<String>['skia gold comparison failed: $err']);
190+
.catchError((Object error) {
191+
logWarning('skia gold comparison failed: $error');
192+
comparisonsFailed++;
191193
});
192194
pendingComparisons.add(comparison);
193195
}
@@ -354,6 +356,8 @@ Future<void> _run({
354356
if (out.toString().contains('FAILURES!!!')) {
355357
stdout.write(out);
356358
panic(<String>['1 or more tests failed']);
359+
} else if (comparisonsFailed > 0) {
360+
panic(<String>['$comparisonsFailed Skia Gold comparisons failed']);
357361
}
358362
});
359363
} finally {

0 commit comments

Comments
 (0)