Unverified Commit 4c0b5cce authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[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
parent b491f16d
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:convert'; import 'dart:convert';
import 'dart:ffi' show Abi;
import 'dart:io' as io; import 'dart:io' as io;
import 'package:crypto/crypto.dart'; import 'package:crypto/crypto.dart';
...@@ -49,8 +50,10 @@ class SkiaGoldClient { ...@@ -49,8 +50,10 @@ class SkiaGoldClient {
this.fs = const LocalFileSystem(), this.fs = const LocalFileSystem(),
this.process = const LocalProcessManager(), this.process = const LocalProcessManager(),
this.platform = const LocalPlatform(), this.platform = const LocalPlatform(),
Abi? abi,
io.HttpClient? httpClient, 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. /// The file system to use for storing the local clone of the repository.
/// ///
...@@ -74,6 +77,11 @@ class SkiaGoldClient { ...@@ -74,6 +77,11 @@ class SkiaGoldClient {
/// A client for making Http requests to the Flutter Gold dashboard. /// A client for making Http requests to the Flutter Gold dashboard.
final io.HttpClient httpClient; 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 /// The local [Directory] within the [comparisonRoot] for the current test
/// context. In this directory, the client will create image and JSON files /// context. In this directory, the client will create image and JSON files
/// for the goldctl tool to use. /// for the goldctl tool to use.
...@@ -489,6 +497,7 @@ class SkiaGoldClient { ...@@ -489,6 +497,7 @@ class SkiaGoldClient {
String _getKeysJSON() { String _getKeysJSON() {
final Map<String, dynamic> keys = <String, dynamic>{ final Map<String, dynamic> keys = <String, dynamic>{
'Platform' : platform.operatingSystem, 'Platform' : platform.operatingSystem,
'Abi': abi.toString(),
'CI' : 'luci', 'CI' : 'luci',
if (_isImpeller) if (_isImpeller)
'impeller': 'swiftshader', 'impeller': 'swiftshader',
...@@ -567,6 +576,7 @@ class SkiaGoldClient { ...@@ -567,6 +576,7 @@ class SkiaGoldClient {
'WebRenderer' : 'canvaskit', 'WebRenderer' : 'canvaskit',
'CI' : 'luci', 'CI' : 'luci',
'Platform' : platform.operatingSystem, 'Platform' : platform.operatingSystem,
'Abi': abi.toString(),
'name' : testName, 'name' : testName,
'source_type' : 'flutter', 'source_type' : 'flutter',
if (_isImpeller) if (_isImpeller)
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
// See also dev/automated_tests/flutter_test/flutter_gold_test.dart // See also dev/automated_tests/flutter_test/flutter_gold_test.dart
import 'dart:convert'; import 'dart:convert';
import 'dart:ffi' show Abi;
import 'dart:io' hide Directory; import 'dart:io' hide Directory;
import 'package:file/file.dart'; import 'package:file/file.dart';
...@@ -431,12 +432,13 @@ void main() { ...@@ -431,12 +432,13 @@ void main() {
process: process, process: process,
platform: platform, platform: platform,
httpClient: fakeHttpClient, httpClient: fakeHttpClient,
abi: Abi.linuxX64,
); );
traceID = skiaClient.getTraceID('flutter.golden.1'); traceID = skiaClient.getTraceID('flutter.golden.1');
expect( expect(
traceID, traceID,
equals('ae18c7a6aa48e0685525dfe8fdf79003'), equals('1937c1c93610cc0122a86a83d5bd38a4'),
); );
// Browser // Browser
...@@ -458,12 +460,13 @@ void main() { ...@@ -458,12 +460,13 @@ void main() {
process: process, process: process,
platform: platform, platform: platform,
httpClient: fakeHttpClient, httpClient: fakeHttpClient,
abi: Abi.linuxX64,
); );
traceID = skiaClient.getTraceID('flutter.golden.1'); traceID = skiaClient.getTraceID('flutter.golden.1');
expect( expect(
traceID, traceID,
equals('e9d5c296c48e7126808520e9cc191243'), equals('bc44a50c01eb3bbaf72a80d76c1c2305'),
); );
// Locally - should defer to luci traceID // Locally - should defer to luci traceID
...@@ -480,12 +483,13 @@ void main() { ...@@ -480,12 +483,13 @@ void main() {
process: process, process: process,
platform: platform, platform: platform,
httpClient: fakeHttpClient, httpClient: fakeHttpClient,
abi: Abi.linuxX64,
); );
traceID = skiaClient.getTraceID('flutter.golden.1'); traceID = skiaClient.getTraceID('flutter.golden.1');
expect( expect(
traceID, traceID,
equals('9968695b9ae78cdb77cbb2be621ca2d6'), equals('8821f4896801fcdd7cd6d30f5a8e4284'),
); );
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment