зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset e6376870fa41 (bug 1344346) for failing at least web-platform-tests and robocop tests. r=backout
This commit is contained in:
Родитель
cfd50106b4
Коммит
2a6e3ab1e6
|
@ -155,10 +155,8 @@ class MessageLogger(object):
|
|||
'chrome://mochitests/content/browser/',
|
||||
'chrome://mochitests/content/chrome/']
|
||||
|
||||
def __init__(self, logger, buffering=True, structured=True):
|
||||
def __init__(self, logger, buffering=True):
|
||||
self.logger = logger
|
||||
self.structured = structured
|
||||
self.gecko_id = 'GECKO'
|
||||
|
||||
# Even if buffering is enabled, we only want to buffer messages between
|
||||
# TEST-START/TEST-END. So it is off to begin, but will be enabled after
|
||||
|
@ -172,12 +170,11 @@ class MessageLogger(object):
|
|||
# Failures reporting, after the end of the tests execution
|
||||
self.errors = []
|
||||
|
||||
def validate(self, obj):
|
||||
"""Tests whether the given object is a valid structured message
|
||||
def valid_message(self, obj):
|
||||
"""True if the given object is a valid structured message
|
||||
(only does a superficial validation)"""
|
||||
if not (isinstance(obj, dict) and 'action' in obj and obj[
|
||||
'action'] in MessageLogger.VALID_ACTIONS):
|
||||
raise ValueError
|
||||
return isinstance(obj, dict) and 'action' in obj and obj[
|
||||
'action'] in MessageLogger.VALID_ACTIONS
|
||||
|
||||
def _fix_test_name(self, message):
|
||||
"""Normalize a logged test path to match the relative path from the sourcedir.
|
||||
|
@ -207,21 +204,18 @@ class MessageLogger(object):
|
|||
continue
|
||||
try:
|
||||
message = json.loads(fragment)
|
||||
self.validate(message)
|
||||
except ValueError:
|
||||
if self.structured:
|
||||
message = dict(
|
||||
action='process_output',
|
||||
process=self.gecko_id,
|
||||
data=fragment,
|
||||
)
|
||||
else:
|
||||
if not self.valid_message(message):
|
||||
message = dict(
|
||||
action='log',
|
||||
level='info',
|
||||
message=fragment,
|
||||
)
|
||||
|
||||
unstructured=True)
|
||||
except ValueError:
|
||||
message = dict(
|
||||
action='log',
|
||||
level='info',
|
||||
message=fragment,
|
||||
unstructured=True)
|
||||
self._fix_test_name(message)
|
||||
self._fix_message_format(message)
|
||||
messages.append(message)
|
||||
|
@ -238,6 +232,11 @@ class MessageLogger(object):
|
|||
self.buffering = False
|
||||
return
|
||||
|
||||
unstructured = False
|
||||
if 'unstructured' in message:
|
||||
unstructured = True
|
||||
message.pop('unstructured')
|
||||
|
||||
# Error detection also supports "raw" errors (in log messages) because some tests
|
||||
# manually dump 'TEST-UNEXPECTED-FAIL'.
|
||||
if ('expected' in message or (message['action'] == 'log' and message[
|
||||
|
@ -259,12 +258,15 @@ class MessageLogger(object):
|
|||
|
||||
# Logging the error message
|
||||
self.logger.log_raw(message)
|
||||
# Determine if message should be buffered
|
||||
elif self.buffering and self.structured and message['action'] in self.BUFFERED_ACTIONS:
|
||||
self.buffered_messages.append(message)
|
||||
# Otherwise log the message directly
|
||||
else:
|
||||
# If we don't do any buffering, or the tests haven't started, or the message was
|
||||
# unstructured, it is directly logged.
|
||||
elif any([not self.buffering,
|
||||
unstructured,
|
||||
message['action'] not in self.BUFFERED_ACTIONS]):
|
||||
self.logger.log_raw(message)
|
||||
else:
|
||||
# Buffering the message
|
||||
self.buffered_messages.append(message)
|
||||
|
||||
# If a test ended, we clean the buffer
|
||||
if message['action'] == 'test_end':
|
||||
|
@ -791,9 +793,8 @@ class MochitestDesktop(object):
|
|||
# TODO: replace this with 'runtests.py' or 'mochitest' or the like
|
||||
test_name = 'automation.py'
|
||||
|
||||
def __init__(self, flavor, logger_options, quiet=False):
|
||||
def __init__(self, logger_options, quiet=False):
|
||||
self.update_mozinfo()
|
||||
self.flavor = flavor
|
||||
self.server = None
|
||||
self.wsserver = None
|
||||
self.websocketProcessBridge = None
|
||||
|
@ -819,12 +820,7 @@ class MochitestDesktop(object):
|
|||
})
|
||||
MochitestDesktop.log = self.log
|
||||
|
||||
# Jetpack flavors still don't use the structured logger. We need to process their output
|
||||
# slightly differently.
|
||||
structured = not self.flavor.startswith('jetpack')
|
||||
self.message_logger = MessageLogger(
|
||||
logger=self.log, buffering=quiet, structured=structured)
|
||||
|
||||
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.
|
||||
|
@ -2081,10 +2077,7 @@ toolbar#nav-bar {
|
|||
outputTimeout=timeout)
|
||||
proc = runner.process_handler
|
||||
self.log.info("runtests.py | Application pid: %d" % proc.pid)
|
||||
|
||||
gecko_id = "GECKO(%d)" % proc.pid
|
||||
self.log.process_start(gecko_id)
|
||||
self.message_logger.gecko_id = gecko_id
|
||||
self.log.process_start("Main app process")
|
||||
|
||||
# start marionette and kick off the tests
|
||||
marionette_args = marionette_args or {}
|
||||
|
@ -2750,7 +2743,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(options.flavor, logger_options, quiet=options.quiet)
|
||||
runner = MochitestDesktop(logger_options, quiet=options.quiet)
|
||||
|
||||
options.runByDir = False
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ class MochiRemote(MochitestDesktop):
|
|||
logMessages = []
|
||||
|
||||
def __init__(self, automation, devmgr, options):
|
||||
MochitestDesktop.__init__(self, options.flavor, options)
|
||||
MochitestDesktop.__init__(self, options)
|
||||
|
||||
self._automation = automation
|
||||
self._dm = devmgr
|
||||
|
|
Загрузка…
Ссылка в новой задаче