Bug 1599342: add windows hostutils r=jmaher,gbrown
authorAndrew Erickson <aerickson@mozilla.com>
Tue, 23 Jun 2020 01:21:51 +0000
changeset 536701 cb2515ac9f5b50b07b13ff4da618dc9c44fa2718
parent 536700 be987c4c9dd724285e22eb1e6b6521ad156d8e1e
child 536702 0ab07b5b4a288002679151e0e87160cb68adeac1
push id37532
push userabutkovits@mozilla.com
push dateTue, 23 Jun 2020 16:15:06 +0000
treeherdermozilla-central@3add3a174755 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher, gbrown
bugs1599342
milestone79.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 1599342: add windows hostutils r=jmaher,gbrown Differential Revision: https://phabricator.services.mozilla.com/D80523
testing/config/tooltool-manifests/win32/hostutils.manifest
testing/mochitest/mach_commands.py
testing/mozbase/mozrunner/mozrunner/devices/android_device.py
new file mode 100644
--- /dev/null
+++ b/testing/config/tooltool-manifests/win32/hostutils.manifest
@@ -0,0 +1,10 @@
+[
+  {
+    "algorithm": "sha512",
+    "visibility": "public",
+    "filename": "host-utils-79.0a1.en-US.win32.tar.gz",
+    "unpack": true,
+    "digest": "05f9d48ac73aa3e5c5433f39821df0eba85c0c6a39ec3a334d4d0e64b10e352c0d46602ef0eb93dcda744dab8715a308dd8d8d7ca51a360c64a9f7c3bb2f4eb4",
+    "size": 61113183
+  }
+]
--- a/testing/mochitest/mach_commands.py
+++ b/testing/mochitest/mach_commands.py
@@ -254,26 +254,29 @@ def setup_junit_argument_parser():
 
     global parser
     parser = runjunit.JunitArgumentParser()
     return parser
 
 
 def verify_host_bin():
     # validate MOZ_HOST_BIN environment variables for Android tests
+    xpcshell_binary = 'xpcshell'
+    if os.name == 'nt':
+        xpcshell_binary = 'xpcshell.exe'
     MOZ_HOST_BIN = os.environ.get('MOZ_HOST_BIN')
     if not MOZ_HOST_BIN:
         print('environment variable MOZ_HOST_BIN must be set to a directory containing host '
-              'xpcshell')
+              '%s' % xpcshell_binary)
         return 1
     elif not os.path.isdir(MOZ_HOST_BIN):
         print('$MOZ_HOST_BIN does not specify a directory')
         return 1
-    elif not os.path.isfile(os.path.join(MOZ_HOST_BIN, 'xpcshell')):
-        print('$MOZ_HOST_BIN/xpcshell does not exist')
+    elif not os.path.isfile(os.path.join(MOZ_HOST_BIN, xpcshell_binary)):
+        print('$MOZ_HOST_BIN/%s does not exist' % xpcshell_binary)
         return 1
     return 0
 
 
 @CommandProvider
 class MachCommands(MachCommandBase):
     @Command('mochitest', category='testing',
              conditions=[functools.partial(conditions.is_buildapp_in, apps=SUPPORTED_APPS)],
--- a/testing/mozbase/mozrunner/mozrunner/devices/android_device.py
+++ b/testing/mozbase/mozrunner/mozrunner/devices/android_device.py
@@ -99,38 +99,48 @@ def _install_host_utils(build_obj):
     if host_platform:
         path = os.path.join(build_obj.topsrcdir, MANIFEST_PATH)
         path = os.path.join(path, host_platform, 'hostutils.manifest')
         _get_tooltool_manifest(build_obj.substs, path, EMULATOR_HOME_DIR,
                                'releng.manifest')
         _tooltool_fetch(build_obj.substs)
         xre_path = glob.glob(os.path.join(EMULATOR_HOME_DIR, 'host-utils*'))
         for path in xre_path:
-            if os.path.isdir(path) and os.path.isfile(os.path.join(path, 'xpcshell')):
+            if os.path.isdir(path) and os.path.isfile(os.path.join(path, _get_xpcshell_name())):
                 os.environ['MOZ_HOST_BIN'] = path
                 installed = True
                 break
         if not installed:
             _log_warning("Unable to install host utilities.")
     else:
         _log_warning(
             "Unable to install host utilities -- your platform is not supported!")
 
 
+def _get_xpcshell_name():
+    """
+       Returns the xpcshell binary's name as a string (dependent on operating system).
+    """
+    xpcshell_binary = 'xpcshell'
+    if os.name == 'nt':
+        xpcshell_binary = 'xpcshell.exe'
+    return xpcshell_binary
+
+
 def _maybe_update_host_utils(build_obj):
     """
        Compare the installed host-utils to the version name in the manifest;
        if the installed version is older, offer to update.
     """
 
     # Determine existing/installed version
     existing_path = None
     xre_paths = glob.glob(os.path.join(EMULATOR_HOME_DIR, 'host-utils*'))
     for path in xre_paths:
-        if os.path.isdir(path) and os.path.isfile(os.path.join(path, 'xpcshell')):
+        if os.path.isdir(path) and os.path.isfile(os.path.join(path, _get_xpcshell_name())):
             existing_path = path
             break
     if existing_path is None:
         # if not installed, no need to upgrade (new version will be installed)
         return
     existing_version = os.path.basename(existing_path)
 
     # Determine manifest version
@@ -271,24 +281,26 @@ def verify_android_device(build_obj, ins
         # prompt to install one.
         xre_path = os.environ.get('MOZ_HOST_BIN')
         err = None
         if not xre_path:
             err = "environment variable MOZ_HOST_BIN is not set to a directory " \
                   "containing host xpcshell"
         elif not os.path.isdir(xre_path):
             err = '$MOZ_HOST_BIN does not specify a directory'
-        elif not os.path.isfile(os.path.join(xre_path, 'xpcshell')):
+        elif not os.path.isfile(os.path.join(xre_path, _get_xpcshell_name())):
             err = '$MOZ_HOST_BIN/xpcshell does not exist'
         if err:
             _maybe_update_host_utils(build_obj)
             xre_path = glob.glob(os.path.join(EMULATOR_HOME_DIR, 'host-utils*'))
             for path in xre_path:
-                if os.path.isdir(path) and os.path.isfile(os.path.join(path, 'xpcshell')):
-                    os.environ['MOZ_HOST_BIN'] = path
+                if os.path.isdir(path) and os.path.isfile(
+                    os.path.join(path, _get_xpcshell_name())
+                ):
+                    os.environ["MOZ_HOST_BIN"] = path
                     err = None
                     break
         if err:
             _log_info("Host utilities not found: %s" % err)
             response = input(
                 "Download and setup your host utilities? (Y/n) ").strip()
             if response.lower().startswith('y') or response == '':
                 _install_host_utils(build_obj)