Bug 1055679 - Remove marionette's ad hoc log formatter now that it's no longer needed.;r=jgraham
authorChris Manchester <cmanchester@mozilla.com>
Sun, 24 Aug 2014 16:45:01 -0400
changeset 201257 eb09f73f2582d99dff99cdd6d497dc311772345d
parent 201256 48790a0a737ca3cb859a5a1ccab562b95e2d4441
child 201258 efece5e33d8252b42104dc435d82516119d43d3f
push id48134
push usercmanchester@mozilla.com
push dateSun, 24 Aug 2014 20:45:09 +0000
treeherdermozilla-inbound@eb09f73f2582 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgraham
bugs1055679
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1055679 - Remove marionette's ad hoc log formatter now that it's no longer needed.;r=jgraham
testing/marionette/client/marionette/runtests.py
--- a/testing/marionette/client/marionette/runtests.py
+++ b/testing/marionette/client/marionette/runtests.py
@@ -3,37 +3,16 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 import sys
 
 from marionette_test import MarionetteTestCase, MarionetteJSTestCase
 from mozlog import structured
 from runner import BaseMarionetteTestRunner, BaseMarionetteOptions
 
-class MarionetteTbplFormatter(structured.formatters.TbplFormatter):
-    """Formatter that logs failures in a format that agrees with legacy
-    log data used by tbpl."""
-
-    def test_end(self, data):
-        # TBPL ui expects relevant info about an exception to appear in the first
-        # line of the log message, however tracebacks provided by marionette
-        # put this information on the last line.
-        if "message" in data:
-            message_lines = [line for line in data["message"].splitlines() if line != ""]
-            if "Traceback" in message_lines[0]:
-                exc_msg_index = None
-                for index, line in enumerate(message_lines):
-                    if "Error: " in line or "Exception: " in line:
-                        exc_msg_index = index
-                        break
-                if exc_msg_index:
-                    message_lines = (message_lines[exc_msg_index:] +
-                                     message_lines[:exc_msg_index])
-            data["message"] = "\n".join(message_lines)
-        return super(MarionetteTbplFormatter, self).test_end(data)
 
 class MarionetteTestRunner(BaseMarionetteTestRunner):
     def __init__(self, **kwargs):
         BaseMarionetteTestRunner.__init__(self, **kwargs)
         self.test_handlers = [MarionetteTestCase, MarionetteJSTestCase]
 
 def startTestRunner(runner_class, options, tests):
 
@@ -44,25 +23,17 @@ def startTestRunner(runner_class, option
 
 def cli(runner_class=MarionetteTestRunner, parser_class=BaseMarionetteOptions):
     parser = parser_class(usage='%prog [options] test_file_or_dir <test_file_or_dir> ...')
     structured.commandline.add_logging_group(parser)
     options, tests = parser.parse_args()
     parser.verify_usage(options, tests)
 
     logger = structured.commandline.setup_logging(
-        options.logger_name, options, {})
-
-    # Only add the tbpl logger if a handler isn't already logging to stdout
-    has_stdout_logger = any([h.stream == sys.stdout for h in logger.handlers])
-    if not has_stdout_logger:
-        formatter = MarionetteTbplFormatter()
-        handler = structured.handlers.StreamHandler(sys.stdout, formatter)
-        logger.add_handler(structured.handlers.LogLevelFilter(
-            handler, 'info'))
+        options.logger_name, options, {"tbpl": sys.stdout})
 
     options.logger = logger
 
     runner = startTestRunner(runner_class, options, tests)
     if runner.failed > 0:
         sys.exit(10)
 
 if __name__ == "__main__":