Bug 1020516 - Pass options.quiet into mochitest MessageLogger via constructor, r=ted

For some reason we have a 'buffering' parameter in the MessageLogger constructor, but
then rather than using this, the mochitest harness modifies state after instantiation.
Using the constructor is easier to understand, and simplifies some of the logic in the
next couple of patches.

MozReview-Commit-ID: Jkd9hOlmiGZ

--HG--
extra : rebase_source : eb2b5b7d647d69229cca5495f6f950c5fcf80809
This commit is contained in:
Andrew Halberstadt 2016-11-02 13:42:57 -04:00
Родитель 2b0c1a59c5
Коммит 3dc38de703
2 изменённых файлов: 3 добавлений и 11 удалений

Просмотреть файл

@ -90,7 +90,6 @@ here = os.path.abspath(os.path.dirname(__file__))
# Try run will then put a download link for all log files
# on tbpl.mozilla.org.
# MOZ_LOG = "signaling:3,mtransport:4,DataChannel:4,jsep:4,MediaPipelineFactory:4"
MOZ_LOG = ""
#####################
@ -771,7 +770,7 @@ class MochitestDesktop(object):
# TODO: replace this with 'runtests.py' or 'mochitest' or the like
test_name = 'automation.py'
def __init__(self, logger_options):
def __init__(self, logger_options, quiet=False):
self.update_mozinfo()
self.server = None
self.wsserver = None
@ -797,7 +796,7 @@ class MochitestDesktop(object):
})
MochitestDesktop.log = self.log
self.message_logger = MessageLogger(logger=self.log)
self.message_logger = MessageLogger(logger=self.log, buffering=quiet)
# Max time in seconds to wait for server startup before tests will fail -- if
# this seems big, it's mostly for debug machines where cold startup
# (particularly after a build) takes forever.
@ -1873,17 +1872,12 @@ toolbar#nav-bar {
detectShutdownLeaks=False,
screenshotOnFail=False,
bisectChunk=None,
quiet=False,
marionette_args=None):
"""
Run the app, log the duration it took to execute, return the status code.
Kills the app if it runs for longer than |maxTime| seconds, or outputs nothing
for |timeout| seconds.
"""
# configure the message logger buffering
self.message_logger.buffering = quiet
# It can't be the case that both a with-debugger and an
# on-Valgrind run have been requested. doTests() should have
# already excluded this possibility.
@ -2396,7 +2390,6 @@ toolbar#nav-bar {
detectShutdownLeaks=detectShutdownLeaks,
screenshotOnFail=options.screenshotOnFail,
bisectChunk=options.bisectChunk,
quiet=options.quiet,
marionette_args=marionette_args,
)
except KeyboardInterrupt:
@ -2660,7 +2653,7 @@ def run_test_harness(parser, options):
key: value for key, value in vars(options).iteritems()
if key.startswith('log') or key == 'valgrind'}
runner = MochitestDesktop(logger_options)
runner = MochitestDesktop(logger_options, quiet=options.quiet)
options.runByDir = False

Просмотреть файл

@ -287,7 +287,6 @@ class MochiRemote(MochitestDesktop):
# remove args not supported by automation.py
kwargs.pop('marionette_args', None)
kwargs.pop('quiet', None)
return self._automation.runApp(*args, **kwargs)