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
9369bd32
Unverified
Commit
9369bd32
authored
3 years ago
by
Jenn Magder
Committed by
GitHub
3 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wait for ios-deploy stdout before closing logLine stream (#99041)
parent
f0d44472
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
43 deletions
+58
-43
ios_deploy.dart
packages/flutter_tools/lib/src/ios/ios_deploy.dart
+3
-3
ios_deploy_test.dart
...flutter_tools/test/general.shard/ios/ios_deploy_test.dart
+55
-40
No files found.
packages/flutter_tools/lib/src/ios/ios_deploy.dart
View file @
9369bd32
...
...
@@ -395,11 +395,11 @@ class IOSDeployDebugger {
_monitorIOSDeployFailure
(
line
,
_logger
);
_logger
.
printTrace
(
line
);
});
unawaited
(
_iosDeployProcess
!.
exitCode
.
then
((
int
status
)
{
unawaited
(
_iosDeployProcess
!.
exitCode
.
then
((
int
status
)
async
{
_logger
.
printTrace
(
'ios-deploy exited with code
$exitCode
'
);
_debuggerState
=
_IOSDeployDebuggerState
.
detached
;
unawaited
(
stdoutSubscription
.
cancel
()
);
unawaited
(
stderrSubscription
.
cancel
()
);
await
stdoutSubscription
.
cancel
(
);
await
stderrSubscription
.
cancel
(
);
}).
whenComplete
(()
async
{
if
(
_debuggerOutput
.
hasListener
)
{
// Tell listeners the process died.
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/general.shard/ios/ios_deploy_test.dart
View file @
9369bd32
...
...
@@ -75,8 +75,9 @@ void main () {
interfaceType:
IOSDeviceConnectionInterface
.
network
,
);
expect
(
iosDeployDebugger
.
logLines
,
emits
(
'Did finish launching.'
));
expect
(
await
iosDeployDebugger
.
launchAndAttach
(),
isTrue
);
expect
(
await
iosDeployDebugger
.
logLines
.
toList
(),
<
String
>[
'Did finish launching.'
]
);
await
iosDeployDebugger
.
logLines
.
drain
(
);
expect
(
processManager
,
hasNoRemainingExpectations
);
expect
(
appDeltaDirectory
,
exists
);
});
...
...
@@ -92,7 +93,6 @@ void main () {
testWithoutContext
(
'debugger attached and stopped'
,
()
async
{
final
StreamController
<
List
<
int
>>
stdin
=
StreamController
<
List
<
int
>>();
final
Stream
<
String
>
stdinStream
=
stdin
.
stream
.
transform
<
String
>(
const
Utf8Decoder
());
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
FakeCommand
(
command:
const
<
String
>[
'ios-deploy'
],
...
...
@@ -108,24 +108,47 @@ void main () {
final
Stream
<
String
>
logLines
=
iosDeployDebugger
.
logLines
..
listen
(
receivedLogLines
.
add
);
expect
(
await
iosDeployDebugger
.
launchAndAttach
(),
isTrue
);
await
logLines
.
toList
();
expect
(
receivedLogLines
,
<
String
>[
expect
(
iosDeployDebugger
.
logLines
,
emitsInOrder
(<
String
>[
'success'
,
// ignore first "success" from lldb, but log subsequent ones from real logging.
'Log on attach1'
,
'Log on attach2'
,
''
,
''
,
'Log after process stop'
]);
expect
(
logger
.
traceText
,
contains
(
'PROCESS_STOPPED'
));
expect
(
logger
.
traceText
,
contains
(
'thread backtrace all'
));
expect
(
logger
.
traceText
,
contains
(
'* thread #1'
));
expect
(
await
stdinStream
.
take
(
3
).
toList
(),
<
String
>[
]));
expect
(
stdin
.
stream
.
transform
<
String
>(
const
Utf8Decoder
()),
emitsInOrder
(<
String
>[
'thread backtrace all'
,
'
\n
'
,
'process detach'
,
]));
expect
(
await
iosDeployDebugger
.
launchAndAttach
(),
isTrue
);
await
logLines
.
drain
();
expect
(
logger
.
traceText
,
contains
(
'PROCESS_STOPPED'
));
expect
(
logger
.
traceText
,
contains
(
'thread backtrace all'
));
expect
(
logger
.
traceText
,
contains
(
'* thread #1'
));
});
testWithoutContext
(
'handle processing logging after process exit'
,
()
async
{
final
StreamController
<
List
<
int
>>
stdin
=
StreamController
<
List
<
int
>>();
// Make sure we don't hit a race where logging processed after the process exits
// causes listeners to receive logging on the closed logLines stream.
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
FakeCommand
(
command:
const
<
String
>[
'ios-deploy'
],
stdout:
'stdout: "(lldb) run
\r\n
success
\r\n
'
,
stdin:
IOSink
(
stdin
.
sink
),
outputFollowsExit:
true
,
),
]);
final
IOSDeployDebugger
iosDeployDebugger
=
IOSDeployDebugger
.
test
(
processManager:
processManager
,
logger:
logger
,
);
expect
(
iosDeployDebugger
.
logLines
,
emitsDone
);
expect
(
await
iosDeployDebugger
.
launchAndAttach
(),
isFalse
);
await
iosDeployDebugger
.
logLines
.
drain
();
});
testWithoutContext
(
'app exit'
,
()
async
{
...
...
@@ -139,21 +162,17 @@ void main () {
processManager:
processManager
,
logger:
logger
,
);
final
List
<
String
>
receivedLogLines
=
<
String
>[];
final
Stream
<
String
>
logLines
=
iosDeployDebugger
.
logLines
..
listen
(
receivedLogLines
.
add
);
expect
(
await
iosDeployDebugger
.
launchAndAttach
(),
isTrue
);
await
logLines
.
toList
();
expect
(
receivedLogLines
,
<
String
>[
expect
(
iosDeployDebugger
.
logLines
,
emitsInOrder
(<
String
>[
'Log on attach'
,
'Log after process exit'
,
]);
]));
expect
(
await
iosDeployDebugger
.
launchAndAttach
(),
isTrue
);
await
iosDeployDebugger
.
logLines
.
drain
();
});
testWithoutContext
(
'app crash'
,
()
async
{
final
StreamController
<
List
<
int
>>
stdin
=
StreamController
<
List
<
int
>>();
final
Stream
<
String
>
stdinStream
=
stdin
.
stream
.
transform
<
String
>(
const
Utf8Decoder
());
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
FakeCommand
(
command:
const
<
String
>[
'ios-deploy'
],
...
...
@@ -166,24 +185,24 @@ void main () {
processManager:
processManager
,
logger:
logger
,
);
final
List
<
String
>
receivedLogLines
=
<
String
>[];
final
Stream
<
String
>
logLines
=
iosDeployDebugger
.
logLines
..
listen
(
receivedLogLines
.
add
);
expect
(
await
iosDeployDebugger
.
launchAndAttach
(),
isTrue
);
await
logLines
.
toList
();
expect
(
receivedLogLines
,
<
String
>[
expect
(
iosDeployDebugger
.
logLines
,
emitsInOrder
(<
String
>[
'Log on attach'
,
'* thread #1, stop reason = Assertion failed:'
,
]);
expect
(
logger
.
traceText
,
contains
(
'Process 6156 stopped'
));
expect
(
logger
.
traceText
,
contains
(
'thread backtrace all'
));
expect
(
logger
.
traceText
,
contains
(
'* thread #1'
));
expect
(
await
stdinStream
.
take
(
3
).
toList
(),
<
String
>[
]));
expect
(
stdin
.
stream
.
transform
<
String
>(
const
Utf8Decoder
()),
emitsInOrder
(<
String
>[
'thread backtrace all'
,
'
\n
'
,
'process detach'
,
]);
]));
expect
(
await
iosDeployDebugger
.
launchAndAttach
(),
isTrue
);
await
iosDeployDebugger
.
logLines
.
drain
();
expect
(
logger
.
traceText
,
contains
(
'Process 6156 stopped'
));
expect
(
logger
.
traceText
,
contains
(
'thread backtrace all'
));
expect
(
logger
.
traceText
,
contains
(
'* thread #1'
));
});
testWithoutContext
(
'attach failed'
,
()
async
{
...
...
@@ -198,15 +217,12 @@ void main () {
processManager:
processManager
,
logger:
logger
,
);
final
List
<
String
>
receivedLogLines
=
<
String
>[];
final
Stream
<
String
>
logLines
=
iosDeployDebugger
.
logLines
..
listen
(
receivedLogLines
.
add
);
expect
(
await
iosDeployDebugger
.
launchAndAttach
(),
isFalse
);
await
logLines
.
toList
();
// Debugger lines are double spaced, separated by an extra \r\n. Skip the extra lines.
// Still include empty lines other than the extra added newlines.
expect
(
receivedLogLines
,
isEmpty
);
expect
(
iosDeployDebugger
.
logLines
,
emitsDone
);
expect
(
await
iosDeployDebugger
.
launchAndAttach
(),
isFalse
);
await
iosDeployDebugger
.
logLines
.
drain
();
});
testWithoutContext
(
'no provisioning profile 1, stdout'
,
()
async
{
...
...
@@ -273,7 +289,6 @@ void main () {
testWithoutContext
(
'detach'
,
()
async
{
final
StreamController
<
List
<
int
>>
stdin
=
StreamController
<
List
<
int
>>();
final
Stream
<
String
>
stdinStream
=
stdin
.
stream
.
transform
<
String
>(
const
Utf8Decoder
());
final
FakeProcessManager
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
FakeCommand
(
command:
const
<
String
>[
...
...
@@ -286,9 +301,9 @@ void main () {
final
IOSDeployDebugger
iosDeployDebugger
=
IOSDeployDebugger
.
test
(
processManager:
processManager
,
);
expect
(
stdin
.
stream
.
transform
<
String
>(
const
Utf8Decoder
()),
emits
(
'process detach'
));
await
iosDeployDebugger
.
launchAndAttach
();
iosDeployDebugger
.
detach
();
expect
(
await
stdinStream
.
first
,
'process detach'
);
});
testWithoutContext
(
'stop with backtrace'
,
()
async
{
...
...
This diff is collapsed.
Click to expand it.
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