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() {
...
@@ -50,20 +50,22 @@ void main() {
'--verbose'
,
'--verbose'
,
'-d'
,
'-d'
,
device
.
deviceId
,
device
.
deviceId
,
'lib/commands.dart'
'lib/commands.dart'
,
],
],
);
);
final
StreamController
<
String
>
stdout
=
final
StreamController
<
String
>
stdout
=
StreamController
<
String
>.
broadcast
();
StreamController
<
String
>.
broadcast
();
transformToLines
(
run
.
stdout
).
listen
((
String
line
)
{
transformToLines
(
run
.
stdout
).
listen
((
String
line
)
{
print
(
'run:stdout:
$line
'
);
print
(
'run:stdout:
$line
'
);
stdout
.
add
(
line
);
stdout
.
add
(
line
);
final
dynamic
json
=
parseFlutterResponse
(
line
);
final
dynamic
json
=
parseFlutterResponse
(
line
);
if
(
json
!=
null
&&
json
[
'event'
]
==
'app.debugPort'
)
{
if
(
json
!=
null
)
{
vmServicePort
=
Uri
.
parse
(
json
[
'params'
][
'wsUri'
]).
port
;
if
(
json
[
'event'
]
==
'app.debugPort'
)
{
print
(
'service protocol connection available at port
$vmServicePort
'
);
vmServicePort
=
Uri
.
parse
(
json
[
'params'
][
'wsUri'
]).
port
;
}
else
if
(
json
!=
null
&&
json
[
'event'
]
==
'app.started'
)
{
print
(
'service protocol connection available at port
$vmServicePort
'
);
appId
=
json
[
'params'
][
'appId'
];
}
else
if
(
json
[
'event'
]
==
'app.started'
)
{
appId
=
json
[
'params'
][
'appId'
];
print
(
'application identifier is
$appId
'
);
}
}
}
if
(
vmServicePort
!=
null
&&
appId
!=
null
&&
!
ready
.
isCompleted
)
{
if
(
vmServicePort
!=
null
&&
appId
!=
null
&&
!
ready
.
isCompleted
)
{
print
(
'run: ready!'
);
print
(
'run: ready!'
);
...
@@ -73,6 +75,7 @@ void main() {
...
@@ -73,6 +75,7 @@ void main() {
});
});
transformToLines
(
run
.
stderr
).
listen
((
String
line
)
{
transformToLines
(
run
.
stderr
).
listen
((
String
line
)
{
stderr
.
writeln
(
'run:stderr:
$line
'
);
stderr
.
writeln
(
'run:stderr:
$line
'
);
ok
=
false
;
});
});
run
.
exitCode
.
then
<
void
>((
int
exitCode
)
{
run
.
exitCode
.
then
<
void
>((
int
exitCode
)
{
ok
=
false
;
ok
=
false
;
...
@@ -81,17 +84,15 @@ void main() {
...
@@ -81,17 +84,15 @@ void main() {
if
(!
ok
)
if
(!
ok
)
throw
'Failed to run test app.'
;
throw
'Failed to run test app.'
;
final
VMServiceClient
client
=
final
VMServiceClient
client
=
VMServiceClient
.
connect
(
VMServiceClient
.
connect
(
'ws://localhost:
$vmServicePort
/ws'
);
'ws://localhost:
$vmServicePort
/ws'
);
int
id
=
1
;
int
id
=
1
;
Future
<
Map
<
String
,
dynamic
>>
sendRequest
(
Future
<
Map
<
String
,
dynamic
>>
sendRequest
(
String
method
,
dynamic
params
)
async
{
String
method
,
dynamic
params
)
async
{
final
int
requestId
=
id
++;
final
int
requestId
=
id
++;
final
Completer
<
Map
<
String
,
dynamic
>>
response
=
final
Completer
<
Map
<
String
,
dynamic
>>
response
=
Completer
<
Map
<
String
,
dynamic
>>();
Completer
<
Map
<
String
,
dynamic
>>();
final
StreamSubscription
<
String
>
responseSubscription
=
stdout
.
stream
.
listen
((
String
line
)
{
final
StreamSubscription
<
String
>
responseSubscription
=
stdout
.
stream
.
listen
((
String
line
)
{
final
Map
<
String
,
dynamic
>
json
=
parseFlutterResponse
(
line
);
final
Map
<
String
,
dynamic
>
json
=
parseFlutterResponse
(
line
);
if
(
json
!=
null
&&
json
[
'id'
]
==
requestId
)
if
(
json
!=
null
&&
json
[
'id'
]
==
requestId
)
response
.
complete
(
json
);
response
.
complete
(
json
);
...
@@ -110,27 +111,35 @@ void main() {
...
@@ -110,27 +111,35 @@ void main() {
}
}
print
(
'test: sending two hot reloads...'
);
print
(
'test: sending two hot reloads...'
);
final
Future
<
dynamic
>
hotReload1
=
sendRequest
(
'app.restart'
,
final
Future
<
dynamic
>
hotReload1
=
sendRequest
(
<
String
,
dynamic
>{
'appId'
:
appId
,
'fullRestart'
:
false
});
'app.restart'
,
final
Future
<
dynamic
>
hotReload2
=
sendRequest
(
'app.restart'
,
<
String
,
dynamic
>{
'appId'
:
appId
,
'fullRestart'
:
false
},
<
String
,
dynamic
>{
'appId'
:
appId
,
'fullRestart'
:
false
});
);
final
Future
<
List
<
dynamic
>>
reloadRequests
=
final
Future
<
dynamic
>
hotReload2
=
sendRequest
(
Future
.
wait
<
dynamic
>(<
Future
<
dynamic
>>[
hotReload1
,
hotReload2
]);
'app.restart'
,
final
dynamic
results
=
await
Future
<
String
,
dynamic
>{
'appId'
:
appId
,
'fullRestart'
:
false
},
.
any
<
dynamic
>(<
Future
<
dynamic
>>[
run
.
exitCode
,
reloadRequests
]);
);
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
)
if
(!
ok
)
throw
'App crashed during hot reloads.'
;
throw
'App
failed or
crashed during hot reloads.'
;
final
List
<
dynamic
>
responses
=
results
;
final
List
<
dynamic
>
responses
=
results
;
final
List
<
dynamic
>
errorResponses
=
final
List
<
dynamic
>
errorResponses
=
responses
.
where
(
responses
.
where
((
dynamic
r
)
=>
r
[
'error'
]
!=
null
).
toList
();
(
dynamic
r
)
=>
r
[
'error'
]
!=
null
final
List
<
dynamic
>
successResponses
=
responses
).
toList
();
.
where
((
dynamic
r
)
=>
final
List
<
dynamic
>
successResponses
=
responses
.
where
(
r
[
'error'
]
==
null
&&
(
dynamic
r
)
=>
r
[
'error'
]
==
null
&&
r
[
'result'
]
!=
null
&&
r
[
'result'
]
!=
null
&&
r
[
'result'
][
'code'
]
==
0
)
r
[
'result'
][
'code'
]
==
0
.
toList
();
)
.
toList
();
if
(
errorResponses
.
length
!=
1
)
if
(
errorResponses
.
length
!=
1
)
throw
'Did not receive the expected (exactly one) hot reload error response.'
;
throw
'Did not receive the expected (exactly one) hot reload error response.'
;
...
@@ -140,8 +149,10 @@ void main() {
...
@@ -140,8 +149,10 @@ void main() {
if
(
successResponses
.
length
!=
1
)
if
(
successResponses
.
length
!=
1
)
throw
'Did not receive the expected (exactly one) successful hot reload response.'
;
throw
'Did not receive the expected (exactly one) successful hot reload response.'
;
final
dynamic
hotReload3
=
await
sendRequest
(
'app.restart'
,
final
dynamic
hotReload3
=
await
sendRequest
(
<
String
,
dynamic
>{
'appId'
:
appId
,
'fullRestart'
:
false
});
'app.restart'
,
<
String
,
dynamic
>{
'appId'
:
appId
,
'fullRestart'
:
false
},
);
if
(
hotReload3
[
'error'
]
!=
null
)
if
(
hotReload3
[
'error'
]
!=
null
)
throw
'Received an error response from a hot reload after all other hot reloads had completed.'
;
throw
'Received an error response from a hot reload after all other hot reloads had completed.'
;
...
@@ -150,7 +161,7 @@ void main() {
...
@@ -150,7 +161,7 @@ void main() {
if
(
result
!=
0
)
if
(
result
!=
0
)
throw
'Received unexpected exit code
$result
from run process.'
;
throw
'Received unexpected exit code
$result
from run process.'
;
print
(
'test: validating that the app has in fact closed...'
);
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
);
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