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
9072a099
Unverified
Commit
9072a099
authored
Mar 17, 2022
by
Emmanuel Garcia
Committed by
GitHub
Mar 17, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix race condition in readJsonResults (#100243)
parent
3c6b760e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
3 deletions
+29
-3
devices.dart
dev/devicelab/lib/framework/devices.dart
+26
-1
microbenchmarks.dart
dev/devicelab/lib/microbenchmarks.dart
+2
-2
microbenchmarks.dart
dev/devicelab/lib/tasks/microbenchmarks.dart
+1
-0
No files found.
dev/devicelab/lib/framework/devices.dart
View file @
9072a099
...
@@ -152,6 +152,14 @@ abstract class Device {
...
@@ -152,6 +152,14 @@ abstract class Device {
/// with some prefix.
/// with some prefix.
Stream
<
String
>
get
logcat
;
Stream
<
String
>
get
logcat
;
/// Clears the device logs.
///
/// This is important because benchmarks tests rely on the logs produced by
/// the flutter run command.
///
/// On Android, those logs may contain logs from previous test.
Future
<
void
>
clearLogs
();
/// Whether this device supports calls to [startLoggingToSink]
/// Whether this device supports calls to [startLoggingToSink]
/// and [stopLoggingToSink].
/// and [stopLoggingToSink].
bool
get
canStreamLogs
=>
false
;
bool
get
canStreamLogs
=>
false
;
...
@@ -667,6 +675,11 @@ class AndroidDevice extends Device {
...
@@ -667,6 +675,11 @@ class AndroidDevice extends Device {
}
}
}
}
@override
Future
<
void
>
clearLogs
()
{
return
adb
(<
String
>[
'logcat'
,
'-c'
]);
}
@override
@override
Stream
<
String
>
get
logcat
{
Stream
<
String
>
get
logcat
{
final
Completer
<
void
>
stdoutDone
=
Completer
<
void
>();
final
Completer
<
void
>
stdoutDone
=
Completer
<
void
>();
...
@@ -677,7 +690,7 @@ class AndroidDevice extends Device {
...
@@ -677,7 +690,7 @@ class AndroidDevice extends Device {
late
final
StreamController
<
String
>
stream
;
late
final
StreamController
<
String
>
stream
;
stream
=
StreamController
<
String
>(
stream
=
StreamController
<
String
>(
onListen:
()
async
{
onListen:
()
async
{
await
adb
(<
String
>[
'logcat'
,
'-c'
]
);
await
clearLogs
(
);
final
Process
process
=
await
startProcess
(
final
Process
process
=
await
startProcess
(
adbPath
,
adbPath
,
// Make logcat less chatty by filtering down to just ActivityManager
// Make logcat less chatty by filtering down to just ActivityManager
...
@@ -971,6 +984,9 @@ class IosDevice extends Device {
...
@@ -971,6 +984,9 @@ class IosDevice extends Device {
throw
UnimplementedError
();
throw
UnimplementedError
();
}
}
@override
Future
<
void
>
clearLogs
()
async
{}
@override
@override
Future
<
void
>
stop
(
String
packageName
)
async
{}
Future
<
void
>
stop
(
String
packageName
)
async
{}
...
@@ -1007,6 +1023,9 @@ class WindowsDevice extends Device {
...
@@ -1007,6 +1023,9 @@ class WindowsDevice extends Device {
@override
@override
Stream
<
String
>
get
logcat
=>
const
Stream
<
String
>.
empty
();
Stream
<
String
>
get
logcat
=>
const
Stream
<
String
>.
empty
();
@override
Future
<
void
>
clearLogs
()
async
{}
@override
@override
Future
<
void
>
reboot
()
async
{
}
Future
<
void
>
reboot
()
async
{
}
...
@@ -1074,6 +1093,9 @@ class FuchsiaDevice extends Device {
...
@@ -1074,6 +1093,9 @@ class FuchsiaDevice extends Device {
throw
UnimplementedError
();
throw
UnimplementedError
();
}
}
@override
Future
<
void
>
clearLogs
()
async
{}
@override
@override
Future
<
void
>
reboot
()
async
{
Future
<
void
>
reboot
()
async
{
// Unsupported.
// Unsupported.
...
@@ -1142,6 +1164,9 @@ class FakeDevice extends Device {
...
@@ -1142,6 +1164,9 @@ class FakeDevice extends Device {
throw
UnimplementedError
();
throw
UnimplementedError
();
}
}
@override
Future
<
void
>
clearLogs
()
async
{}
@override
@override
Future
<
void
>
stop
(
String
packageName
)
async
{}
Future
<
void
>
stop
(
String
packageName
)
async
{}
...
...
dev/devicelab/lib/microbenchmarks.dart
View file @
9072a099
...
@@ -31,14 +31,14 @@ Future<Map<String, double>> readJsonResults(Process process) {
...
@@ -31,14 +31,14 @@ Future<Map<String, double>> readJsonResults(Process process) {
.
transform
<
String
>(
const
Utf8Decoder
())
.
transform
<
String
>(
const
Utf8Decoder
())
.
transform
<
String
>(
const
LineSplitter
())
.
transform
<
String
>(
const
LineSplitter
())
.
listen
((
String
line
)
async
{
.
listen
((
String
line
)
async
{
print
(
line
);
print
(
'[STDOUT]
$line
'
);
if
(
line
.
contains
(
jsonStart
))
{
if
(
line
.
contains
(
jsonStart
))
{
jsonStarted
=
true
;
jsonStarted
=
true
;
return
;
return
;
}
}
if
(
line
.
contains
(
jsonEnd
))
{
if
(
jsonStarted
&&
line
.
contains
(
jsonEnd
))
{
final
String
jsonOutput
=
jsonBuf
.
toString
();
final
String
jsonOutput
=
jsonBuf
.
toString
();
// If we end up here and have already parsed the results, it suggests that
// If we end up here and have already parsed the results, it suggests that
...
...
dev/devicelab/lib/tasks/microbenchmarks.dart
View file @
9072a099
...
@@ -19,6 +19,7 @@ TaskFunction createMicrobenchmarkTask() {
...
@@ -19,6 +19,7 @@ TaskFunction createMicrobenchmarkTask() {
return
()
async
{
return
()
async
{
final
Device
device
=
await
devices
.
workingDevice
;
final
Device
device
=
await
devices
.
workingDevice
;
await
device
.
unlock
();
await
device
.
unlock
();
await
device
.
clearLogs
();
Future
<
Map
<
String
,
double
>>
_runMicrobench
(
String
benchmarkPath
)
async
{
Future
<
Map
<
String
,
double
>>
_runMicrobench
(
String
benchmarkPath
)
async
{
Future
<
Map
<
String
,
double
>>
_run
()
async
{
Future
<
Map
<
String
,
double
>>
_run
()
async
{
...
...
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