Unverified Commit c05dc3e6 authored by Andrew Kolos's avatar Andrew Kolos Committed by GitHub

[Reland] Fix flavors test install checks (#134060)

Reland of https://github.com/flutter/flutter/pull/133719. Updates [the string comparison in flavor_test.dart](https://github.com/flutter/flutter/pull/134060/files#diff-53383b32b975bfed6875306dfb98911cad077a5251ca0591c5b0e125fb4a0f05R39) to use `path.join` to build the path string so that the generated path is correct for both Linux and Windows hosts.

Fixes https://github.com/flutter/flutter/issues/133713

I've tested this on a Windows host targeting a physical Android device.
parent 22510632
......@@ -7,37 +7,45 @@ import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/task_result.dart';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:flutter_devicelab/tasks/integration_tests.dart';
import 'package:path/path.dart' as path;
Future<void> main() async {
deviceOperatingSystem = DeviceOperatingSystem.android;
await task(() async {
await createFlavorsTest().call();
await createIntegrationTestFlavorsTest().call();
// test install and uninstall of flavors app
await inDirectory('${flutterDirectory.path}/dev/integration_tests/flavors', () async {
await flutter(
'install',
options: <String>['--debug', '--flavor', 'paid'],
);
await flutter(
'install',
options: <String>['--debug', '--flavor', 'paid', '--uninstall-only'],
);
final StringBuffer stderr = StringBuffer();
await evalFlutter(
'install',
canFail: true,
stderr: stderr,
options: <String>['--flavor', 'bogus'],
);
final String stderrString = stderr.toString();
if (!stderrString.contains('The Xcode project defines schemes: free, paid')) {
print(stderrString);
return TaskResult.failure('Should not succeed with bogus flavor');
}
});
final TaskResult installTestsResult = await inDirectory(
'${flutterDirectory.path}/dev/integration_tests/flavors',
() async {
await flutter(
'install',
options: <String>['--debug', '--flavor', 'paid'],
);
await flutter(
'install',
options: <String>['--debug', '--flavor', 'paid', '--uninstall-only'],
);
return TaskResult.success(null);
final StringBuffer stderr = StringBuffer();
await evalFlutter(
'install',
canFail: true,
stderr: stderr,
options: <String>['--flavor', 'bogus'],
);
final String stderrString = stderr.toString();
final String expectedApkPath = path.join('build', 'app', 'outputs', 'flutter-apk', 'app-bogus-release.apk');
if (!stderrString.contains('"$expectedApkPath" does not exist.')) {
print(stderrString);
return TaskResult.failure('Should not succeed with bogus flavor');
}
return TaskResult.success(null);
},
);
return installTestsResult;
});
}
......@@ -14,30 +14,35 @@ Future<void> main() async {
await createFlavorsTest().call();
await createIntegrationTestFlavorsTest().call();
// test install and uninstall of flavors app
await inDirectory('${flutterDirectory.path}/dev/integration_tests/flavors', () async {
await flutter(
'install',
options: <String>['--flavor', 'paid'],
);
await flutter(
'install',
options: <String>['--flavor', 'paid', '--uninstall-only'],
);
final StringBuffer stderr = StringBuffer();
await evalFlutter(
'install',
canFail: true,
stderr: stderr,
options: <String>['--flavor', 'bogus'],
);
final TaskResult installTestsResult = await inDirectory(
'${flutterDirectory.path}/dev/integration_tests/flavors',
() async {
await flutter(
'install',
options: <String>['--flavor', 'paid'],
);
await flutter(
'install',
options: <String>['--flavor', 'paid', '--uninstall-only'],
);
final StringBuffer stderr = StringBuffer();
await evalFlutter(
'install',
canFail: true,
stderr: stderr,
options: <String>['--flavor', 'bogus'],
);
final String stderrString = stderr.toString();
if (!stderrString.contains('install failed, bogus flavor not found')) {
print(stderrString);
return TaskResult.failure('Should not succeed with bogus flavor');
}
});
final String stderrString = stderr.toString();
if (!stderrString.contains('The Xcode project defines schemes: free, paid')) {
print(stderrString);
return TaskResult.failure('Should not succeed with bogus flavor');
}
return TaskResult.success(null);
return TaskResult.success(null);
},
);
return installTestsResult;
});
}
......@@ -14,26 +14,31 @@ Future<void> main() async {
await createFlavorsTest().call();
await createIntegrationTestFlavorsTest().call();
await inDirectory('${flutterDirectory.path}/dev/integration_tests/flavors', () async {
final StringBuffer stderr = StringBuffer();
final TaskResult installTestsResult = await inDirectory(
'${flutterDirectory.path}/dev/integration_tests/flavors',
() async {
final StringBuffer stderr = StringBuffer();
await evalFlutter(
'install',
canFail: true,
stderr: stderr,
options: <String>[
'--d', 'macos',
'--flavor', 'free'
],
);
await evalFlutter(
'install',
canFail: true,
stderr: stderr,
options: <String>[
'--d', 'macos',
'--flavor', 'free'
],
);
final String stderrString = stderr.toString();
if (!stderrString.contains('Host and target are the same. Nothing to install.')) {
print(stderrString);
return TaskResult.failure('Installing a macOS app on macOS should no-op');
}
});
final String stderrString = stderr.toString();
if (!stderrString.contains('Host and target are the same. Nothing to install.')) {
print(stderrString);
return TaskResult.failure('Installing a macOS app on macOS should no-op');
}
return TaskResult.success(null);
return TaskResult.success(null);
},
);
return installTestsResult;
});
}
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