From 4c0b5ccebc8a5cb9056f4f94ed2922b4d2176b59 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Tue, 20 Feb 2024 13:06:01 -0800 Subject: [PATCH] [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 --- packages/flutter_goldens/lib/skia_client.dart | 12 +++++++++++- .../flutter_goldens/test/flutter_goldens_test.dart | 10 +++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/packages/flutter_goldens/lib/skia_client.dart b/packages/flutter_goldens/lib/skia_client.dart index e4169a48b42..67d50ccde1a 100644 --- a/packages/flutter_goldens/lib/skia_client.dart +++ b/packages/flutter_goldens/lib/skia_client.dart @@ -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 keys = { '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) diff --git a/packages/flutter_goldens/test/flutter_goldens_test.dart b/packages/flutter_goldens/test/flutter_goldens_test.dart index 601d4540313..27e7f7d5385 100644 --- a/packages/flutter_goldens/test/flutter_goldens_test.dart +++ b/packages/flutter_goldens/test/flutter_goldens_test.dart @@ -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'), ); });