Add --device-id option for devicelab/bin/run.dart (#59276)
* Implement device selection for devicelab/run.dart * Add test to --device-id option for devicelab/run * Update dev/devicelab/bin/run.dart by jonahwilliam * Rename deviceOperatingSystem enum mock -> fake Co-authored-by: Jonah Williams <jonahwilliams@google.com>
This commit is contained in:
@@ -10,6 +10,7 @@ import 'package:path/path.dart' as path;
|
||||
import 'package:vm_service_client/vm_service_client.dart';
|
||||
|
||||
import 'package:flutter_devicelab/framework/utils.dart';
|
||||
import 'package:flutter_devicelab/framework/adb.dart' show DeviceIdEnvName;
|
||||
|
||||
/// Runs a task in a separate Dart VM and collects the result using the VM
|
||||
/// service protocol.
|
||||
@@ -24,19 +25,27 @@ Future<Map<String, dynamic>> runTask(
|
||||
bool silent = false,
|
||||
String localEngine,
|
||||
String localEngineSrcPath,
|
||||
String deviceId,
|
||||
}) async {
|
||||
final String taskExecutable = 'bin/tasks/$taskName.dart';
|
||||
|
||||
if (!file(taskExecutable).existsSync())
|
||||
throw 'Executable Dart file not found: $taskExecutable';
|
||||
|
||||
final Process runner = await startProcess(dartBin, <String>[
|
||||
'--enable-vm-service=0', // zero causes the system to choose a free port
|
||||
'--no-pause-isolates-on-exit',
|
||||
if (localEngine != null) '-DlocalEngine=$localEngine',
|
||||
if (localEngineSrcPath != null) '-DlocalEngineSrcPath=$localEngineSrcPath',
|
||||
taskExecutable,
|
||||
]);
|
||||
final Process runner = await startProcess(
|
||||
dartBin,
|
||||
<String>[
|
||||
'--enable-vm-service=0', // zero causes the system to choose a free port
|
||||
'--no-pause-isolates-on-exit',
|
||||
if (localEngine != null) '-DlocalEngine=$localEngine',
|
||||
if (localEngineSrcPath != null) '-DlocalEngineSrcPath=$localEngineSrcPath',
|
||||
taskExecutable,
|
||||
],
|
||||
environment: <String, String>{
|
||||
if (deviceId != null)
|
||||
DeviceIdEnvName: deviceId,
|
||||
},
|
||||
);
|
||||
|
||||
bool runnerFinished = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user