зеркало из https://github.com/mozilla/gecko-dev.git
Bug 873035 - add a new --gecko-log option to redirect gecko logs to a specified file. r=jgriffin
This commit is contained in:
Родитель
fb8cfc497a
Коммит
d5e0e1020e
|
@ -3,6 +3,7 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/
|
||||
|
||||
import os
|
||||
import time
|
||||
|
||||
from mozprofile import Profile
|
||||
from mozrunner import Runner
|
||||
|
@ -19,7 +20,8 @@ class GeckoInstance(object):
|
|||
"browser.sessionstore.resume_from_crash": False,
|
||||
"browser.warnOnQuit": False}
|
||||
|
||||
def __init__(self, host, port, bin, profile, app_args=None, symbols_path=None):
|
||||
def __init__(self, host, port, bin, profile, app_args=None, symbols_path=None,
|
||||
gecko_log=None):
|
||||
self.marionette_host = host
|
||||
self.marionette_port = port
|
||||
self.bin = bin
|
||||
|
@ -27,6 +29,7 @@ class GeckoInstance(object):
|
|||
self.app_args = app_args or []
|
||||
self.runner = None
|
||||
self.symbols_path = symbols_path
|
||||
self.gecko_log = gecko_log
|
||||
|
||||
def start(self):
|
||||
profile_path = self.profile
|
||||
|
@ -38,7 +41,13 @@ class GeckoInstance(object):
|
|||
runner_class = CloneRunner
|
||||
profile_args["path_from"] = profile_path
|
||||
|
||||
self.gecko_log = os.path.abspath('gecko.log')
|
||||
if self.gecko_log is None:
|
||||
self.gecko_log = 'gecko.log'
|
||||
elif os.path.isdir(self.gecko_log):
|
||||
fname = "gecko-%d.log" % time.time()
|
||||
self.gecko_log = os.path.join(self.gecko_log, fname)
|
||||
|
||||
self.gecko_log = os.path.realpath(self.gecko_log)
|
||||
if os.access(self.gecko_log, os.F_OK):
|
||||
os.remove(self.gecko_log)
|
||||
|
||||
|
|
|
@ -452,7 +452,7 @@ class Marionette(object):
|
|||
emulatorImg=None, emulator_res=None, gecko_path=None,
|
||||
connectToRunningEmulator=False, homedir=None, baseurl=None,
|
||||
noWindow=False, logcat_dir=None, busybox=None, symbols_path=None,
|
||||
timeout=None, device_serial=None):
|
||||
timeout=None, device_serial=None, gecko_log=None):
|
||||
self.host = host
|
||||
self.port = self.local_port = port
|
||||
self.bin = bin
|
||||
|
@ -494,7 +494,8 @@ class Marionette(object):
|
|||
instance_class = geckoinstance.GeckoInstance
|
||||
self.instance = instance_class(host=self.host, port=self.port,
|
||||
bin=self.bin, profile=self.profile,
|
||||
app_args=app_args, symbols_path=symbols_path)
|
||||
app_args=app_args, symbols_path=symbols_path,
|
||||
gecko_log=gecko_log)
|
||||
self.instance.start()
|
||||
assert(self.wait_for_port()), "Timed out waiting for port!"
|
||||
|
||||
|
|
|
@ -481,6 +481,13 @@ class BaseMarionetteOptions(OptionParser):
|
|||
dest='server_root',
|
||||
action='store',
|
||||
help='sets the web server\'s root directory to the given path')
|
||||
self.add_option('--gecko-log',
|
||||
dest='gecko_log',
|
||||
action='store',
|
||||
help="Define the path to store log file. If the path is"
|
||||
" a directory, the real log file will be created"
|
||||
" given the format gecko-(timestamp).log. If it is"
|
||||
" a file, if will be used directly. Default: 'gecko.log'")
|
||||
|
||||
def parse_args(self, args=None, values=None):
|
||||
options, tests = OptionParser.parse_args(self, args, values)
|
||||
|
@ -552,6 +559,7 @@ class BaseMarionetteTestRunner(object):
|
|||
testvars=None, tree=None, type=None, device_serial=None,
|
||||
symbols_path=None, timeout=None, es_servers=None, shuffle=False,
|
||||
sdcard=None, this_chunk=1, total_chunks=1, sources=None, server_root=None,
|
||||
gecko_log=None,
|
||||
**kwargs):
|
||||
self.address = address
|
||||
self.emulator = emulator
|
||||
|
@ -591,6 +599,7 @@ class BaseMarionetteTestRunner(object):
|
|||
self.server_root = server_root
|
||||
self.this_chunk = this_chunk
|
||||
self.total_chunks = total_chunks
|
||||
self.gecko_log = gecko_log
|
||||
self.mixin_run_tests = []
|
||||
self.manifest_skipped_tests = []
|
||||
self.tests = []
|
||||
|
@ -687,6 +696,7 @@ class BaseMarionetteTestRunner(object):
|
|||
'app_args': self.app_args,
|
||||
'bin': self.bin,
|
||||
'profile': self.profile,
|
||||
'gecko_log': self.gecko_log,
|
||||
})
|
||||
|
||||
if self.emulator:
|
||||
|
|
Загрузка…
Ссылка в новой задаче