Bug 1310215 - Add a verbose argument to mach install which provides useful information in case the android emulator startup fails. r?ahal draft
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 14 Oct 2016 10:46:42 -0400
changeset 425315 0544c031ecbc0ad8477670a7bc8ab7f7519f5be9
parent 425306 cb2dd5a34dd7b374500fedd72fe19df13c9a7a4d
child 533892 877fb2258e80c6009d5b645ac8c415b3ebc3f72c
push id32396
push userkgupta@mozilla.com
push dateFri, 14 Oct 2016 14:47:22 +0000
reviewersahal
bugs1310215
milestone52.0a1
Bug 1310215 - Add a verbose argument to mach install which provides useful information in case the android emulator startup fails. r?ahal MozReview-Commit-ID: 8oqyHaGyDHV
python/mozbuild/mozbuild/mach_commands.py
testing/mozbase/mozrunner/mozrunner/devices/android_device.py
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -1071,20 +1071,22 @@ class Package(MachCommandBase):
         return ret
 
 @CommandProvider
 class Install(MachCommandBase):
     """Install a package."""
 
     @Command('install', category='post-build',
         description='Install the package on the machine, or on a device.')
-    def install(self):
+    @CommandArgument('--verbose', '-v', action='store_true',
+        help='Print verbose output.')
+    def install(self, verbose=False):
         if conditions.is_android(self):
             from mozrunner.devices.android_device import verify_android_device
-            verify_android_device(self)
+            verify_android_device(self, verbose=verbose)
         ret = self._run_make(directory=".", target='install', ensure_exit_code=False)
         if ret == 0:
             self.notify('Install complete')
         return ret
 
 @CommandProvider
 class RunProgram(MachCommandBase):
     """Run the compiled program."""
--- a/testing/mozbase/mozrunner/mozrunner/devices/android_device.py
+++ b/testing/mozbase/mozrunner/mozrunner/devices/android_device.py
@@ -70,33 +70,33 @@ AVD_DICT = {
                    'testing/config/tooltool-manifests/androidx86/releng.manifest',
                    ['-gpu', 'swiftshader', '-debug',
                     'init,console,gles,memcheck,adbserver,adbclient,adb,avd_config,socket',
                     '-qemu', '-m', '1024', '-enable-kvm'],
                    5554)
 }
 
 
-def verify_android_device(build_obj, install=False, xre=False, debugger=False):
+def verify_android_device(build_obj, install=False, xre=False, debugger=False, verbose=False):
     """
        Determine if any Android device is connected via adb.
        If no device is found, prompt to start an emulator.
        If a device is found or an emulator started and 'install' is
        specified, also check whether Firefox is installed on the
        device; if not, prompt to install Firefox.
        If 'xre' is specified, also check with MOZ_HOST_BIN is set
        to a valid xre/host-utils directory; if not, prompt to set
        one up.
        If 'debugger' is specified, also check that JimDB is installed;
        if JimDB is not found, prompt to set up JimDB.
        Returns True if the emulator was started or another device was
        already connected.
     """
     device_verified = False
-    emulator = AndroidEmulator('*', substs=build_obj.substs)
+    emulator = AndroidEmulator('*', substs=build_obj.substs, verbose=verbose)
     devices = emulator.dm.devices()
     if (len(devices) > 0) and ('device' in [d[1] for d in devices]):
         device_verified = True
     elif emulator.is_available():
         response = raw_input(
             "No Android devices connected. Start an emulator? (Y/n) ").strip()
         if response.lower().startswith('y') or response == '':
             if not emulator.check_avd():