[gold] Always provide host ABI to gold config (#143621)

This can help us split goldens that are different due to arm non-arm mac, et cetera.

Part of https://github.com/flutter/flutter/issues/143616
This commit is contained in:
Jonah Williams 2024-02-20 13:06:01 -08:00 committed by GitHub
parent b491f16d9c
commit 4c0b5ccebc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 4 deletions

View file

@ -3,6 +3,7 @@
// found in the LICENSE file.
import 'dart:convert';
import 'dart:ffi' show Abi;
import 'dart:io' as io;
import 'package:crypto/crypto.dart';
@ -49,8 +50,10 @@ class SkiaGoldClient {
this.fs = const LocalFileSystem(),
this.process = const LocalProcessManager(),
this.platform = const LocalPlatform(),
Abi? abi,
io.HttpClient? httpClient,
}) : httpClient = httpClient ?? io.HttpClient();
}) : httpClient = httpClient ?? io.HttpClient(),
abi = abi ?? Abi.current();
/// The file system to use for storing the local clone of the repository.
///
@ -74,6 +77,11 @@ class SkiaGoldClient {
/// A client for making Http requests to the Flutter Gold dashboard.
final io.HttpClient httpClient;
/// The ABI of the current host platform.
///
/// If not overriden for testing, defaults to [Abi.current];
final Abi abi;
/// The local [Directory] within the [comparisonRoot] for the current test
/// context. In this directory, the client will create image and JSON files
/// for the goldctl tool to use.
@ -489,6 +497,7 @@ class SkiaGoldClient {
String _getKeysJSON() {
final Map<String, dynamic> keys = <String, dynamic>{
'Platform' : platform.operatingSystem,
'Abi': abi.toString(),
'CI' : 'luci',
if (_isImpeller)
'impeller': 'swiftshader',
@ -567,6 +576,7 @@ class SkiaGoldClient {
'WebRenderer' : 'canvaskit',
'CI' : 'luci',
'Platform' : platform.operatingSystem,
'Abi': abi.toString(),
'name' : testName,
'source_type' : 'flutter',
if (_isImpeller)

View file

@ -5,6 +5,7 @@
// See also dev/automated_tests/flutter_test/flutter_gold_test.dart
import 'dart:convert';
import 'dart:ffi' show Abi;
import 'dart:io' hide Directory;
import 'package:file/file.dart';
@ -431,12 +432,13 @@ void main() {
process: process,
platform: platform,
httpClient: fakeHttpClient,
abi: Abi.linuxX64,
);
traceID = skiaClient.getTraceID('flutter.golden.1');
expect(
traceID,
equals('ae18c7a6aa48e0685525dfe8fdf79003'),
equals('1937c1c93610cc0122a86a83d5bd38a4'),
);
// Browser
@ -458,12 +460,13 @@ void main() {
process: process,
platform: platform,
httpClient: fakeHttpClient,
abi: Abi.linuxX64,
);
traceID = skiaClient.getTraceID('flutter.golden.1');
expect(
traceID,
equals('e9d5c296c48e7126808520e9cc191243'),
equals('bc44a50c01eb3bbaf72a80d76c1c2305'),
);
// Locally - should defer to luci traceID
@ -480,12 +483,13 @@ void main() {
process: process,
platform: platform,
httpClient: fakeHttpClient,
abi: Abi.linuxX64,
);
traceID = skiaClient.getTraceID('flutter.golden.1');
expect(
traceID,
equals('9968695b9ae78cdb77cbb2be621ca2d6'),
equals('8821f4896801fcdd7cd6d30f5a8e4284'),
);
});