Funnel devicelab tests through utils process methods (#122161)

Funnel devicelab tests through utils process methods
This commit is contained in:
Jenn Magder
2023-03-08 11:44:40 -08:00
committed by GitHub
parent 244372b303
commit a16e620ec2
13 changed files with 145 additions and 135 deletions

View File

@@ -58,10 +58,9 @@ Future<TaskResult> _doTest() async {
final String gradlew = Platform.isWindows ? 'gradlew.bat' : 'gradlew';
final String gradlewExecutable =
Platform.isWindows ? '.\\$gradlew' : './$gradlew';
final String flutterPath = path.join(flutterDirectory, 'bin', 'flutter');
await utils.eval(flutterPath, <String>['precache', '--android'],
await utils.flutter('precache', options: <String>['--android'],
workingDirectory: modulePath);
await utils.eval(flutterPath, <String>['pub', 'get'],
await utils.flutter('pub', options: <String>['get'],
workingDirectory: modulePath);
_copyGradleFromModule(modulePath, androidPath);

View File

@@ -53,9 +53,9 @@ class NewGalleryChromeRunTest {
]);
final List<String> options = <String>['-d', 'chrome', '--verbose', '--resident'];
final Process process = await startProcess(
path.join(flutterDirectory.path, 'bin', 'flutter'),
flutterCommandArgs('run', options),
final Process process = await startFlutter(
'run',
options: options,
);
final Completer<void> stdoutDone = Completer<void>();

View File

@@ -38,14 +38,13 @@ enum TestStep {
Future<int> runTest({bool coverage = false, bool noPub = false}) async {
final Stopwatch clock = Stopwatch()..start();
final List<String> arguments = flutterCommandArgs('test', <String>[
if (coverage) '--coverage',
if (noPub) '--no-pub',
path.join('flutter_test', 'trivial_widget_test.dart'),
]);
final Process analysis = await startProcess(
path.join(flutterDirectory.path, 'bin', 'flutter'),
arguments,
final Process analysis = await startFlutter(
'test',
options: <String>[
if (coverage) '--coverage',
if (noPub) '--no-pub',
path.join('flutter_test', 'trivial_widget_test.dart'),
],
workingDirectory: path.join(flutterDirectory.path, 'dev', 'automated_tests'),
);
int badLines = 0;

View File

@@ -38,10 +38,10 @@ void main() {
final Completer<void> ready = Completer<void>();
late bool ok;
print('run: starting...');
final Process run = await startProcess(
path.join(flutterDirectory.path, 'bin', 'flutter'),
final Process run = await startFlutter(
'run',
// --fast-start does not support routes.
<String>['run', '--verbose', '--disable-service-auth-codes', '--no-fast-start', '--no-publish-port', '-d', device.deviceId, '--route', '/smuggle-it', 'lib/route.dart'],
options: <String>['--verbose', '--disable-service-auth-codes', '--no-fast-start', '--no-publish-port', '-d', device.deviceId, '--route', '/smuggle-it', 'lib/route.dart'],
);
run.stdout
.transform<String>(utf8.decoder)
@@ -70,9 +70,9 @@ void main() {
throw 'Failed to run test app.';
}
print('drive: starting...');
final Process drive = await startProcess(
path.join(flutterDirectory.path, 'bin', 'flutter'),
<String>['drive', '--use-existing-app', 'http://127.0.0.1:$vmServicePort/', '--no-keep-app-running', 'lib/route.dart'],
final Process drive = await startFlutter(
'drive',
options: <String>['--use-existing-app', 'http://127.0.0.1:$vmServicePort/', '--no-keep-app-running', 'lib/route.dart'],
);
drive.stdout
.transform<String>(utf8.decoder)

View File

@@ -25,9 +25,9 @@ void main() {
final Completer<void> ready = Completer<void>();
late bool ok;
print('run: starting...');
final Process run = await startProcess(
path.join(flutterDirectory.path, 'bin', 'flutter'),
<String>['run', '--verbose', '--no-fast-start', '--no-publish-port', '--disable-service-auth-codes', '-d', device.deviceId, 'lib/main.dart'],
final Process run = await startFlutter(
'run',
options: <String>['--verbose', '--no-fast-start', '--no-publish-port', '--disable-service-auth-codes', '-d', device.deviceId, 'lib/main.dart'],
);
run.stdout
.transform<String>(utf8.decoder)