Skip to content

Commit 0c2d316

Browse files
authored
Adds impeller backend to skia gold client (flutter#181503)
flutter@1418863 made dart tests run against metal as well as vulkan. At the time there was no reported error. I suspect the vulkan and metal results are clobbering each other though since the backend was not part of the dimensions. test exempt: is test ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
1 parent f9d489f commit 0c2d316

3 files changed

Lines changed: 25 additions & 3 deletions

File tree

engine/src/flutter/testing/dart/goldens.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ class ImageComparer {
3333
final workDirectory = Directory(
3434
impellerEnabled ? '${workDirectoryPath}_iplr' : workDirectoryPath,
3535
)..createSync();
36-
final dimensions = <String, String>{'impeller_enabled': impellerEnabled.toString()};
36+
final dimensions = <String, String>{
37+
'impeller_enabled': impellerEnabled.toString(),
38+
'impeller_backend': impellerBackend ?? 'none',
39+
};
3740
final SkiaGoldClient client = SkiaGoldClient.isAvailable() && _useSkiaGold
3841
? SkiaGoldClient(workDirectory, dimensions: dimensions, verbose: verbose)
3942
: _FakeSkiaGoldClient(workDirectory, dimensions, verbose: verbose);

engine/src/flutter/testing/dart/impeller_enabled.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,19 @@
55
import 'dart:io';
66

77
bool get impellerEnabled => Platform.executableArguments.contains('--enable-impeller');
8+
9+
String? get impellerBackend {
10+
if (!impellerEnabled) {
11+
return null;
12+
}
13+
const backendFlag = '--impeller-backend=';
14+
for (final String arg in Platform.executableArguments) {
15+
if (arg.startsWith(backendFlag)) {
16+
return arg.substring(backendFlag.length);
17+
}
18+
}
19+
if (Platform.isMacOS || Platform.isIOS) {
20+
return 'metal';
21+
}
22+
return 'vulkan';
23+
}

engine/src/flutter/testing/run_tests.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,9 @@ def gather_dart_tests(
929929
dart_vm_service_tests = glob.glob(f'{dart_tests_dir}/vm_service/*_test.dart')
930930
dart_tests = glob.glob(f'{dart_tests_dir}/*_test.dart')
931931

932+
impeller_backends = ['', 'vulkan']
933+
if is_mac():
934+
impeller_backends.append('metal')
932935
if 'release' not in build_dir:
933936
for dart_test_file in dart_vm_service_tests:
934937
dart_test_basename = os.path.basename(dart_test_file)
@@ -937,7 +940,7 @@ def gather_dart_tests(
937940
else:
938941
_logger.info("Gathering dart test '%s' with VM service enabled", dart_test_file)
939942
for multithreaded in [False, True]:
940-
for impeller in ['', 'vulkan', 'metal']:
943+
for impeller in impeller_backends:
941944
yield gather_dart_test(
942945
build_dir, dart_test_file,
943946
FlutterTesterOptions(
@@ -955,7 +958,7 @@ def gather_dart_tests(
955958
else:
956959
_logger.info("Gathering dart test '%s'", dart_test_file)
957960
for multithreaded in [False, True]:
958-
for impeller in ['', 'vulkan', 'metal']:
961+
for impeller in impeller_backends:
959962
yield gather_dart_test(
960963
build_dir, dart_test_file,
961964
FlutterTesterOptions(multithreaded=multithreaded, impeller_backend=impeller)

0 commit comments

Comments
 (0)