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
78f4878f
Unverified
Commit
78f4878f
authored
Jan 14, 2019
by
Ian Hickson
Committed by
GitHub
Jan 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup device lab test and remove a timeout. (#24581)
parent
6c7fb880
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
36 deletions
+47
-36
run_machine_concurrent_hot_reload.dart
...evicelab/bin/tasks/run_machine_concurrent_hot_reload.dart
+47
-36
No files found.
dev/devicelab/bin/tasks/run_machine_concurrent_hot_reload.dart
View file @
78f4878f
...
...
@@ -50,20 +50,22 @@ void main() {
'--verbose'
,
'-d'
,
device
.
deviceId
,
'lib/commands.dart'
'lib/commands.dart'
,
],
);
final
StreamController
<
String
>
stdout
=
StreamController
<
String
>.
broadcast
();
final
StreamController
<
String
>
stdout
=
StreamController
<
String
>.
broadcast
();
transformToLines
(
run
.
stdout
).
listen
((
String
line
)
{
print
(
'run:stdout:
$line
'
);
stdout
.
add
(
line
);
final
dynamic
json
=
parseFlutterResponse
(
line
);
if
(
json
!=
null
&&
json
[
'event'
]
==
'app.debugPort'
)
{
vmServicePort
=
Uri
.
parse
(
json
[
'params'
][
'wsUri'
]).
port
;
print
(
'service protocol connection available at port
$vmServicePort
'
);
}
else
if
(
json
!=
null
&&
json
[
'event'
]
==
'app.started'
)
{
appId
=
json
[
'params'
][
'appId'
];
if
(
json
!=
null
)
{
if
(
json
[
'event'
]
==
'app.debugPort'
)
{
vmServicePort
=
Uri
.
parse
(
json
[
'params'
][
'wsUri'
]).
port
;
print
(
'service protocol connection available at port
$vmServicePort
'
);
}
else
if
(
json
[
'event'
]
==
'app.started'
)
{
appId
=
json
[
'params'
][
'appId'
];
print
(
'application identifier is
$appId
'
);
}
}
if
(
vmServicePort
!=
null
&&
appId
!=
null
&&
!
ready
.
isCompleted
)
{
print
(
'run: ready!'
);
...
...
@@ -73,6 +75,7 @@ void main() {
});
transformToLines
(
run
.
stderr
).
listen
((
String
line
)
{
stderr
.
writeln
(
'run:stderr:
$line
'
);
ok
=
false
;
});
run
.
exitCode
.
then
<
void
>((
int
exitCode
)
{
ok
=
false
;
...
...
@@ -81,17 +84,15 @@ void main() {
if
(!
ok
)
throw
'Failed to run test app.'
;
final
VMServiceClient
client
=
VMServiceClient
.
connect
(
'ws://localhost:
$vmServicePort
/ws'
);
final
VMServiceClient
client
=
VMServiceClient
.
connect
(
'ws://localhost:
$vmServicePort
/ws'
);
int
id
=
1
;
Future
<
Map
<
String
,
dynamic
>>
sendRequest
(
String
method
,
dynamic
params
)
async
{
Future
<
Map
<
String
,
dynamic
>>
sendRequest
(
String
method
,
dynamic
params
)
async
{
final
int
requestId
=
id
++;
final
Completer
<
Map
<
String
,
dynamic
>>
response
=
Completer
<
Map
<
String
,
dynamic
>>();
final
StreamSubscription
<
String
>
responseSubscription
=
stdout
.
stream
.
listen
((
String
line
)
{
final
Completer
<
Map
<
String
,
dynamic
>>
response
=
Completer
<
Map
<
String
,
dynamic
>>();
final
StreamSubscription
<
String
>
responseSubscription
=
stdout
.
stream
.
listen
((
String
line
)
{
final
Map
<
String
,
dynamic
>
json
=
parseFlutterResponse
(
line
);
if
(
json
!=
null
&&
json
[
'id'
]
==
requestId
)
response
.
complete
(
json
);
...
...
@@ -110,27 +111,35 @@ void main() {
}
print
(
'test: sending two hot reloads...'
);
final
Future
<
dynamic
>
hotReload1
=
sendRequest
(
'app.restart'
,
<
String
,
dynamic
>{
'appId'
:
appId
,
'fullRestart'
:
false
});
final
Future
<
dynamic
>
hotReload2
=
sendRequest
(
'app.restart'
,
<
String
,
dynamic
>{
'appId'
:
appId
,
'fullRestart'
:
false
});
final
Future
<
List
<
dynamic
>>
reloadRequests
=
Future
.
wait
<
dynamic
>(<
Future
<
dynamic
>>[
hotReload1
,
hotReload2
]);
final
dynamic
results
=
await
Future
.
any
<
dynamic
>(<
Future
<
dynamic
>>[
run
.
exitCode
,
reloadRequests
]);
final
Future
<
dynamic
>
hotReload1
=
sendRequest
(
'app.restart'
,
<
String
,
dynamic
>{
'appId'
:
appId
,
'fullRestart'
:
false
},
);
final
Future
<
dynamic
>
hotReload2
=
sendRequest
(
'app.restart'
,
<
String
,
dynamic
>{
'appId'
:
appId
,
'fullRestart'
:
false
},
);
final
Future
<
List
<
dynamic
>>
reloadRequests
=
Future
.
wait
<
dynamic
>(<
Future
<
dynamic
>>[
hotReload1
,
hotReload2
,
]);
final
dynamic
results
=
await
Future
.
any
<
dynamic
>(<
Future
<
dynamic
>>[
run
.
exitCode
,
reloadRequests
,
]);
if
(!
ok
)
throw
'App crashed during hot reloads.'
;
throw
'App
failed or
crashed during hot reloads.'
;
final
List
<
dynamic
>
responses
=
results
;
final
List
<
dynamic
>
errorResponses
=
responses
.
where
((
dynamic
r
)
=>
r
[
'error'
]
!=
null
).
toList
();
final
List
<
dynamic
>
successResponses
=
responses
.
where
((
dynamic
r
)
=>
r
[
'error'
]
==
null
&&
r
[
'result'
]
!=
null
&&
r
[
'result'
][
'code'
]
==
0
)
.
toList
();
final
List
<
dynamic
>
errorResponses
=
responses
.
where
(
(
dynamic
r
)
=>
r
[
'error'
]
!=
null
).
toList
();
final
List
<
dynamic
>
successResponses
=
responses
.
where
(
(
dynamic
r
)
=>
r
[
'error'
]
==
null
&&
r
[
'result'
]
!=
null
&&
r
[
'result'
][
'code'
]
==
0
)
.
toList
();
if
(
errorResponses
.
length
!=
1
)
throw
'Did not receive the expected (exactly one) hot reload error response.'
;
...
...
@@ -140,8 +149,10 @@ void main() {
if
(
successResponses
.
length
!=
1
)
throw
'Did not receive the expected (exactly one) successful hot reload response.'
;
final
dynamic
hotReload3
=
await
sendRequest
(
'app.restart'
,
<
String
,
dynamic
>{
'appId'
:
appId
,
'fullRestart'
:
false
});
final
dynamic
hotReload3
=
await
sendRequest
(
'app.restart'
,
<
String
,
dynamic
>{
'appId'
:
appId
,
'fullRestart'
:
false
},
);
if
(
hotReload3
[
'error'
]
!=
null
)
throw
'Received an error response from a hot reload after all other hot reloads had completed.'
;
...
...
@@ -150,7 +161,7 @@ void main() {
if
(
result
!=
0
)
throw
'Received unexpected exit code
$result
from run process.'
;
print
(
'test: validating that the app has in fact closed...'
);
await
client
.
done
.
timeout
(
const
Duration
(
seconds:
5
))
;
await
client
.
done
;
});
return
TaskResult
.
success
(
null
);
});
...
...
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