Ignore spam from SurfaceSyncer (#123262)
Ignore spam from SurfaceSyncer
This commit is contained in:
@@ -1096,6 +1096,11 @@ class AdbLogReader extends DeviceLogReader {
|
||||
RegExp(r'^[F]\/[\S^:]+:\s+'),
|
||||
];
|
||||
|
||||
// E/SurfaceSyncer(22636): Failed to find sync for id=9
|
||||
// Some versions of Android spew this out. It is inactionable to the end user
|
||||
// and causes no problems for the application.
|
||||
static final RegExp _surfaceSyncerSpam = RegExp(r'^E/SurfaceSyncer\(\s*\d+\): Failed to find sync for id=\d+');
|
||||
|
||||
// 'F/libc(pid): Fatal signal 11'
|
||||
static final RegExp _fatalLog = RegExp(r'^F\/libc\s*\(\s*\d+\):\sFatal signal (\d+)');
|
||||
|
||||
@@ -1150,7 +1155,7 @@ class AdbLogReader extends DeviceLogReader {
|
||||
}
|
||||
}
|
||||
} else if (appPid != null && int.parse(logMatch.group(1)!) == appPid) {
|
||||
acceptLine = true;
|
||||
acceptLine = !_surfaceSyncerSpam.hasMatch(line);
|
||||
|
||||
if (_fatalLog.hasMatch(line)) {
|
||||
// Hit fatal signal, app is now crashing
|
||||
|
||||
@@ -19,6 +19,43 @@ const String kLastLogcatTimestamp = '11-27 15:39:04.506';
|
||||
const String kDummyLine = 'Contents are not important\n';
|
||||
|
||||
void main() {
|
||||
testWithoutContext('AdbLogReader ignores spam from SurfaceSyncer', () async {
|
||||
const int appPid = 1;
|
||||
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
|
||||
FakeCommand(
|
||||
command: const <String>[
|
||||
'adb',
|
||||
'-s',
|
||||
'1234',
|
||||
'shell',
|
||||
'-x',
|
||||
'logcat',
|
||||
'-v',
|
||||
'time',
|
||||
],
|
||||
completer: Completer<void>.sync(),
|
||||
stdout:
|
||||
'$kDummyLine'
|
||||
'05-11 12:54:46.665 W/flutter($appPid): Hello there!\n'
|
||||
'05-11 12:54:46.665 E/SurfaceSyncer($appPid): Failed to find sync for id=9\n'
|
||||
'05-11 12:54:46.665 E/SurfaceSyncer($appPid): Failed to find sync for id=10\n'
|
||||
),
|
||||
]);
|
||||
final AdbLogReader logReader = await AdbLogReader.createLogReader(
|
||||
createFakeDevice(null),
|
||||
processManager,
|
||||
)..appPid = appPid;
|
||||
final Completer<void> onDone = Completer<void>.sync();
|
||||
final List<String> emittedLines = <String>[];
|
||||
logReader.logLines.listen((String line) {
|
||||
emittedLines.add(line);
|
||||
}, onDone: onDone.complete);
|
||||
await null;
|
||||
logReader.dispose();
|
||||
await onDone.future;
|
||||
expect(emittedLines, const <String>['W/flutter($appPid): Hello there!']);
|
||||
});
|
||||
|
||||
testWithoutContext('AdbLogReader calls adb logcat with expected flags apiVersion 21', () async {
|
||||
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
|
||||
const FakeCommand(
|
||||
|
||||
Reference in New Issue
Block a user