Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
7cdd33fe
Unverified
Commit
7cdd33fe
authored
May 18, 2021
by
gaaclarke
Committed by
GitHub
May 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added unawaited function for devicelab and turned on unawaited_futures linter (#82833)
parent
5c09eecd
Changes
23
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
74 additions
and
33 deletions
+74
-33
analysis_options.yaml
dev/devicelab/analysis_options.yaml
+5
-0
run.dart
dev/devicelab/bin/run.dart
+2
-1
build_mode_test.dart
dev/devicelab/bin/tasks/build_mode_test.dart
+3
-2
flutter_attach_test_fuchsia.dart
dev/devicelab/bin/tasks/flutter_attach_test_fuchsia.dart
+3
-2
flutter_engine_group_performance.dart
...devicelab/bin/tasks/flutter_engine_group_performance.dart
+2
-1
flutter_run_test.dart
dev/devicelab/bin/tasks/flutter_run_test.dart
+2
-1
gradle_desugar_classes_test.dart
dev/devicelab/bin/tasks/gradle_desugar_classes_test.dart
+2
-1
gradle_plugin_light_apk_test.dart
dev/devicelab/bin/tasks/gradle_plugin_light_apk_test.dart
+3
-1
ios_app_with_extensions_test.dart
dev/devicelab/bin/tasks/ios_app_with_extensions_test.dart
+3
-2
ios_content_validation_test.dart
dev/devicelab/bin/tasks/ios_content_validation_test.dart
+3
-2
module_test_ios.dart
dev/devicelab/bin/tasks/module_test_ios.dart
+2
-1
routing_test.dart
dev/devicelab/bin/tasks/routing_test.dart
+2
-1
run_release_test.dart
dev/devicelab/bin/tasks/run_release_test.dart
+2
-1
service_extensions_test.dart
dev/devicelab/bin/tasks/service_extensions_test.dart
+3
-2
test_runner.dart
dev/devicelab/bin/test_runner.dart
+3
-2
common.dart
dev/devicelab/lib/common.dart
+14
-0
adb.dart
dev/devicelab/lib/framework/adb.dart
+3
-2
browser.dart
dev/devicelab/lib/framework/browser.dart
+3
-2
runner.dart
dev/devicelab/lib/framework/runner.dart
+3
-2
utils.dart
dev/devicelab/lib/framework/utils.dart
+3
-2
build_test_task.dart
dev/devicelab/lib/tasks/build_test_task.dart
+2
-1
dart_plugin_registry_tests.dart
dev/devicelab/lib/tasks/dart_plugin_registry_tests.dart
+2
-1
web_benchmarks.dart
dev/devicelab/lib/tasks/web_benchmarks.dart
+4
-3
No files found.
dev/devicelab/analysis_options.yaml
0 → 100644
View file @
7cdd33fe
include
:
../../analysis_options.yaml
linter
:
rules
:
-
unawaited_futures
dev/devicelab/bin/run.dart
View file @
7cdd33fe
...
@@ -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'
);
...
...
dev/devicelab/bin/tasks/build_mode_test.dart
View file @
7cdd33fe
...
@@ -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
.'
;
...
...
dev/devicelab/bin/tasks/flutter_attach_test_fuchsia.dart
View file @
7cdd33fe
...
@@ -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
)
{
...
...
dev/devicelab/bin/tasks/flutter_engine_group_performance.dart
View file @
7cdd33fe
...
@@ -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
)
);
}
}
dev/devicelab/bin/tasks/flutter_run_test.dart
View file @
7cdd33fe
...
@@ -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
...
...
dev/devicelab/bin/tasks/gradle_desugar_classes_test.dart
View file @
7cdd33fe
...
@@ -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
>[
...
...
dev/devicelab/bin/tasks/gradle_plugin_light_apk_test.dart
View file @
7cdd33fe
...
@@ -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
();
...
...
dev/devicelab/bin/tasks/ios_app_with_extensions_test.dart
View file @
7cdd33fe
...
@@ -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'
);
...
...
dev/devicelab/bin/tasks/ios_content_validation_test.dart
View file @
7cdd33fe
...
@@ -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
);
...
...
dev/devicelab/bin/tasks/module_test_ios.dart
View file @
7cdd33fe
...
@@ -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
);
}
}
});
});
...
...
dev/devicelab/bin/tasks/routing_test.dart
View file @
7cdd33fe
...
@@ -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.'
;
...
...
dev/devicelab/bin/tasks/run_release_test.dart
View file @
7cdd33fe
...
@@ -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
.'
;
...
...
dev/devicelab/bin/tasks/service_extensions_test.dart
View file @
7cdd33fe
...
@@ -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
...
...
dev/devicelab/bin/test_runner.dart
View file @
7cdd33fe
...
@@ -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.
});
})
)
;
}
}
dev/devicelab/lib/common.dart
0 → 100644
View file @
7cdd33fe
// 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
)
{
}
dev/devicelab/lib/framework/adb.dart
View file @
7cdd33fe
...
@@ -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
,
...
...
dev/devicelab/lib/framework/browser.dart
View file @
7cdd33fe
...
@@ -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
;
});
})
)
;
}
}
}
}
dev/devicelab/lib/framework/runner.dart
View file @
7cdd33fe
...
@@ -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
>();
...
...
dev/devicelab/lib/framework/utils.dart
View file @
7cdd33fe
...
@@ -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
;
}
}
...
...
dev/devicelab/lib/tasks/build_test_task.dart
View file @
7cdd33fe
...
@@ -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
)
{
...
...
dev/devicelab/lib/tasks/dart_plugin_registry_tests.dart
View file @
7cdd33fe
...
@@ -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
);
...
...
dev/devicelab/lib/tasks/web_benchmarks.dart
View file @
7cdd33fe
...
@@ -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
();
}
}
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment