Skip to content

Commit 1374a41

Browse files
authored
Provide debug output for Gold uploads on post-submit (#45704)
1 parent e4b809b commit 1374a41

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

packages/flutter_goldens/lib/flutter_goldens.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import 'dart:async';
66
import 'dart:io' as io;
7+
import 'dart:math' as math;
78
import 'dart:typed_data';
89

910
import 'package:file/file.dart';
@@ -130,15 +131,15 @@ abstract class FlutterGoldenFileComparator extends GoldenFileComparator {
130131
/// Calculate the appropriate basedir for the current test context.
131132
@protected
132133
@visibleForTesting
133-
static Directory getBaseDirectory(LocalFileComparator defaultComparator, Platform platform) {
134+
static Directory getBaseDirectory(LocalFileComparator defaultComparator, Platform platform, {String suffix = ''}) {
134135
const FileSystem fs = LocalFileSystem();
135136
final Directory flutterRoot = fs.directory(platform.environment[_kFlutterRootKey]);
136137
final Directory comparisonRoot = flutterRoot.childDirectory(
137138
fs.path.join(
138139
'bin',
139140
'cache',
140141
'pkg',
141-
'skia_goldens',
142+
'skia_goldens$suffix',
142143
)
143144
);
144145
final Directory testDirectory = fs.directory(defaultComparator.basedir);
@@ -214,6 +215,7 @@ class FlutterSkiaGoldFileComparator extends FlutterGoldenFileComparator {
214215
final Directory baseDirectory = FlutterGoldenFileComparator.getBaseDirectory(
215216
defaultComparator,
216217
platform,
218+
suffix: '${math.Random().nextInt(10000)}',
217219
);
218220

219221
if(!baseDirectory.existsSync()) {

packages/flutter_goldens_client/lib/skia_client.dart

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,15 @@ class SkiaGoldClient {
121121
.path,
122122
];
123123

124-
await io.Process.run(
124+
final io.ProcessResult result = await io.Process.run(
125125
_goldctl,
126126
authArguments,
127127
);
128+
129+
if (result.exitCode != 0) {
130+
print('goldctl auth stdout: ${result.stdout}');
131+
print('goldctl auth stderr: ${result.stderr}');
132+
}
128133
}
129134

130135
/// Executes the `imgtest init` command in the goldctl tool.
@@ -158,10 +163,15 @@ class SkiaGoldClient {
158163
throw NonZeroExitCode(1, buf.toString());
159164
}
160165

161-
await io.Process.run(
166+
final io.ProcessResult result = await io.Process.run(
162167
_goldctl,
163168
imgtestInitArguments,
164169
);
170+
171+
if (result.exitCode != 0) {
172+
print('goldctl imgtest init stdout: ${result.stdout}');
173+
print('goldctl imgtest init stderr: ${result.stderr}');
174+
}
165175
}
166176

167177
/// Executes the `imgtest add` command in the goldctl tool.
@@ -186,10 +196,16 @@ class SkiaGoldClient {
186196
'--png-file', goldenFile.path,
187197
];
188198

189-
await io.Process.run(
199+
final io.ProcessResult result = await io.Process.run(
190200
_goldctl,
191201
imgtestArguments,
192202
);
203+
204+
if (result.exitCode != 0) {
205+
print('goldctl imgtest add stdout: ${result.stdout}');
206+
print('goldctl imgtest add stderr: ${result.stderr}');
207+
}
208+
193209
return true;
194210
}
195211

0 commit comments

Comments
 (0)