Add --local-web-sdk in devicelab runner to make --ab testing work for web (#123825)
This allows us to check for performance differences in local Web SDKs. ## 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] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [Features we expect every widget to implement]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#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/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat
This commit is contained in:
@@ -38,6 +38,11 @@ Future<void> main(List<String> rawArgs) async {
|
||||
/// Required for A/B test mode.
|
||||
final String? localEngine = args['local-engine'] as String?;
|
||||
|
||||
/// The build of the local Web SDK to use.
|
||||
///
|
||||
/// Required for A/B test mode.
|
||||
final String? localWebSdk = args['local-web-sdk'] as String?;
|
||||
|
||||
/// The path to the engine "src/" directory.
|
||||
final String? localEngineSrcPath = args['local-engine-src-path'] as String?;
|
||||
|
||||
@@ -85,8 +90,8 @@ Future<void> main(List<String> rawArgs) async {
|
||||
stderr.writeln(argParser.usage);
|
||||
exit(1);
|
||||
}
|
||||
if (localEngine == null) {
|
||||
stderr.writeln('When running in A/B test mode --local-engine is required.\n');
|
||||
if (localEngine == null && localWebSdk == null) {
|
||||
stderr.writeln('When running in A/B test mode --local-engine or --local-web-sdk is required.\n');
|
||||
stderr.writeln(argParser.usage);
|
||||
exit(1);
|
||||
}
|
||||
@@ -94,6 +99,7 @@ Future<void> main(List<String> rawArgs) async {
|
||||
runsPerTest: runsPerTest,
|
||||
silent: silent,
|
||||
localEngine: localEngine,
|
||||
localWebSdk: localWebSdk,
|
||||
localEngineSrcPath: localEngineSrcPath,
|
||||
deviceId: deviceId,
|
||||
resultsFile: resultsFile,
|
||||
@@ -118,7 +124,8 @@ Future<void> main(List<String> rawArgs) async {
|
||||
Future<void> _runABTest({
|
||||
required int runsPerTest,
|
||||
required bool silent,
|
||||
required String localEngine,
|
||||
required String? localEngine,
|
||||
required String? localWebSdk,
|
||||
required String? localEngineSrcPath,
|
||||
required String? deviceId,
|
||||
required String resultsFile,
|
||||
@@ -126,7 +133,9 @@ Future<void> _runABTest({
|
||||
}) async {
|
||||
print('$taskName A/B test. Will run $runsPerTest times.');
|
||||
|
||||
final ABTest abTest = ABTest(localEngine, taskName);
|
||||
assert(localEngine != null || localWebSdk != null);
|
||||
|
||||
final ABTest abTest = ABTest((localEngine ?? localWebSdk)!, taskName);
|
||||
for (int i = 1; i <= runsPerTest; i++) {
|
||||
section('Run #$i');
|
||||
|
||||
@@ -152,6 +161,7 @@ Future<void> _runABTest({
|
||||
taskName,
|
||||
silent: silent,
|
||||
localEngine: localEngine,
|
||||
localWebSdk: localWebSdk,
|
||||
localEngineSrcPath: localEngineSrcPath,
|
||||
deviceId: deviceId,
|
||||
);
|
||||
@@ -282,6 +292,14 @@ ArgParser createArgParser(List<String> taskNames) {
|
||||
'This path is relative to --local-engine-src-path/out. This option\n'
|
||||
'is required when running an A/B test (see the --ab option).',
|
||||
)
|
||||
..addOption(
|
||||
'local-web-sdk',
|
||||
help: 'Name of a build output within the engine out directory, if you\n'
|
||||
'are building Flutter locally. Use this to select a specific\n'
|
||||
'version of the engine if you have built multiple engine targets.\n'
|
||||
'This path is relative to --local-engine-src-path/out. This option\n'
|
||||
'is required when running an A/B test (see the --ab option).',
|
||||
)
|
||||
..addFlag(
|
||||
'list',
|
||||
abbr: 'l',
|
||||
|
||||
Reference in New Issue
Block a user