Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Android scenario_app to actually run and block on CI #50414

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 6 additions & 0 deletions ci/builders/linux_android_emulator.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
"--rbe",
"--no-goma"
],
"dependencies": [
{
"dependency": "goldctl",
"version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"
}
],
"name": "android_debug_x64",
"ninja": {
"config": "android_debug_x64",
Expand Down
6 changes: 6 additions & 0 deletions ci/builders/linux_android_emulator_api_33.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
"--rbe",
"--no-goma"
],
"dependencies": [
{
"dependency": "goldctl",
"version": "git_revision:720a542f6fe4f92922c3b8f0fdcc4d2ac6bb83cd"
}
],
"name": "android_debug_x64",
"ninja": {
"config": "android_debug_x64",
Expand Down
39 changes: 29 additions & 10 deletions testing/scenario_app/bin/android_integration_tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,41 @@ 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(
() 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) {
Expand All @@ -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();

Expand Down Expand Up @@ -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');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a bit louder since they are requesting it but it will fail? "Error: Skia gold's client, goldctl, is unavailable"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. I added a clarification, this is in the non-CI case where it could be expected not to have Skia gold hooked up.

}
}
});

Expand Down Expand Up @@ -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) {
Expand Down