Bug 787203 - [mozrunner] Expose a start_logcat method in Device; r?ahal
This is a refactor. |start_logcat| allows filtering by tag and is used for
recording gecko.log for Marionette tests on Fennec.
MozReview-Commit-ID: 9NO6jQDMQ9E
--- a/testing/mozbase/mozrunner/mozrunner/devices/base.py
+++ b/testing/mozbase/mozrunner/mozrunner/devices/base.py
@@ -136,20 +136,32 @@ class Device(object):
self.dm.connect()
self.connected = True
if self.logdir:
# save logcat
logcat_log = os.path.join(self.logdir, '%s.log' % serial)
if os.path.isfile(logcat_log):
self._rotate_log(logcat_log)
- logcat_args = [self.app_ctx.adb, '-s', '%s' % serial,
- 'logcat', '-v', 'time', '-b', 'main', '-b', 'radio']
- self.logcat_proc = ProcessHandler(logcat_args, logfile=logcat_log)
- self.logcat_proc.run()
+ self.logcat_proc = self.start_logcat(serial, logfile=logcat_log)
+
+ def start_logcat(self, serial, logfile=None, stream=None, filterspec=None):
+ logcat_args = [self.app_ctx.adb, '-s', '%s' % serial,
+ 'logcat', '-v', 'time', '-b', 'main', '-b', 'radio']
+ # only log filterspec
+ if filterspec:
+ logcat_args.extend(['-s', filterspec])
+ process_args = {}
+ if logfile:
+ process_args['logfile'] = logfile
+ elif stream:
+ process_args['stream'] = stream
+ proc = ProcessHandler(logcat_args, **process_args)
+ proc.run()
+ return proc
def reboot(self):
"""
Reboots the device via adb.
"""
self.dm.reboot(wait=True)
def install_busybox(self, busybox):