Bug 1207747 - Ensure that logging command line options are always available when running xpcshell tests, r=chmanchester
authorJames Graham <james@hoppipolla.co.uk>
Thu, 08 Oct 2015 00:29:39 +0100
changeset 266839 02aa09bd9a826ce453d9e374371d9c1442525f1b
parent 266838 657c9f974bdf493a175434fdac701fcd58a935c1
child 266840 a61652a27e8cc83682b24a9f920df0955b4720b4
push id29499
push userkwierso@gmail.com
push dateThu, 08 Oct 2015 21:29:10 +0000
treeherdermozilla-central@46da59584acb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschmanchester
bugs1207747
milestone44.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 1207747 - Ensure that logging command line options are always available when running xpcshell tests, r=chmanchester
testing/xpcshell/remotexpcshelltests.py
testing/xpcshell/runtestsb2g.py
testing/xpcshell/runxpcshelltests.py
testing/xpcshell/xpcshellcommandline.py
--- a/testing/xpcshell/remotexpcshelltests.py
+++ b/testing/xpcshell/remotexpcshelltests.py
@@ -568,17 +568,16 @@ class PathMapping:
         self.remote = remoteDir
 
 def main():
     if sys.version_info < (2,7):
         print >>sys.stderr, "Error: You must use python version 2.7 or newer but less than 3.0"
         sys.exit(1)
 
     parser = parser_remote()
-    commandline.add_logging_group(parser)
     options = parser.parse_args()
     if not options.localAPK:
         for file in os.listdir(os.path.join(options.objdir, "dist")):
             if (file.endswith(".apk") and file.startswith("fennec")):
                 options.localAPK = os.path.join(options.objdir, "dist")
                 options.localAPK = os.path.join(options.localAPK, file)
                 print >>sys.stderr, "using APK: " + options.localAPK
                 break
--- a/testing/xpcshell/runtestsb2g.py
+++ b/testing/xpcshell/runtestsb2g.py
@@ -143,17 +143,16 @@ def run_remote_xpcshell(parser, options,
             sys.exit(1)
     except:
         print "Automation Error: Exception caught while running tests"
         traceback.print_exc()
         sys.exit(1)
 
 def main():
     parser = parser_b2g()
-    commandline.add_logging_group(parser)
     options = parser.parse_args()
     log = commandline.setup_logging("Remote XPCShell",
                                     options,
                                     {"tbpl": sys.stdout})
     run_remote_xpcshell(parser, options, log)
 
 # You usually run this like :
 # python runtestsb2g.py --emulator arm --b2gpath $B2GPATH --manifest $MANIFEST [--xre-path $MOZ_HOST_BIN
--- a/testing/xpcshell/runxpcshelltests.py
+++ b/testing/xpcshell/runxpcshelltests.py
@@ -1423,17 +1423,16 @@ class XPCShellTests(object):
             return False
 
         self.log.suite_end()
         return self.failCount == 0
 
 
 def main():
     parser = parser_desktop()
-    commandline.add_logging_group(parser)
     options = parser.parse_args()
 
     log = commandline.setup_logging("XPCShell", options, {"tbpl": sys.stdout})
 
     if options.xpcshell is None:
         print >> sys.stderr, """Must provide path to xpcshell using --xpcshell"""
 
     xpcsh = XPCShellTests(log)
--- a/testing/xpcshell/xpcshellcommandline.py
+++ b/testing/xpcshell/xpcshellcommandline.py
@@ -1,10 +1,12 @@
 import argparse
 
+from mozlog import commandline
+
 def add_common_arguments(parser):
     parser.add_argument("--app-path",
                         type=unicode, dest="appPath", default=None,
                         help="application directory (as opposed to XRE directory)")
     parser.add_argument("--interactive",
                         action="store_true", dest="interactive", default=False,
                         help="don't automatically run tests, drop to an xpcshell prompt")
     parser.add_argument("--verbose",
@@ -174,29 +176,33 @@ def add_b2g_arguments(parser):
                         help="Path to busybox binary to install on device")
 
     parser.set_defaults(remoteTestRoot="/data/local/tests",
                         dm_trans="adb")
 
 def parser_desktop():
     parser = argparse.ArgumentParser()
     add_common_arguments(parser)
+    commandline.add_logging_group(parser)
+
     return parser
 
 def parser_remote():
     parser = argparse.ArgumentParser()
     common = parser.add_argument_group("Common Options")
     add_common_arguments(common)
     remote = parser.add_argument_group("Remote Options")
     add_remote_arguments(remote)
+    commandline.add_logging_group(parser)
 
     return parser
 
 def parser_b2g():
     parser = argparse.ArgumentParser()
     common = parser.add_argument_group("Common Options")
     add_common_arguments(common)
     remote = parser.add_argument_group("Remote Options")
     add_remote_arguments(remote)
     b2g = parser.add_argument_group("B2G Options")
     add_b2g_arguments(b2g)
+    commandline.add_logging_group(parser)
 
     return parser