Bug 1355222 - When debug logging requested for android mach test commands, enable devicemanager logging; r=jmaher
authorGeoff Brown <gbrown@mozilla.com>
Tue, 11 Apr 2017 09:21:37 -0600
changeset 352439 d6697d89d054deadede94ded4857fa50e5ccef02
parent 352438 edef97549a8c8121512dc034b280c444495bb2f5
child 352440 ac1495e2252bca30f4566070b0b32ebf8f26b9f9
push id31640
push userihsiao@mozilla.com
push dateWed, 12 Apr 2017 03:17:33 +0000
treeherdermozilla-central@f40e24f40b4c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs1355222
milestone55.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 1355222 - When debug logging requested for android mach test commands, enable devicemanager logging; r=jmaher
layout/tools/reftest/remotereftest.py
testing/mochitest/mochitest_options.py
testing/remotecppunittests.py
testing/xpcshell/remotexpcshelltests.py
--- a/layout/tools/reftest/remotereftest.py
+++ b/layout/tools/reftest/remotereftest.py
@@ -1,13 +1,14 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # 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/.
 
 import sys
+import logging
 import os
 import time
 import tempfile
 import traceback
 import urllib2
 
 import mozdevice
 import mozinfo
@@ -335,16 +336,18 @@ def run_test_harness(parser, options):
         'deviceRoot': options.remoteTestRoot,
         'host': options.deviceIP,
         'port': options.devicePort,
     }
 
     dm_args['adbPath'] = options.adb_path
     if not dm_args['host']:
         dm_args['deviceSerial'] = options.deviceSerial
+    if options.log_tbpl_level == 'debug' or options.log_mach_level == 'debug':
+        dm_args['logLevel'] = logging.DEBUG
 
     try:
         dm = mozdevice.DroidADB(**dm_args)
     except mozdevice.DMError:
         traceback.print_exc()
         print ("Automation Error: exception while initializing devicemanager.  "
                "Most likely the device is not in a testable state.")
         return 1
--- a/testing/mochitest/mochitest_options.py
+++ b/testing/mochitest/mochitest_options.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/.
 
 from abc import ABCMeta, abstractmethod, abstractproperty
 from argparse import ArgumentParser, SUPPRESS
 from distutils.util import strtobool
 from itertools import chain
 from urlparse import urlparse
+import logging
 import json
 import os
 import tempfile
 
 from mozdevice import DroidADB
 from mozprofile import DEFAULT_PORTS
 import mozinfo
 import mozlog
@@ -952,16 +953,19 @@ class AndroidArguments(ArgumentContainer
 
         device_args = {'deviceRoot': options.remoteTestRoot}
         device_args['adbPath'] = options.adbPath
         if options.deviceIP:
             device_args['host'] = options.deviceIP
             device_args['port'] = options.devicePort
         elif options.deviceSerial:
             device_args['deviceSerial'] = options.deviceSerial
+
+        if options.log_tbpl_level == 'debug' or options.log_mach_level == 'debug':
+            device_args['logLevel'] = logging.DEBUG
         options.dm = DroidADB(**device_args)
 
         if not options.remoteTestRoot:
             options.remoteTestRoot = options.dm.deviceRoot
 
         if options.remoteWebServer is None:
             if os.name != "nt":
                 options.remoteWebServer = moznetwork.get_ip()
--- a/testing/remotecppunittests.py
+++ b/testing/remotecppunittests.py
@@ -212,20 +212,24 @@ def run_test_harness(options, args):
         runner = B2GEmulatorRunner(arch=options.emulator, b2g_home=options.with_b2g_emulator)
         runner.start()
         # because we just started the emulator, we need more than the
         # default number of retries here.
         retryLimit = 50
     else:
         retryLimit = 5
     try:
+        dm_args = {'deviceRoot': options.remote_test_root}
+        dm_args['retryLimit'] = retryLimit
         if options.device_ip:
-            dm = devicemanagerADB.DeviceManagerADB(options.device_ip, options.device_port, packageName=None, deviceRoot=options.remote_test_root, retryLimit=retryLimit)
-        else:
-            dm = devicemanagerADB.DeviceManagerADB(packageName=None, deviceRoot=options.remote_test_root, retryLimit=retryLimit)
+            dm_args['host'] = options.device_ip
+            dm_args['port'] = options.device_port
+        if options.log_tbpl_level == 'debug' or options.log_mach_level == 'debug':
+            dm_args['logLevel'] = logging.DEBUG
+        dm = devicemanagerADB.DeviceManagerADB(**dm_args)
     except:
         if options.with_b2g_emulator:
             runner.cleanup()
             runner.wait()
         raise
 
     options.xre_path = os.path.abspath(options.xre_path)
     cppunittests.update_mozinfo()
--- a/testing/xpcshell/remotexpcshelltests.py
+++ b/testing/xpcshell/remotexpcshelltests.py
@@ -1,14 +1,15 @@
 #!/usr/bin/env python
 #
 # This Source Code Form is subject to the terms of the Mozilla Public
 # 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/.
 
+import logging
 import posixpath
 import sys, os
 import subprocess
 import runxpcshelltests as xpcshell
 import tempfile
 import time
 from zipfile import ZipFile
 from mozlog import commandline
@@ -573,20 +574,23 @@ def main():
             print >>sys.stderr, "Error: please specify an APK"
             sys.exit(1)
 
     options = verifyRemoteOptions(parser, options)
     log = commandline.setup_logging("Remote XPCShell",
                                     options,
                                     {"tbpl": sys.stdout})
 
+    dm_args = {'deviceRoot': options.remoteTestRoot}
     if options.deviceIP:
-        dm = mozdevice.DroidADB(options.deviceIP, options.devicePort, packageName=None, deviceRoot=options.remoteTestRoot)
-    else:
-        dm = mozdevice.DroidADB(packageName=None, deviceRoot=options.remoteTestRoot)
+        dm_args['host'] = options.deviceIP
+        dm_args['port'] = options.devicePort
+    if options.log_tbpl_level == 'debug' or options.log_mach_level == 'debug':
+        dm_args['logLevel'] = logging.DEBUG
+    dm = mozdevice.DroidADB(**dm_args)
 
     if options.interactive and not options.testPath:
         print >>sys.stderr, "Error: You must specify a test filename in interactive mode!"
         sys.exit(1)
 
     if options.xpcshell is None:
         options.xpcshell = "xpcshell"