Unverified Commit 35903620 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Add impeller key to skia gold client, Turn on a framework test shard that will...

Add impeller key to skia gold client, Turn on a framework test shard that will run unit tests with --enable-impeller (#141341)

Redo of https://github.com/flutter/flutter/pull/140985 due to CLA issues.
parent 9f2e681e
......@@ -3338,6 +3338,33 @@ targets:
- bin/**
- .ci.yaml
- name: Mac framework_tests_impeller
recipe: flutter/flutter_drone
timeout: 60
bringup: true
properties:
cpu: x86 # https://github.com/flutter/flutter/issues/119880
dependencies: >-
[
{"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}
]
shard: framework_tests
subshard: impeller
tags: >
["framework", "hostonly", "shard", "mac"]
runIf:
- dev/**
- packages/flutter/**
- packages/flutter_driver/**
- packages/integration_test/**
- packages/flutter_localizations/**
- packages/fuchsia_remote_debug_protocol/**
- packages/flutter_test/**
- packages/flutter_goldens/**
- packages/flutter_tools/**
- bin/**
- .ci.yaml
- name: Mac framework_tests_misc
recipe: flutter/flutter_drone
timeout: 60
......
......@@ -815,6 +815,15 @@ Future<void> _runFrameworkTests() async {
);
}
Future<void> runImpeller() async {
printProgress('${green}Running packages/flutter tests $reset in Impeller$reset');
await _runFlutterTest(
path.join(flutterRoot, 'packages', 'flutter'),
options: <String>['--enable-impeller'],
);
}
Future<void> runLibraries() async {
final List<String> tests = Directory(path.join(flutterRoot, 'packages', 'flutter', 'test'))
.listSync(followLinks: false)
......@@ -1064,6 +1073,7 @@ Future<void> _runFrameworkTests() async {
'libraries': runLibraries,
'slow': runSlow,
'misc': runMisc,
'impeller': runImpeller,
});
}
......
......@@ -19,6 +19,7 @@ const String _kFlutterRootKey = 'FLUTTER_ROOT';
const String _kGoldctlKey = 'GOLDCTL';
const String _kTestBrowserKey = 'FLUTTER_TEST_BROWSER';
const String _kWebRendererKey = 'FLUTTER_WEB_RENDERER';
const String _kImpellerKey = 'FLUTTER_TEST_IMPELLER';
/// Signature of callbacks used to inject [print] replacements.
typedef LogCallback = void Function(String);
......@@ -535,6 +536,8 @@ class SkiaGoldClient {
final Map<String, dynamic> keys = <String, dynamic>{
'Platform' : platform.operatingSystem,
'CI' : 'luci',
if (_isImpeller)
'impeller': 'swiftshader',
};
if (_isBrowserTest) {
keys['Browser'] = _browserKey;
......@@ -590,6 +593,10 @@ class SkiaGoldClient {
return _isBrowserTest && platform.environment[_kWebRendererKey] == 'canvaskit';
}
bool get _isImpeller {
return (platform.environment[_kImpellerKey] != null);
}
String get _browserKey {
assert(_isBrowserTest);
return platform.environment[_kTestBrowserKey]!;
......@@ -599,7 +606,7 @@ class SkiaGoldClient {
/// the latest positive digest on Flutter Gold with a hex-encoded md5 hash of
/// the image keys.
String getTraceID(String testName) {
final Map<String, dynamic> keys = <String, dynamic>{
final Map<String, Object?> keys = <String, Object?>{
if (_isBrowserTest)
'Browser' : _browserKey,
if (_isBrowserCanvasKitTest)
......@@ -608,6 +615,8 @@ class SkiaGoldClient {
'Platform' : platform.operatingSystem,
'name' : testName,
'source_type' : 'flutter',
if (_isImpeller)
'impeller': 'swiftshader',
};
final String jsonTrace = json.encode(keys);
final String md5Sum = md5.convert(utf8.encode(jsonTrace)).toString();
......
......@@ -143,6 +143,8 @@ class FlutterTesterTestDevice extends TestDevice {
'FONTCONFIG_FILE': fontConfigManager.fontConfigFile.path,
'SERVER_PORT': _server!.port.toString(),
'APP_NAME': flutterProject?.manifest.appName ?? '',
if (debuggingOptions.enableImpeller == ImpellerStatus.enabled)
'FLUTTER_TEST_IMPELLER': 'true',
if (testAssetDirectory != null)
'UNIT_TEST_ASSETS': testAssetDirectory!,
};
......
......@@ -40,6 +40,7 @@ void main() {
FlutterTesterTestDevice createDevice({
List<String> dartEntrypointArgs = const <String>[],
bool enableVmService = false,
bool enableImpeller = false,
}) =>
TestFlutterTesterDevice(
platform: platform,
......@@ -48,6 +49,7 @@ void main() {
enableVmService: enableVmService,
dartEntrypointArgs: dartEntrypointArgs,
uriConverter: (String input) => '$input/converted',
enableImpeller: enableImpeller,
);
testUsingContext('Missing dir error caught for FontConfigManger.dispose', () async {
......@@ -62,6 +64,38 @@ void main() {
ProcessManager: () => processManager,
});
testUsingContext('Flutter tester passes through impeller config and environment variables.', () async {
processManager = FakeProcessManager.list(<FakeCommand>[]);
device = createDevice(enableImpeller: true);
processManager.addCommand(FakeCommand(command: const <String>[
'/',
'--disable-vm-service',
'--ipv6',
'--enable-checked-mode',
'--verify-entry-points',
'--enable-impeller',
'--enable-dart-profiling',
'--non-interactive',
'--use-test-fonts',
'--disable-asset-fonts',
'--packages=.dart_tool/package_config.json',
'example.dill',
], environment: <String, String>{
'FLUTTER_TEST': 'true',
'FONTCONFIG_FILE': device.fontConfigManager.fontConfigFile.path,
'SERVER_PORT': '0',
'APP_NAME': '',
'FLUTTER_TEST_IMPELLER': 'true',
}));
await device.start('example.dill');
expect(processManager, hasNoRemainingExpectations);
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
});
group('The FLUTTER_TEST environment variable is passed to the test process', () {
setUp(() {
processManager = FakeProcessManager.list(<FakeCommand>[]);
......@@ -222,6 +256,7 @@ class TestFlutterTesterDevice extends FlutterTesterTestDevice {
required super.enableVmService,
required List<String> dartEntrypointArgs,
required UriConverter uriConverter,
required bool enableImpeller,
}) : super(
id: 999,
shellPath: '/',
......@@ -234,6 +269,7 @@ class TestFlutterTesterDevice extends FlutterTesterTestDevice {
),
hostVmServicePort: 1234,
dartEntrypointArgs: dartEntrypointArgs,
enableImpeller: enableImpeller ? ImpellerStatus.enabled : ImpellerStatus.platformDefault,
),
machine: false,
host: InternetAddress.loopbackIPv6,
......
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