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
bae2f2c1
Unverified
Commit
bae2f2c1
authored
Mar 19, 2020
by
Kirill Pertsev
Committed by
GitHub
Mar 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enables log reader on iOS Simulator to (rudimentary) process multiline messages (#52452)
parent
f885a48f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
0 deletions
+70
-0
simulators.dart
packages/flutter_tools/lib/src/ios/simulators.dart
+12
-0
simulators_test.dart
...flutter_tools/test/general.shard/ios/simulators_test.dart
+58
-0
No files found.
packages/flutter_tools/lib/src/ios/simulators.dart
View file @
bae2f2c1
...
...
@@ -659,6 +659,10 @@ class _IOSSimulatorLogReader extends DeviceLogReader {
static
final
RegExp
_flutterRunnerRegex
=
RegExp
(
r' FlutterRunner\[\d+\] '
);
// Remember what we did with the last line, in case we need to process
// a multiline record
bool
_lastLineMatched
=
false
;
String
_filterDeviceLine
(
String
string
)
{
final
Match
match
=
_mapRegex
.
matchAsPrefix
(
string
);
if
(
match
!=
null
)
{
...
...
@@ -710,6 +714,11 @@ class _IOSSimulatorLogReader extends DeviceLogReader {
return
null
;
}
// Starts with space(s) - continuation of the multiline message
if
(
RegExp
(
r'\s+'
).
matchAsPrefix
(
string
)
!=
null
&&
!
_lastLineMatched
)
{
return
null
;
}
return
string
;
}
...
...
@@ -731,6 +740,9 @@ class _IOSSimulatorLogReader extends DeviceLogReader {
_lastLine
=
_filterDeviceLine
(
line
);
if
(
_lastLine
!=
null
)
{
_linesController
.
add
(
_lastLine
);
_lastLineMatched
=
true
;
}
else
{
_lastLineMatched
=
false
;
}
}
}
...
...
packages/flutter_tools/test/general.shard/ios/simulators_test.dart
View file @
bae2f2c1
...
...
@@ -565,6 +565,64 @@ void main() {
ProcessManager:
()
=>
mockProcessManager
,
FileSystem:
()
=>
fileSystem
,
});
testUsingContext
(
'log reader handles multiline messages'
,
()
async
{
when
(
mockProcessManager
.
start
(
any
,
environment:
null
,
workingDirectory:
null
))
.
thenAnswer
((
Invocation
invocation
)
{
final
Process
mockProcess
=
MockProcess
();
when
(
mockProcess
.
stdout
)
.
thenAnswer
((
Invocation
invocation
)
{
// Messages from 2017 should pass through, 2020 message should not
return
Stream
<
List
<
int
>>.
fromIterable
(<
List
<
int
>>[
'''
2017-09-13 15:26:57.228948-0700 localhost Runner[37195]: (Flutter) Single line message
2017-09-13 15:26:57.228948-0700 localhost Runner[37195]: (Flutter) Multi line message
continues...
continues...
2020-03-11 15:58:28.207175-0700 localhost Runner[72166]: (libnetwork.dylib) [com.apple.network:] [28 www.googleapis.com:443 stream, pid: 72166, tls] cancelled
[28.1 64A98447-EABF-4983-A387-7DB9D0C1785F 10.0.1.200.57912<->172.217.6.74:443]
Connected Path: satisfied (Path is satisfied), interface: en18
Duration: 0.271s, DNS @0.000s took 0.001s, TCP @0.002s took 0.019s, TLS took 0.046s
bytes in/out: 4468/1933, packets in/out: 11/10, rtt: 0.016s, retransmitted packets: 0, out-of-order packets: 0
2017-09-13 15:36:57.228948-0700 localhost Runner[37195]: (Flutter) Multi line message again
and it goes...
and goes...
2017-09-13 15:36:57.228948-0700 localhost Runner[37195]: (Flutter) Single line message, not the part of the above
'''
.
codeUnits
]);
});
when
(
mockProcess
.
stderr
)
.
thenAnswer
((
Invocation
invocation
)
=>
const
Stream
<
List
<
int
>>.
empty
());
// Delay return of exitCode until after stdout stream data, since it terminates the logger.
when
(
mockProcess
.
exitCode
)
.
thenAnswer
((
Invocation
invocation
)
=>
Future
<
int
>.
delayed
(
Duration
.
zero
,
()
=>
0
));
return
Future
<
Process
>.
value
(
mockProcess
);
});
final
IOSSimulator
device
=
IOSSimulator
(
'123456'
,
simulatorCategory:
'iOS 11.0'
,
simControl:
mockSimControl
,
xcode:
mockXcode
,
);
final
DeviceLogReader
logReader
=
device
.
getLogReader
(
app:
await
BuildableIOSApp
.
fromProject
(
mockIosProject
),
);
final
List
<
String
>
lines
=
await
logReader
.
logLines
.
toList
();
expect
(
lines
,
<
String
>[
'Single line message'
,
'Multi line message'
,
' continues...'
,
' continues...'
,
'Multi line message again'
,
' and it goes...'
,
' and goes...'
,
'Single line message, not the part of the above'
]);
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
mockProcessManager
,
FileSystem:
()
=>
fileSystem
,
});
});
group
(
'SimControl'
,
()
{
...
...
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