Bug 1575667 - Add --no-install option for android mach reftest and gtest; r=bc
authorGeoff Brown <gbrown@mozilla.com>
Mon, 26 Aug 2019 13:45:10 +0000
changeset 553633 c2be41ddc0be54e96ee12ade39b29514b6c17e96
parent 553632 5c1b813d7ef5225e6cae63f8b7c9a9bde42e9ccd
child 553634 025d1028313e06933dba9394650dc0f32c68e5e1
push id2165
push userffxbld-merge
push dateMon, 14 Oct 2019 16:30:58 +0000
treeherdermozilla-release@0eae18af659f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbc
bugs1575667
milestone70.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 1575667 - Add --no-install option for android mach reftest and gtest; r=bc Straight-forward addition of the --no-install option for reftest, just like the existing option for mochitest. For gtest, I alos noticed the mach command help needed some cleanup. Differential Revision: https://phabricator.services.mozilla.com/D43299
layout/tools/reftest/mach_commands.py
layout/tools/reftest/reftestcommandline.py
python/mozbuild/mozbuild/mach_commands.py
--- a/layout/tools/reftest/mach_commands.py
+++ b/layout/tools/reftest/mach_commands.py
@@ -232,12 +232,13 @@ class MachCommands(MachCommandBase):
         kwargs["topsrcdir"] = self.topsrcdir
         process_test_objects(kwargs)
         reftest = self._spawn(ReftestRunner)
         # Unstructured logging must be enabled prior to calling
         # adb which uses an unstructured logger in its constructor.
         reftest.log_manager.enable_unstructured()
         if conditions.is_android(self):
             from mozrunner.devices.android_device import verify_android_device
-            verify_android_device(self, install=True, xre=True, network=True,
+            install = not kwargs.get('no_install')
+            verify_android_device(self, install=install, xre=True, network=True,
                                   app=kwargs["app"], device_serial=kwargs["deviceSerial"])
             return reftest.run_android_test(**kwargs)
         return reftest.run_desktop_test(**kwargs)
--- a/layout/tools/reftest/reftestcommandline.py
+++ b/layout/tools/reftest/reftestcommandline.py
@@ -459,16 +459,21 @@ class RemoteArgumentsParser(ReftestArgum
                           help="Path to the httpd.js file.")
 
         self.add_argument("--no-device-info",
                           action="store_false",
                           dest="printDeviceInfo",
                           default=True,
                           help="Do not display verbose diagnostics about the remote device.")
 
+        self.add_argument("--no-install",
+                          action="store_true",
+                          default=False,
+                          help="Skip the installation of the APK.")
+
     def validate_remote(self, options, automation):
         if options.remoteWebServer is None:
             options.remoteWebServer = self.get_ip()
 
         if options.remoteWebServer == '127.0.0.1':
             self.error("ERROR: Either you specified the loopback for the remote webserver or ",
                        "your local IP cannot be detected.  "
                        "Please provide the local ip in --remote-webserver")
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -413,50 +413,60 @@ class GTestCommands(MachCommandBase):
                      "(called the positive patterns), optionally followed by a '-' "
                      "and another ':'-separated pattern list (called the negative patterns).")
     @CommandArgument('--jobs', '-j', default='1', nargs='?', metavar='jobs', type=int,
                      help='Run the tests in parallel using multiple processes.')
     @CommandArgument('--tbpl-parser', '-t', action='store_true',
                      help='Output test results in a format that can be parsed by TBPL.')
     @CommandArgument('--shuffle', '-s', action='store_true',
                      help='Randomize the execution order of tests.')
+    @CommandArgument('--enable-webrender', action='store_true',
+                     default=False, dest='enable_webrender',
+                     help='Enable the WebRender compositor in Gecko.')
+    @CommandArgumentGroup('Android')
     @CommandArgument('--package',
                      default='org.mozilla.geckoview.test',
-                     help='(Android only) Package name of test app.')
+                     group='Android',
+                     help='Package name of test app.')
     @CommandArgument('--adbpath',
                      dest='adb_path',
-                     help='(Android only) Path to adb binary.')
+                     group='Android',
+                     help='Path to adb binary.')
     @CommandArgument('--deviceSerial',
                      dest='device_serial',
-                     help="(Android only) adb serial number of remote device. "
+                     group='Android',
+                     help="adb serial number of remote device. "
                      "Required when more than one device is connected to the host. "
                      "Use 'adb devices' to see connected devices.")
     @CommandArgument('--remoteTestRoot',
                      dest='remote_test_root',
-                     help='(Android only) Remote directory to use as test root '
+                     group='Android',
+                     help='Remote directory to use as test root '
                      '(eg. /mnt/sdcard/tests or /data/local/tests).')
     @CommandArgument('--libxul',
                      dest='libxul_path',
-                     help='(Android only) Path to gtest libxul.so.')
-    @CommandArgument('--enable-webrender', action='store_true',
-                     default=False, dest='enable_webrender',
-                     help='Enable the WebRender compositor in Gecko.')
+                     group='Android',
+                     help='Path to gtest libxul.so.')
+    @CommandArgument('--no-install', action='store_true',
+                     default=False,
+                     group='Android',
+                     help='Skip the installation of the APK.')
     @CommandArgumentGroup('debugging')
     @CommandArgument('--debug', action='store_true', group='debugging',
                      help='Enable the debugger. Not specifying a --debugger option will result in '
                      'the default debugger being used.')
     @CommandArgument('--debugger', default=None, type=str, group='debugging',
                      help='Name of debugger to use.')
     @CommandArgument('--debugger-args', default=None, metavar='params', type=str,
                      group='debugging',
                      help='Command-line arguments to pass to the debugger itself; '
                      'split as the Bourne shell would.')
-    def gtest(self, shuffle, jobs, gtest_filter, tbpl_parser,
-              package, adb_path, device_serial, remote_test_root, libxul_path,
-              enable_webrender, debug, debugger, debugger_args):
+    def gtest(self, shuffle, jobs, gtest_filter, tbpl_parser, enable_webrender,
+              package, adb_path, device_serial, remote_test_root, libxul_path, no_install,
+              debug, debugger, debugger_args):
 
         # We lazy build gtest because it's slow to link
         try:
             config = self.config_environment
         except Exception:
             print("Please run |./mach build| before |./mach gtest|.")
             return 1
 
@@ -484,19 +494,19 @@ class GTestCommands(MachCommandBase):
         if conditions.is_android(self):
             if jobs != 1:
                 print("--jobs is not supported on Android and will be ignored")
             if debug or debugger or debugger_args:
                 print("--debug options are not supported on Android and will be ignored")
             return self.android_gtest(cwd, shuffle, gtest_filter,
                                       package, adb_path, device_serial,
                                       remote_test_root, libxul_path,
-                                      enable_webrender)
+                                      enable_webrender, not no_install)
 
-        if package or adb_path or device_serial or remote_test_root or libxul_path:
+        if package or adb_path or device_serial or remote_test_root or libxul_path or no_install:
             print("One or more Android-only options will be ignored")
 
         app_path = self.get_binary_path('app')
         args = [app_path, '-unittest', '--gtest_death_test_style=threadsafe']
 
         if sys.platform.startswith('win') and \
                 'MOZ_LAUNCHER_PROCESS' in self.defines:
             args.append('--wait-for-browser')
@@ -570,26 +580,26 @@ class GTestCommands(MachCommandBase):
         # 256 into 0
         if exit_code > 255:
             exit_code = 255
 
         return exit_code
 
     def android_gtest(self, test_dir, shuffle, gtest_filter,
                       package, adb_path, device_serial, remote_test_root, libxul_path,
-                      enable_webrender):
+                      enable_webrender, install):
         # setup logging for mozrunner
         from mozlog.commandline import setup_logging
         format_args = {'level': self._mach_context.settings['test']['level']}
         default_format = self._mach_context.settings['test']['format']
         setup_logging('mach-gtest', {}, {default_format: sys.stdout}, format_args)
 
         # ensure that a device is available and test app is installed
         from mozrunner.devices.android_device import (verify_android_device, get_adb_path)
-        verify_android_device(self, install=True, app=package, device_serial=device_serial)
+        verify_android_device(self, install=install, app=package, device_serial=device_serial)
 
         if not adb_path:
             adb_path = get_adb_path(self)
         if not libxul_path:
             libxul_path = os.path.join(self.topobjdir, "dist", "bin", "gtest", "libxul.so")
 
         # run gtest via remotegtests.py
         import imp