Fix Android scenario_app to actually run and block on CI (flutter/engine#50414)

20337eaea4
(now reverted) intentionally re-introduced a bug
(https://github.com/flutter/engine/pull/49938) on a now working test
runner, and verified that (with some fixes in this PR), we can now catch
regressions on CI with SkiaGold:

---

<details>

<summary>ExternalTextureTests_testCanvasSurface.png</summary>

This test shows that what previously was a picture has been reduced down
to a single stretched pixel.

**BEFORE**:


![ExternalTextureTests_testCanvasSurface](https://github.com/flutter/engine/assets/168174/1509ea21-2887-4a3b-b200-b857bbfb8304)

**AFTER**:


![ExternalTextureTests_testCanvasSurface](https://github.com/flutter/engine/assets/168174/d9ae19c8-dd39-4e7f-859c-5d82bd1ba0a3)

</details>

<details>

<summary>ExternalTextureTests_testRotatedMediaSurface_180.png</summary>

Similar to above, but shows _another_ bug (kClamp versus kRepeat)

**BEFORE**:


![ExternalTextureTests_testRotatedMediaSurface_180](https://github.com/flutter/engine/assets/168174/fee5bc8d-749f-4a59-976a-a573515fecea)

**AFTER**:


![ExternalTextureTests_testRotatedMediaSurface_180](https://github.com/flutter/engine/assets/168174/a5249f70-22b4-4d36-8b63-e88c8a6846fe)/cc

</details>

---

This PR now makes the `scenario_test` useful and blocking for Android
engine rolls:

- Add support for connecting to SkiaGold by depending on `goldctl` in
the appropriate configs.
- Add some useful local debugging flags for skipping SkiaGold or running
specific tests (not used by default).
- Failing to connect to Skia gold is now a test failure.
This commit is contained in:
Matan Lurey
2024-02-07 12:58:41 -08:00
committed by GitHub
parent 53ba0f96e4
commit b79821c019
4 changed files with 49 additions and 10 deletions

View File

@@ -54,6 +54,10 @@ targets:
recipe: engine_v2/engine_v2
properties:
config_name: linux_android_emulator
dependencies: >-
[
{"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}
]
timeout: 60
runIf:
- .ci.yaml
@@ -71,6 +75,10 @@ targets:
recipe: engine_v2/engine_v2
properties:
config_name: linux_android_emulator_api_33
dependencies: >-
[
{"dependency": "goldctl", "version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"}
]
timeout: 60
runIf:
- .ci.yaml

View File

@@ -17,6 +17,12 @@
"--rbe",
"--no-goma"
],
"dependencies": [
{
"dependency": "goldctl",
"version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"
}
],
"name": "android_debug_x64",
"ninja": {
"config": "android_debug_x64",

View File

@@ -17,6 +17,12 @@
"--rbe",
"--no-goma"
],
"dependencies": [
{
"dependency": "goldctl",
"version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"
}
],
"name": "android_debug_x64",
"ninja": {
"config": "android_debug_x64",

View File

@@ -21,18 +21,23 @@ void main(List<String> args) async {
final ArgParser parser = ArgParser()
..addOption(
'adb',
help: 'absolute path to the adb tool',
help: 'Absolute path to the adb tool',
mandatory: true,
)
..addOption(
'out-dir',
help: 'out directory',
help: 'Out directory',
mandatory: true,
)
..addFlag(
..addOption(
'smoke-test',
help: 'runs a single test to verify the setup',
negatable: false,
valueHelp: 'The class to execute, defaults to dev.flutter.scenarios.EngineLaunchE2ETest',
)
..addFlag(
'use-skia-gold',
help: 'Use Skia Gold to compare screenshots.',
defaultsTo: isLuciEnv,
);
runZonedGuarded(
@@ -40,8 +45,17 @@ void main(List<String> args) async {
final ArgResults results = parser.parse(args);
final Directory outDir = Directory(results['out-dir'] as String);
final File adb = File(results['adb'] as String);
final bool smokeTest = results['smoke-test'] as bool;
await _run(outDir: outDir, adb: adb, smokeTest: smokeTest);
final bool useSkiaGold = results['use-skia-gold'] as bool;
String? smokeTest = results['smoke-test'] as String?;
if (results.wasParsed('smoke-test') && smokeTest!.isEmpty) {
smokeTest = 'dev.flutter.scenarios.EngineLaunchE2ETest';
}
await _run(
outDir: outDir,
adb: adb,
smokeTestFullPath: smokeTest,
useSkiaGold: useSkiaGold,
);
exit(0);
},
(Object error, StackTrace stackTrace) {
@@ -57,7 +71,8 @@ void main(List<String> args) async {
Future<void> _run({
required Directory outDir,
required File adb,
required bool smokeTest,
required String? smokeTestFullPath,
required bool useSkiaGold,
}) async {
const ProcessManager pm = LocalProcessManager();
@@ -178,7 +193,11 @@ Future<void> _run({
await skiaGoldClient!.auth();
log('skia gold client is available');
} else {
log('skia gold client is unavailable');
if (useSkiaGold) {
panic(<String>['skia gold client is unavailable']);
} else {
log('skia gold client is unavaialble');
}
}
});
@@ -210,8 +229,8 @@ Future<void> _run({
'am',
'instrument',
'-w',
if (smokeTest)
'-e class dev.flutter.scenarios.EngineLaunchE2ETest',
if (smokeTestFullPath != null)
'-e class $smokeTestFullPath',
'dev.flutter.scenarios.test/dev.flutter.TestRunner',
]);
if (exitCode != 0) {