Bug 908340 - Omit test start messages from mach xpcshell output; r=gps
authorChris Manchester <cmanchester@mozilla.com>
Thu, 22 Aug 2013 18:54:26 -0700
changeset 156941 a970626be5c9f1b918ff3bfd8ba7eb300b5bde91
parent 156940 0b6aa8fab175e2dbd65f23c337d5c18765a331cc
child 156942 1ad8a6674785c40cac52fe88d2e615fadc955683
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs908340
milestone26.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 908340 - Omit test start messages from mach xpcshell output; r=gps
testing/xpcshell/mach_commands.py
--- a/testing/xpcshell/mach_commands.py
+++ b/testing/xpcshell/mach_commands.py
@@ -2,16 +2,17 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 # Integrates the xpcshell test runner with mach.
 
 from __future__ import unicode_literals, print_function
 
 import mozpack.path
+import logging
 import os
 import shutil
 import sys
 
 from StringIO import StringIO
 
 from mozbuild.base import (
     MachCommandBase,
@@ -25,16 +26,20 @@ from mach.decorators import (
 )
 
 
 if sys.version_info[0] < 3:
     unicode_type = unicode
 else:
     unicode_type = str
 
+# Simple filter to omit the message emitted as a test file begins.
+class TestStartFilter(logging.Filter):
+    def filter(self, record):
+        return not record.params['msg'].endswith("running test ...")
 
 # This should probably be consolidated with similar classes in other test
 # runners.
 class InvalidTestPathError(Exception):
     """Exception raised when the test path is not valid."""
 
 
 class XPCShellRunner(MozbuildObject):
@@ -107,16 +112,19 @@ class XPCShellRunner(MozbuildObject):
 
         # Obtain a reference to the xpcshell test runner.
         import runxpcshelltests
 
         dummy_log = StringIO()
         xpcshell = runxpcshelltests.XPCShellTests(log=dummy_log)
         self.log_manager.enable_unstructured()
 
+        xpcshell_filter = TestStartFilter()
+        self.log_manager.terminal_handler.addFilter(xpcshell_filter)
+
         tests_dir = os.path.join(self.topobjdir, '_tests', 'xpcshell')
         modules_dir = os.path.join(self.topobjdir, '_tests', 'modules')
 
         args = {
             'xpcshell': os.path.join(self.bindir, 'xpcshell'),
             'mozInfo': os.path.join(self.topobjdir, 'mozinfo.json'),
             'symbolsPath': os.path.join(self.distdir, 'crashreporter-symbols'),
             'interactive': interactive,
@@ -174,16 +182,17 @@ class XPCShellRunner(MozbuildObject):
 
             if isinstance(k, unicode_type):
                 k = k.encode('utf-8')
 
             filtered_args[k] = v
 
         result = xpcshell.runTests(**filtered_args)
 
+        self.log_manager.terminal_handler.removeFilter(xpcshell_filter)
         self.log_manager.disable_unstructured()
 
         if not result and not xpcshell.sequential:
             print("Tests were run in parallel. Try running with --sequential "
                   "to make sure the failures were not caused by this.")
         return int(not result)