зеркало из https://github.com/mozilla/gecko-dev.git
Backout changeset e1bddda508fe for double logging when running mochitests through mach.
This commit is contained in:
Родитель
2550eb2430
Коммит
124aabc9f4
|
@ -61,16 +61,12 @@ class StructuredHumanFormatter(logging.Formatter):
|
|||
Because of this limitation, format() will fail with a KeyError if an
|
||||
unstructured record is passed or if the structured message is malformed.
|
||||
"""
|
||||
def __init__(self, start_time, write_interval=False, write_times=True):
|
||||
def __init__(self, start_time, write_interval=False):
|
||||
self.start_time = start_time
|
||||
self.write_interval = write_interval
|
||||
self.write_times = write_times
|
||||
self.last_time = None
|
||||
|
||||
def format(self, record):
|
||||
if not self.write_times:
|
||||
return record.msg.format(**record.params)
|
||||
|
||||
elapsed = self._time(record)
|
||||
|
||||
return '%s %s' % (format_seconds(elapsed),
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import logging
|
||||
import mozpack.path
|
||||
import os
|
||||
import platform
|
||||
|
@ -21,14 +20,6 @@ from mach.decorators import (
|
|||
Command,
|
||||
)
|
||||
|
||||
from mach.logging import StructuredHumanFormatter
|
||||
|
||||
|
||||
class UnexpectedFilter(logging.Filter):
|
||||
def filter(self, record):
|
||||
return 'TEST-UNEXPECTED-' in record.message
|
||||
|
||||
|
||||
|
||||
class MochitestRunner(MozbuildObject):
|
||||
"""Easily run mochitests.
|
||||
|
@ -79,7 +70,6 @@ class MochitestRunner(MozbuildObject):
|
|||
print('No failure file present. Did you run mochitests before?')
|
||||
return 1
|
||||
|
||||
from StringIO import StringIO
|
||||
from automation import Automation
|
||||
|
||||
# runtests.py is ambiguous, so we load the file/module manually.
|
||||
|
@ -154,28 +144,7 @@ class MochitestRunner(MozbuildObject):
|
|||
if debugger:
|
||||
options.debugger = debugger
|
||||
|
||||
# We need this to enable colorization of output.
|
||||
self.log_manager.enable_unstructured()
|
||||
|
||||
# Output processing is a little funky here. The old make targets
|
||||
# grepped the log output from TEST-UNEXPECTED-* and printed these lines
|
||||
# after test execution. Ideally the test runner would expose a Python
|
||||
# API for obtaining test results and we could just format failures
|
||||
# appropriately. Unfortunately, it doesn't yet do that. So, we capture
|
||||
# all output to a buffer then "grep" the buffer after test execution.
|
||||
# Bug 858197 tracks a Python API that would facilitate this.
|
||||
test_output = StringIO()
|
||||
handler = logging.StreamHandler(test_output)
|
||||
handler.addFilter(UnexpectedFilter())
|
||||
handler.setFormatter(StructuredHumanFormatter(0, write_times=False))
|
||||
logging.getLogger().addHandler(handler)
|
||||
|
||||
result = runner.runTests(options)
|
||||
|
||||
if test_output.getvalue():
|
||||
print(test_output.getvalue())
|
||||
|
||||
return result
|
||||
return runner.runTests(options)
|
||||
|
||||
|
||||
def MochitestCommand(func):
|
||||
|
|
Загрузка…
Ссылка в новой задаче