Bug 1233716 - Set self.minidump_stackwalk_path if specified in the configs. r=jlund draft
authorArmen Zambrano Gasparnian <armenzg@mozilla.com>
Fri, 18 Dec 2015 09:57:20 -0500
changeset 320575 1673dcd917f8813f40dd5eea62ae29b4f34a04aa
parent 320463 5acc2a44834ce0614f98466475e674517daf0041
child 512775 9655581261fa4e69e4b44cc9323268b0042c09d8
push id9237
push userarmenzg@mozilla.com
push dateMon, 11 Jan 2016 20:57:45 +0000
reviewersjlund
bugs1233716
milestone46.0a1
Bug 1233716 - Set self.minidump_stackwalk_path if specified in the configs. r=jlund
testing/mozharness/mozharness/base/script.py
testing/mozharness/mozharness/mozilla/testing/testbase.py
--- a/testing/mozharness/mozharness/base/script.py
+++ b/testing/mozharness/mozharness/base/script.py
@@ -128,16 +128,24 @@ class ScriptMixin(PlatformMixin):
     Attributes:
         env (dict): a mapping object representing the string environment.
         script_obj (ScriptMixin): reference to a ScriptMixin instance.
     """
 
     env = None
     script_obj = None
 
+    def platform_name(self):
+        """ Return the platform name on which the script is running on.
+        Returns:
+            None: for failure to determine the platform.
+            str: The name of the platform (e.g. linux64)
+        """
+        return platform_name()
+
     # Simple filesystem commands {{{2
     def mkdir_p(self, path, error_level=ERROR):
         """ Create a directory if it doesn't exists.
         This method also logs the creation, error or current existence of the
         directory to be created.
 
         Args:
             path (str): path of the directory to be created.
--- a/testing/mozharness/mozharness/mozilla/testing/testbase.py
+++ b/testing/mozharness/mozharness/mozilla/testing/testbase.py
@@ -8,17 +8,16 @@
 import copy
 import os
 import platform
 import pprint
 import re
 import urllib2
 import json
 
-from mozharness.base.config import ReadOnlyDict, parse_config_file
 from mozharness.base.errors import BaseErrorList
 from mozharness.base.log import FATAL, WARNING
 from mozharness.base.python import (
     ResourceMonitoringMixin,
     VirtualenvMixin,
     virtualenv_config_options,
 )
 from mozharness.mozilla.buildbot import BuildbotMixin, TBPL_WARNING
@@ -32,16 +31,26 @@ from mozharness.mozilla.tooltool import 
 from mozharness.lib.python.authentication import get_credentials
 
 INSTALLER_SUFFIXES = ('.apk',  # Android
                       '.tar.bz2', '.tar.gz',  # Linux
                       '.dmg',  # Mac
                       '.installer-stub.exe', '.installer.exe', '.exe', '.zip',  # Windows
                       )
 
+# https://dxr.mozilla.org/mozilla-central/source/testing/config/tooltool-manifests
+TOOLTOOL_PLATFORM_DIR = {
+    'linux':   'linux32',
+    'linux64': 'linux64',
+    'win32':   'win32',
+    'win64':   'win32',
+    'macosx':  'macosx64',
+}
+
+
 testing_config_options = [
     [["--installer-url"],
      {"action": "store",
      "dest": "installer_url",
      "default": None,
      "help": "URL to the installer to install",
       }],
     [["--installer-path"],
@@ -182,17 +191,17 @@ class TestingMixin(VirtualenvMixin, Buil
             * read-buildbot-config is removed from the list of actions
             * --installer-url is set
             * --test-url is set if needed
             * every url is substituted by another external to the
                 Release Engineering network
         """
         c = self.config
         orig_config = copy.deepcopy(c)
-        self.warning("When you use developer_config.py, we drop " \
+        self.warning("When you use developer_config.py, we drop "
                 "'read-buildbot-config' from the list of actions.")
         if "read-buildbot-config" in rw_config.actions:
             rw_config.actions.remove("read-buildbot-config")
         self.actions = tuple(rw_config.actions)
 
         def _replace_url(url, changes):
             for from_, to_ in changes:
                 if url.startswith(from_):
@@ -358,22 +367,22 @@ 2. running via buildbot and running the 
 
 """
         if message:
             self.fatal(message + "Can't run download-and-extract... exiting")
 
         if self.config.get("developer_mode") and self._is_darwin():
             # Bug 1066700 only affects Mac users that try to run mozharness locally
             version = self._query_binary_version(
-                    regex=re.compile("UnZip\ (\d+\.\d+)\ .*",re.MULTILINE),
+                    regex=re.compile("UnZip\ (\d+\.\d+)\ .*", re.MULTILINE),
                     cmd=[self.query_exe('unzip'), '-v']
             )
             if not version >= 6:
-                self.fatal("We require a more recent version of unzip to unpack our tests.zip files.\n" \
-                        "You are currently using version %s. Please update to at least 6.0.\n" \
+                self.fatal("We require a more recent version of unzip to unpack our tests.zip files.\n"
+                        "You are currently using version %s. Please update to at least 6.0.\n"
                         "You can visit http://www.info-zip.org/UnZip.html" % version)
 
     def _download_test_zip(self):
         dirs = self.query_abs_dirs()
         file_name = None
         if self.test_zip_path:
             file_name = self.test_zip_path
         # try to use our proxxy servers
@@ -632,61 +641,55 @@ Did you run with --create-virtualenv? Is
 
     def uninstall(self):
         self.uninstall_app()
 
     def query_minidump_tooltool_manifest(self):
         if self.config.get('minidump_tooltool_manifest_path'):
             return self.config['minidump_tooltool_manifest_path']
 
-        self.info('minidump tooltool manifest unknown. determining based upon platform and arch')
-        tooltool_path = "config/tooltool-manifests/%s/releng.manifest"
-        if self._is_windows():
-            # we use the same minidump binary for 32 and 64 bit windows
-            return tooltool_path % 'win32'
-        elif self._is_darwin():
-            # we only use the 64 bit binary for osx
-            return tooltool_path % 'macosx64'
-        elif self._is_linux():
-            if self._is_64_bit():
-                return tooltool_path % 'linux64'
-            else:
-                return tooltool_path % 'linux32'
+        self.info('Minidump tooltool manifest unknown. Determining based upon '
+                  'platform and architecture.')
+        platform_name = self.platform_name()
+
+        if platform_name:
+            tooltool_path = "config/tooltool-manifests/%s/releng.manifest" % \
+                TOOLTOOL_PLATFORM_DIR[platform_name]
+            return tooltool_path
         else:
-            self.fatal('could not determine minidump tooltool manifest')
+            self.fatal('We could not determine the minidump\'s filename.')
 
     def query_minidump_filename(self):
         if self.config.get('minidump_stackwalk_path'):
             return self.config['minidump_stackwalk_path']
 
-        self.info('minidump filename unknown. determining based upon platform and arch')
-        minidump_filename = '%s-minidump_stackwalk'
-        if self._is_windows():
-            # we use the same minidump binary for 32 and 64 bit windows
-            return minidump_filename % ('win32',) + '.exe'
-        elif self._is_darwin():
-            # we only use the 64 bit binary for osx
-            return minidump_filename % ('macosx64',)
-        elif self._is_linux():
-            if self._is_64_bit():
-                return minidump_filename % ('linux64',)
-            else:
-                return minidump_filename % ('linux32',)
+        self.info('Minidump filename unknown. Determining based upon platform '
+                  'and architecture.')
+        platform_name = self.platform_name()
+        if platform_name:
+            minidump_filename = '%s-minidump_stackwalk' % TOOLTOOL_PLATFORM_DIR[platform_name]
+            if platform_name in ('win32', 'win64'):
+                minidump_filename += '.exe'
+            return minidump_filename
         else:
-            self.fatal('could not determine minidump filename')
+            self.fatal('We could not determine the minidump\'s filename.')
 
     def query_minidump_stackwalk(self, manifest=None):
         if self.minidump_stackwalk_path:
             return self.minidump_stackwalk_path
+
         c = self.config
         dirs = self.query_abs_dirs()
 
-        if c.get('download_minidump_stackwalk'):
-            minidump_stackwalk_path = self.query_minidump_filename()
+        # This is the path where we either download to or is already on the host
+        minidump_stackwalk_path = self.query_minidump_filename()
 
+        if not c.get('download_minidump_stackwalk'):
+            self.minidump_stackwalk_path = minidump_stackwalk_path
+        else:
             if not manifest:
                 tooltool_manifest_path = self.query_minidump_tooltool_manifest()
                 manifest = os.path.join(dirs.get('abs_test_install_dir',
                                                  os.path.join(dirs['abs_work_dir'], 'tests')),
                                         tooltool_manifest_path)
 
             self.info('grabbing minidump binary from tooltool')
             try: