Unverified Commit 7cdd33fe authored by gaaclarke's avatar gaaclarke Committed by GitHub

added unawaited function for devicelab and turned on unawaited_futures linter (#82833)

parent 5c09eecd
include: ../../analysis_options.yaml
linter:
rules:
- unawaited_futures
...@@ -6,6 +6,7 @@ import 'dart:convert'; ...@@ -6,6 +6,7 @@ import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:args/args.dart'; import 'package:args/args.dart';
import 'package:flutter_devicelab/common.dart';
import 'package:flutter_devicelab/framework/ab.dart'; import 'package:flutter_devicelab/framework/ab.dart';
import 'package:flutter_devicelab/framework/manifest.dart'; import 'package:flutter_devicelab/framework/manifest.dart';
import 'package:flutter_devicelab/framework/runner.dart'; import 'package:flutter_devicelab/framework/runner.dart';
...@@ -183,7 +184,7 @@ Future<void> _runABTest() async { ...@@ -183,7 +184,7 @@ Future<void> _runABTest() async {
abTest.finalize(); abTest.finalize();
final File jsonFile = _uniqueFile(args['ab-result-file'] as String ?? 'ABresults#.json'); final File jsonFile = _uniqueFile(args['ab-result-file'] as String ?? 'ABresults#.json');
jsonFile.writeAsString(const JsonEncoder.withIndent(' ').convert(abTest.jsonMap)); unawaited(jsonFile.writeAsString(const JsonEncoder.withIndent(' ').convert(abTest.jsonMap)));
if (!silent) { if (!silent) {
section('Raw results'); section('Raw results');
......
...@@ -6,6 +6,7 @@ import 'dart:async'; ...@@ -6,6 +6,7 @@ import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:flutter_devicelab/common.dart';
import 'package:flutter_devicelab/framework/adb.dart'; import 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/task_result.dart'; import 'package:flutter_devicelab/framework/task_result.dart';
...@@ -38,9 +39,9 @@ Future<String> runFlutterAndQuit(List<String> args, Device device) async { ...@@ -38,9 +39,9 @@ Future<String> runFlutterAndQuit(List<String> args, Device device) async {
stderr.add(line); stderr.add(line);
}, },
); );
run.exitCode.then<void>((int exitCode) { unawaited(run.exitCode.then<void>((int exitCode) {
runExitCode = exitCode; runExitCode = exitCode;
}); }));
await Future.any<dynamic>(<Future<dynamic>>[ready.future, run.exitCode]); await Future.any<dynamic>(<Future<dynamic>>[ready.future, run.exitCode]);
if (runExitCode != null) { if (runExitCode != null) {
throw 'Failed to run test app; runner unexpected exited, with exit code $runExitCode.'; throw 'Failed to run test app; runner unexpected exited, with exit code $runExitCode.';
......
...@@ -7,6 +7,7 @@ import 'dart:convert'; ...@@ -7,6 +7,7 @@ import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'dart:math'; import 'dart:math';
import 'package:flutter_devicelab/common.dart';
import 'package:flutter_devicelab/framework/adb.dart'; import 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/task_result.dart'; import 'package:flutter_devicelab/framework/task_result.dart';
...@@ -202,7 +203,7 @@ void main() { ...@@ -202,7 +203,7 @@ void main() {
section('Hot reload'); section('Hot reload');
runProcess.stdin.write('r'); runProcess.stdin.write('r');
runProcess.stdin.flush(); unawaited(runProcess.stdin.flush());
await eventOrExit(reloadedCompleter.future); await eventOrExit(reloadedCompleter.future);
section('Waiting for Dart VM'); section('Waiting for Dart VM');
...@@ -212,7 +213,7 @@ void main() { ...@@ -212,7 +213,7 @@ void main() {
section('Quitting flutter run'); section('Quitting flutter run');
runProcess.stdin.write('q'); runProcess.stdin.write('q');
runProcess.stdin.flush(); unawaited(runProcess.stdin.flush());
final int runExitCode = await runProcess.exitCode; final int runExitCode = await runProcess.exitCode;
if (runExitCode != 0 || runStderr.isNotEmpty) { if (runExitCode != 0 || runStderr.isNotEmpty) {
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter_devicelab/common.dart';
import 'package:flutter_devicelab/framework/adb.dart'; import 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/task_result.dart'; import 'package:flutter_devicelab/framework/task_result.dart';
...@@ -106,5 +107,5 @@ Future<TaskResult> _doTest() async { ...@@ -106,5 +107,5 @@ Future<TaskResult> _doTest() async {
} }
Future<void> main() async { Future<void> main() async {
task(_doTest); unawaited(task(_doTest));
} }
...@@ -6,6 +6,7 @@ import 'dart:async'; ...@@ -6,6 +6,7 @@ import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:flutter_devicelab/common.dart';
import 'package:flutter_devicelab/framework/adb.dart'; import 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/task_result.dart'; import 'package:flutter_devicelab/framework/task_result.dart';
...@@ -70,7 +71,7 @@ Future<TaskResult> createFlutterRunTask() async { ...@@ -70,7 +71,7 @@ Future<TaskResult> createFlutterRunTask() async {
} }
}); });
await finished.future.timeout(const Duration(minutes: 1)); await finished.future.timeout(const Duration(minutes: 1));
subscription.cancel(); unawaited(subscription.cancel());
run.kill(); run.kill();
}); });
return passedTest && failedTest && skippedTest && finishedMessage && printMessage && writelnMessage return passedTest && failedTest && skippedTest && finishedMessage && printMessage && writelnMessage
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter_devicelab/common.dart';
import 'package:flutter_devicelab/framework/apk_utils.dart'; import 'package:flutter_devicelab/framework/apk_utils.dart';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/task_result.dart'; import 'package:flutter_devicelab/framework/task_result.dart';
...@@ -15,7 +16,7 @@ Future<void> main() async { ...@@ -15,7 +16,7 @@ Future<void> main() async {
try { try {
await runProjectTest((FlutterProject flutterProject) async { await runProjectTest((FlutterProject flutterProject) async {
section('APK contains plugin classes'); section('APK contains plugin classes');
flutterProject.addPlugin('google_maps_flutter', value: '^1.0.10'); unawaited(flutterProject.addPlugin('google_maps_flutter', value: '^1.0.10'));
await inDirectory(flutterProject.rootPath, () async { await inDirectory(flutterProject.rootPath, () async {
await flutter('build', options: <String>[ await flutter('build', options: <String>[
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter_devicelab/common.dart';
import 'package:flutter_devicelab/framework/apk_utils.dart'; import 'package:flutter_devicelab/framework/apk_utils.dart';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/task_result.dart'; import 'package:flutter_devicelab/framework/task_result.dart';
...@@ -217,7 +218,8 @@ Future<void> main() async { ...@@ -217,7 +218,8 @@ Future<void> main() async {
}); });
section('Configure'); section('Configure');
project.addPlugin('plugin_under_test', value: '$platformLineSep path: ${pluginDir.path}'); unawaited(project.addPlugin('plugin_under_test',
value: '$platformLineSep path: ${pluginDir.path}'));
await project.addCustomBuildType('local', initWith: 'debug'); await project.addCustomBuildType('local', initWith: 'debug');
await project.getPackages(); await project.getPackages();
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:flutter_devicelab/common.dart';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/ios.dart'; import 'package:flutter_devicelab/framework/ios.dart';
import 'package:flutter_devicelab/framework/task_result.dart'; import 'package:flutter_devicelab/framework/task_result.dart';
...@@ -80,7 +81,7 @@ Future<void> main() async { ...@@ -80,7 +81,7 @@ Future<void> main() async {
'EFQRCode.framework', 'EFQRCode.framework',
'EFQRCode', 'EFQRCode',
); );
_checkWatchExtensionFrameworkArchs(watchExtensionFrameworkPath); unawaited(_checkWatchExtensionFrameworkArchs(watchExtensionFrameworkPath));
section('Clean build'); section('Clean build');
...@@ -100,7 +101,7 @@ Future<void> main() async { ...@@ -100,7 +101,7 @@ Future<void> main() async {
checkDirectoryExists(appBundle); checkDirectoryExists(appBundle);
await _checkFlutterFrameworkArchs(appFrameworkPath, isSimulator: false); await _checkFlutterFrameworkArchs(appFrameworkPath, isSimulator: false);
await _checkFlutterFrameworkArchs(flutterFrameworkPath, isSimulator: false); await _checkFlutterFrameworkArchs(flutterFrameworkPath, isSimulator: false);
_checkWatchExtensionFrameworkArchs(watchExtensionFrameworkPath); unawaited(_checkWatchExtensionFrameworkArchs(watchExtensionFrameworkPath));
section('Clean build'); section('Clean build');
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter_devicelab/common.dart';
import 'package:flutter_devicelab/framework/apk_utils.dart'; import 'package:flutter_devicelab/framework/apk_utils.dart';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/task_result.dart'; import 'package:flutter_devicelab/framework/task_result.dart';
...@@ -53,7 +54,7 @@ Future<void> main() async { ...@@ -53,7 +54,7 @@ Future<void> main() async {
'Flutter', 'Flutter',
); );
// Exits 0 only if codesigned. // Exits 0 only if codesigned.
eval('xcrun', <String>['codesign', '--verify', flutterFramework]); unawaited(eval('xcrun', <String>['codesign', '--verify', flutterFramework]));
final String appFramework = path.join( final String appFramework = path.join(
appBundle.path, appBundle.path,
...@@ -61,7 +62,7 @@ Future<void> main() async { ...@@ -61,7 +62,7 @@ Future<void> main() async {
'App.framework', 'App.framework',
'App', 'App',
); );
eval('xcrun', <String>['codesign', '--verify', appFramework]); unawaited(eval('xcrun', <String>['codesign', '--verify', appFramework]));
}); });
return TaskResult.success(null); return TaskResult.success(null);
......
...@@ -6,6 +6,7 @@ import 'dart:convert'; ...@@ -6,6 +6,7 @@ import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:flutter_devicelab/common.dart';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/host_agent.dart'; import 'package:flutter_devicelab/framework/host_agent.dart';
import 'package:flutter_devicelab/framework/ios.dart'; import 'package:flutter_devicelab/framework/ios.dart';
...@@ -464,7 +465,7 @@ Future<void> main() async { ...@@ -464,7 +465,7 @@ Future<void> main() async {
} catch (e) { } catch (e) {
return TaskResult.failure(e.toString()); return TaskResult.failure(e.toString());
} finally { } finally {
removeIOSimulator(simulatorDeviceId); unawaited(removeIOSimulator(simulatorDeviceId));
rmTree(tempDir); rmTree(tempDir);
} }
}); });
......
...@@ -6,6 +6,7 @@ import 'dart:async'; ...@@ -6,6 +6,7 @@ import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:flutter_devicelab/common.dart';
import 'package:flutter_devicelab/framework/adb.dart'; import 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/host_agent.dart'; import 'package:flutter_devicelab/framework/host_agent.dart';
...@@ -68,7 +69,7 @@ void main() { ...@@ -68,7 +69,7 @@ void main() {
.listen((String line) { .listen((String line) {
stderr.writeln('run:stderr: $line'); stderr.writeln('run:stderr: $line');
}); });
run.exitCode.then<void>((int exitCode) { ok = false; }); unawaited(run.exitCode.then<void>((int exitCode) { ok = false; }));
await Future.any<dynamic>(<Future<dynamic>>[ ready.future, run.exitCode ]); await Future.any<dynamic>(<Future<dynamic>>[ ready.future, run.exitCode ]);
if (!ok) if (!ok)
throw 'Failed to run test app.'; throw 'Failed to run test app.';
......
...@@ -6,6 +6,7 @@ import 'dart:async'; ...@@ -6,6 +6,7 @@ import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:flutter_devicelab/common.dart';
import 'package:flutter_devicelab/framework/adb.dart'; import 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/task_result.dart'; import 'package:flutter_devicelab/framework/task_result.dart';
...@@ -79,7 +80,7 @@ void main() { ...@@ -79,7 +80,7 @@ void main() {
print('run:stderr: $line'); print('run:stderr: $line');
stderr.add(line); stderr.add(line);
}); });
run.exitCode.then<void>((int exitCode) { runExitCode = exitCode; }); unawaited(run.exitCode.then<void>((int exitCode) { runExitCode = exitCode; }));
await Future.any<dynamic>(<Future<dynamic>>[ ready.future, run.exitCode ]); await Future.any<dynamic>(<Future<dynamic>>[ ready.future, run.exitCode ]);
if (runExitCode != null) { if (runExitCode != null) {
throw 'Failed to run test app; runner unexpected exited, with exit code $runExitCode.'; throw 'Failed to run test app; runner unexpected exited, with exit code $runExitCode.';
......
...@@ -6,6 +6,7 @@ import 'dart:async'; ...@@ -6,6 +6,7 @@ import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:flutter_devicelab/common.dart';
import 'package:flutter_devicelab/framework/adb.dart'; import 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/task_result.dart'; import 'package:flutter_devicelab/framework/task_result.dart';
...@@ -50,7 +51,7 @@ void main() { ...@@ -50,7 +51,7 @@ void main() {
.listen((String line) { .listen((String line) {
stderr.writeln('run:stderr: $line'); stderr.writeln('run:stderr: $line');
}); });
run.exitCode.then<void>((int exitCode) { ok = false; }); unawaited(run.exitCode.then<void>((int exitCode) { ok = false; }));
await Future.any<dynamic>(<Future<dynamic>>[ ready.future, run.exitCode ]); await Future.any<dynamic>(<Future<dynamic>>[ ready.future, run.exitCode ]);
if (!ok) if (!ok)
throw 'Failed to run test app.'; throw 'Failed to run test app.';
...@@ -101,7 +102,7 @@ void main() { ...@@ -101,7 +102,7 @@ void main() {
final Future<Event> navigationFuture = navigationEvents.first; final Future<Event> navigationFuture = navigationEvents.first;
// This tap triggers a navigation event. // This tap triggers a navigation event.
device.tap(100, 200); unawaited(device.tap(100, 200));
final Event navigationEvent = await navigationFuture; final Event navigationEvent = await navigationFuture;
// validate the fields // validate the fields
......
...@@ -8,6 +8,7 @@ import 'package:args/command_runner.dart'; ...@@ -8,6 +8,7 @@ import 'package:args/command_runner.dart';
import 'package:flutter_devicelab/command/test.dart'; import 'package:flutter_devicelab/command/test.dart';
import 'package:flutter_devicelab/command/upload_metrics.dart'; import 'package:flutter_devicelab/command/upload_metrics.dart';
import 'package:flutter_devicelab/common.dart';
final CommandRunner<void> runner = final CommandRunner<void> runner =
CommandRunner<void>('devicelab_runner', 'DeviceLab test runner for recording performance metrics on applications') CommandRunner<void>('devicelab_runner', 'DeviceLab test runner for recording performance metrics on applications')
...@@ -15,10 +16,10 @@ final CommandRunner<void> runner = ...@@ -15,10 +16,10 @@ final CommandRunner<void> runner =
..addCommand(UploadMetricsCommand()); ..addCommand(UploadMetricsCommand());
Future<void> main(List<String> rawArgs) async { Future<void> main(List<String> rawArgs) async {
runner.run(rawArgs).catchError((dynamic error) { unawaited(runner.run(rawArgs).catchError((dynamic error) {
stderr.writeln('$error\n'); stderr.writeln('$error\n');
stderr.writeln('Usage:\n'); stderr.writeln('Usage:\n');
stderr.writeln(runner.usage); stderr.writeln(runner.usage);
exit(64); // Exit code 64 indicates a usage error. exit(64); // Exit code 64 indicates a usage error.
}); }));
} }
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/// Indicates to the linter that the given future is intentionally not awaited.
///
/// Has the same functionality as `unawaited` from `package:pedantic`.
///
/// In an async context, it is normally expected than all Futures are awaited,
/// and that is the basis of the lint unawaited_futures which is turned on for
/// the flutter_tools package. However, there are times where one or more
/// futures are intentionally not awaited. This function may be used to ignore a
/// particular future. It silences the unawaited_futures lint.
void unawaited(Future<void> future) { }
...@@ -7,6 +7,7 @@ import 'dart:convert'; ...@@ -7,6 +7,7 @@ import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'dart:math' as math; import 'dart:math' as math;
import 'package:flutter_devicelab/common.dart';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
import 'package:path/path.dart' as path; import 'package:path/path.dart' as path;
...@@ -591,13 +592,13 @@ class AndroidDevice extends Device { ...@@ -591,13 +592,13 @@ class AndroidDevice extends Device {
.listen((String line) { .listen((String line) {
print('adb logcat stderr: $line'); print('adb logcat stderr: $line');
}, onDone: () { stderrDone.complete(); }); }, onDone: () { stderrDone.complete(); });
process.exitCode.then<void>((int exitCode) { unawaited(process.exitCode.then<void>((int exitCode) {
print('adb logcat process terminated with exit code $exitCode'); print('adb logcat process terminated with exit code $exitCode');
if (!aborted) { if (!aborted) {
stream.addError(BuildFailedError('adb logcat failed with exit code $exitCode.\n')); stream.addError(BuildFailedError('adb logcat failed with exit code $exitCode.\n'));
processDone.complete(); processDone.complete();
} }
}); }));
await Future.any<dynamic>(<Future<dynamic>>[ await Future.any<dynamic>(<Future<dynamic>>[
Future.wait<void>(<Future<void>>[ Future.wait<void>(<Future<void>>[
stdoutDone.future, stdoutDone.future,
......
...@@ -7,6 +7,7 @@ import 'dart:convert' show json, utf8, LineSplitter, JsonEncoder; ...@@ -7,6 +7,7 @@ import 'dart:convert' show json, utf8, LineSplitter, JsonEncoder;
import 'dart:io' as io; import 'dart:io' as io;
import 'dart:math' as math; import 'dart:math' as math;
import 'package:flutter_devicelab/common.dart';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
import 'package:path/path.dart' as path; import 'package:path/path.dart' as path;
import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart';
...@@ -625,9 +626,9 @@ Future<io.Process> _spawnChromiumProcess(String executable, List<String> args, { ...@@ -625,9 +626,9 @@ Future<io.Process> _spawnChromiumProcess(String executable, List<String> args, {
// A precaution that avoids accumulating browser processes, in case the // A precaution that avoids accumulating browser processes, in case the
// glibc bug doesn't cause the browser to quit and we keep looping and // glibc bug doesn't cause the browser to quit and we keep looping and
// launching more processes. // launching more processes.
process.exitCode.timeout(const Duration(seconds: 1), onTimeout: () { unawaited(process.exitCode.timeout(const Duration(seconds: 1), onTimeout: () {
process.kill(); process.kill();
return null; return null;
}); }));
} }
} }
...@@ -6,6 +6,7 @@ import 'dart:async'; ...@@ -6,6 +6,7 @@ import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:flutter_devicelab/common.dart';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
import 'package:vm_service/vm_service.dart'; import 'package:vm_service/vm_service.dart';
...@@ -103,9 +104,9 @@ Future<TaskResult> runTask( ...@@ -103,9 +104,9 @@ Future<TaskResult> runTask(
bool runnerFinished = false; bool runnerFinished = false;
runner.exitCode.whenComplete(() { unawaited(runner.exitCode.whenComplete(() {
runnerFinished = true; runnerFinished = true;
}); }));
final Completer<Uri> uri = Completer<Uri>(); final Completer<Uri> uri = Completer<Uri>();
......
...@@ -7,6 +7,7 @@ import 'dart:convert'; ...@@ -7,6 +7,7 @@ import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'dart:math' as math; import 'dart:math' as math;
import 'package:flutter_devicelab/common.dart';
import 'package:flutter_devicelab/framework/adb.dart'; import 'package:flutter_devicelab/framework/adb.dart';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
import 'package:path/path.dart' as path; import 'package:path/path.dart' as path;
...@@ -291,10 +292,10 @@ Future<Process> startProcess( ...@@ -291,10 +292,10 @@ Future<Process> startProcess(
final ProcessInfo processInfo = ProcessInfo(command, process); final ProcessInfo processInfo = ProcessInfo(command, process);
_runningProcesses.add(processInfo); _runningProcesses.add(processInfo);
process.exitCode.then<void>((int exitCode) { unawaited(process.exitCode.then<void>((int exitCode) {
print('"$executable" exit code: $exitCode'); print('"$executable" exit code: $exitCode');
_runningProcesses.remove(processInfo); _runningProcesses.remove(processInfo);
}); }));
return process; return process;
} }
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
import 'dart:io'; import 'dart:io';
import 'package:args/args.dart'; import 'package:args/args.dart';
import 'package:flutter_devicelab/common.dart';
import '../framework/adb.dart'; import '../framework/adb.dart';
import '../framework/task_result.dart'; import '../framework/task_result.dart';
...@@ -106,7 +107,7 @@ abstract class BuildTestTask { ...@@ -106,7 +107,7 @@ abstract class BuildTestTask {
} }
if (!testOnly) { if (!testOnly) {
build(); unawaited(build());
} }
if (buildOnly) { if (buildOnly) {
......
...@@ -6,6 +6,7 @@ import 'dart:async'; ...@@ -6,6 +6,7 @@ import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:flutter_devicelab/common.dart';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/task_result.dart'; import 'package:flutter_devicelab/framework/task_result.dart';
import 'package:flutter_devicelab/framework/utils.dart'; import 'package:flutter_devicelab/framework/utils.dart';
...@@ -168,7 +169,7 @@ class PluginPlatformInterfaceMacOS { ...@@ -168,7 +169,7 @@ class PluginPlatformInterfaceMacOS {
section('Wait for registry execution after hot restart'); section('Wait for registry execution after hot restart');
await registryExecutedCompleter.future; await registryExecutedCompleter.future;
subscription.cancel(); unawaited(subscription.cancel());
run.kill(); run.kill();
}); });
return TaskResult.success(null); return TaskResult.success(null);
......
...@@ -6,6 +6,7 @@ import 'dart:async'; ...@@ -6,6 +6,7 @@ import 'dart:async';
import 'dart:convert' show json; import 'dart:convert' show json;
import 'dart:io' as io; import 'dart:io' as io;
import 'package:flutter_devicelab/common.dart';
import 'package:flutter_devicelab/framework/browser.dart'; import 'package:flutter_devicelab/framework/browser.dart';
import 'package:flutter_devicelab/framework/task_result.dart'; import 'package:flutter_devicelab/framework/task_result.dart';
import 'package:flutter_devicelab/framework/utils.dart'; import 'package:flutter_devicelab/framework/utils.dart';
...@@ -58,7 +59,7 @@ Future<TaskResult> runWebBenchmark({ @required bool useCanvasKit }) async { ...@@ -58,7 +59,7 @@ Future<TaskResult> runWebBenchmark({ @required bool useCanvasKit }) async {
'Requested to run bechmark ${benchmarkIterator.current}, but ' 'Requested to run bechmark ${benchmarkIterator.current}, but '
'got results for $benchmarkName.', 'got results for $benchmarkName.',
)); ));
server.close(); unawaited(server.close());
} }
// Trace data is null when the benchmark is not frame-based, such as RawRecorder. // Trace data is null when the benchmark is not frame-based, such as RawRecorder.
...@@ -80,7 +81,7 @@ Future<TaskResult> runWebBenchmark({ @required bool useCanvasKit }) async { ...@@ -80,7 +81,7 @@ Future<TaskResult> runWebBenchmark({ @required bool useCanvasKit }) async {
return Response.ok('Stopped performance tracing'); return Response.ok('Stopped performance tracing');
} else if (request.requestedUri.path.endsWith('/on-error')) { } else if (request.requestedUri.path.endsWith('/on-error')) {
final Map<String, dynamic> errorDetails = json.decode(await request.readAsString()) as Map<String, dynamic>; final Map<String, dynamic> errorDetails = json.decode(await request.readAsString()) as Map<String, dynamic>;
server.close(); unawaited(server.close());
// Keep the stack trace as a string. It's thrown in the browser, not this Dart VM. // Keep the stack trace as a string. It's thrown in the browser, not this Dart VM.
profileData.completeError('${errorDetails['error']}\n${errorDetails['stackTrace']}'); profileData.completeError('${errorDetails['error']}\n${errorDetails['stackTrace']}');
return Response.ok(''); return Response.ok('');
...@@ -183,7 +184,7 @@ Future<TaskResult> runWebBenchmark({ @required bool useCanvasKit }) async { ...@@ -183,7 +184,7 @@ Future<TaskResult> runWebBenchmark({ @required bool useCanvasKit }) async {
} }
return TaskResult.success(taskResult, benchmarkScoreKeys: benchmarkScoreKeys); return TaskResult.success(taskResult, benchmarkScoreKeys: benchmarkScoreKeys);
} finally { } finally {
server?.close(); unawaited(server?.close());
chrome?.stop(); chrome?.stop();
} }
}); });
......
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