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 602675 90fdc2e891c7b2cc20b0d48f4b16aef5357fd953
parent 599350 36d6d89e01c5ddd80e63a3792d8d3a374de5a103
child 602676 808bb8a88eac3ba36dacb9751b5668c399d73744
push id92034
push userjames@hoppipolla.co.uk
push dateWed, 07 Oct 2015 23:30:17 +0000
treeherdertry@808bb8a88eac [default view] [failures only]
reviewerschmanchester
bugs1207747
milestone44.0a1
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
@@ -1420,17 +1420,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