Simplify devicelab logic and fix tests (#139122)

- fix https://github.com/flutter/flutter/issues/53707 by having the test not expect a timeout but instead actually look for the retry message
- simplify the `--task` option to only accept task names rather than also accepting paths
- remove some obsolete options that referred to the manifest which no longer seems to exist
This commit is contained in:
Ian Hickson
2023-11-29 00:41:27 -08:00
committed by GitHub
parent c5328650f1
commit 5e216d44ca
6 changed files with 59 additions and 61 deletions

View File

@@ -10,7 +10,6 @@ import 'package:flutter_devicelab/framework/ab.dart';
import 'package:flutter_devicelab/framework/runner.dart';
import 'package:flutter_devicelab/framework/task_result.dart';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:path/path.dart' as path;
/// Runs tasks.
///
@@ -235,29 +234,12 @@ ArgParser createArgParser(List<String> taskNames) {
..addMultiOption(
'task',
abbr: 't',
help: 'Either:\n'
' - the name of a task defined in manifest.yaml.\n'
' Example: complex_layout__start_up.\n'
' - the path to a Dart file corresponding to a task,\n'
' which resides in bin/tasks.\n'
' Example: bin/tasks/complex_layout__start_up.dart.\n'
help: 'Name of a Dart file in bin/tasks.\n'
' Example: complex_layout__start_up\n'
'\n'
'This option may be repeated to specify multiple tasks.',
callback: (List<String> value) {
for (final String nameOrPath in value) {
final List<String> fragments = path.split(nameOrPath);
final bool isDartFile = fragments.last.endsWith('.dart');
if (fragments.length == 1 && !isDartFile) {
// Not a path
taskNames.add(nameOrPath);
} else if (!isDartFile || !path.equals(path.dirname(nameOrPath), path.join('bin', 'tasks'))) {
// Unsupported executable location
throw FormatException('Invalid value for option -t (--task): $nameOrPath');
} else {
taskNames.add(path.withoutExtension(fragments.last));
}
}
callback: (List<String> tasks) {
taskNames.addAll(tasks);
},
)
..addOption(
@@ -339,14 +321,6 @@ ArgParser createArgParser(List<String> taskNames) {
'the location based on the value of the --flutter-root option.',
)
..addOption('luci-builder', help: '[Flutter infrastructure] Name of the LUCI builder being run on.')
..addFlag(
'match-host-platform',
defaultsTo: true,
help: 'Only run tests that match the host platform (e.g. do not run a\n'
'test with a `required_agent_capabilities` value of "mac/android"\n'
'on a windows host). Each test publishes its '
'`required_agent_capabilities`\nin the `manifest.yaml` file.',
)
..addOption(
'results-file',
help: '[Flutter infrastructure] File path for test results. If passed with\n'

View File

@@ -7,5 +7,8 @@
/// By not calling `task()` the VM service extension is not registered and
/// therefore will not accept requests to run tasks. When the runner attempts to
/// connect and run the test it will receive a "method not found" error from the
/// VM service, will likely retry and finally time out.
/// VM service, will likely retry forever.
///
/// The test in ../../test/run_test.dart runs this task until it detects
/// the retry message and then aborts the task.
Future<void> main() async {}