Bug 1473389 - Port raptor-speedometer to google chrome (chromium) on win7/win10/osx/linux64; r?jmaher draft
authorRob Wood <rwood@mozilla.com>
Fri, 06 Jul 2018 14:41:00 -0400
changeset 819374 8a993f27ccad24ed4fa7afb451689164ae0c813c
parent 819299 66ee3a9fe9caee878fc3d1163458e9fb6de61f88
push id116538
push userrwood@mozilla.com
push dateTue, 17 Jul 2018 18:54:45 +0000
reviewersjmaher
bugs1473389
milestone63.0a1
Bug 1473389 - Port raptor-speedometer to google chrome (chromium) on win7/win10/osx/linux64; r?jmaher MozReview-Commit-ID: FE7XC4JNLD1
testing/mozharness/configs/raptor/windows_config.py
testing/mozharness/configs/raptor/windows_vm_config.py
testing/mozharness/mozharness/mozilla/testing/raptor.py
--- a/testing/mozharness/configs/raptor/windows_config.py
+++ b/testing/mozharness/configs/raptor/windows_config.py
@@ -25,16 +25,17 @@ config = {
         'hg': os.path.join(os.environ['PROGRAMFILES'], 'Mercurial', 'hg'),
         'tooltool.py': [PYTHON, os.path.join(os.environ['MOZILLABUILD'], 'tooltool.py')],
     },
     "title": socket.gethostname().split('.')[0],
     "default_actions": [
         "clobber",
         "download-and-extract",
         "populate-webroot",
+        "install-chrome",
         "create-virtualenv",
         "install",
         "run-tests",
     ],
     "metro_harness_path_frmt": "%(metro_base_path)s/metro/metrotestharness.exe",
     "download_minidump_stackwalk": True,
     "tooltool_cache": os.path.join('c:\\', 'build', 'tooltool_cache'),
     "minidump_stackwalk_path": "win32-minidump_stackwalk.exe",
--- a/testing/mozharness/configs/raptor/windows_vm_config.py
+++ b/testing/mozharness/configs/raptor/windows_vm_config.py
@@ -24,16 +24,17 @@ config = {
                        '%s/scripts/mozinstall-script.py' % VENV_PATH],
         'hg': os.path.join(os.environ['PROGRAMFILES'], 'Mercurial', 'hg'),
     },
     "title": socket.gethostname().split('.')[0],
     "default_actions": [
         "clobber",
         "download-and-extract",
         "populate-webroot",
+        "install-chrome",
         "create-virtualenv",
         "install",
         "run-tests",
     ],
     "metro_harness_path_frmt": "%(metro_base_path)s/metro/metrotestharness.exe",
     "download_minidump_stackwalk": True,
     "tooltool_cache": os.path.join('c:\\', 'build', 'tooltool_cache'),
     "minidump_stackwalk_path": "win32-minidump_stackwalk.exe",
--- a/testing/mozharness/mozharness/mozilla/testing/raptor.py
+++ b/testing/mozharness/mozharness/mozilla/testing/raptor.py
@@ -165,73 +165,69 @@ class Raptor(TestingMixin, MercurialScri
             return
 
         # in production we can put the chrome build in mozharness/mozilla/testing/chrome
         self.chrome_dest = os.path.join(here, 'chrome')
 
         # mozharness/base/script.py.self.platform_name will return one of:
         # 'linux64', 'linux', 'macosx', 'win64', 'win32'
 
+        base_url = "http://commondatastorage.googleapis.com/chromium-browser-snapshots"
+
+        # note: temporarily use a specified chromium revision number to download; however
+        # in the future we will be using a fetch task to get a new chromium (Bug 1476372)
+
         if 'mac' in self.platform_name():
-            chrome_archive_file = "googlechrome.dmg"
-            chrome_url = "https://dl.google.com/chrome/mac/stable/GGRO/%s" % chrome_archive_file
-            self.chrome_path = os.path.join(self.chrome_dest, 'Google Chrome.app',
-                                            'Contents', 'MacOS', 'Google Chrome')
+            # for now hardcoding a revision; but change this to update to newer version; from:
+            # http://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/LAST_CHANGE
+            chromium_rev = "575625"
+            chrome_archive_file = "chrome-mac.zip"
+            chrome_url = "%s/Mac/%s/%s" % (base_url, chromium_rev, chrome_archive_file)
+            self.chrome_path = os.path.join(self.chrome_dest, 'chrome-mac', 'Chromium.app',
+                                            'Contents', 'MacOS', 'Chromium')
 
         elif 'linux' in self.platform_name():
-            chrome_archive_file = "google-chrome-stable_current_amd64.deb"
-            chrome_url = "https://dl.google.com/linux/direct/%s" % chrome_archive_file
-            self.chrome_path = os.path.join(self.chrome_dest, 'opt', 'google',
-                                            'chrome', 'google-chrome')
+            # for now hardcoding a revision; but change this to update to newer version; from:
+            # http://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/LAST_CHANGE
+            chromium_rev = "575640"
+            chrome_archive_file = "chrome-linux.zip"
+            chrome_url = "%s/Linux_x64/%s/%s" % (base_url, chromium_rev, chrome_archive_file)
+            self.chrome_path = os.path.join(self.chrome_dest, 'chrome-linux', 'chrome')
 
         else:
             # windows 7/10
+            # for now hardcoding a revision; but change this to update to newer version; from:
+            # http://commondatastorage.googleapis.com/chromium-browser-snapshots/Win_x64/LAST_CHANGE
+            chromium_rev = "575637"
+            chrome_archive_file = "chrome-win32.zip"  # same zip name for win32/64
+
+            # url is different for win32/64
             if '64' in self.platform_name():
-                chrome_archive_file = "standalonesetup64.exe"
+                chrome_url = "%s/Win_x64/%s/%s" % (base_url, chromium_rev, chrome_archive_file)
             else:
-                chrome_archive_file = "standalonesetup.exe"
-            chrome_url = "https://dl.google.com/chrome/install/%s" % chrome_archive_file
+                chrome_url = "%s/Win_x32/%s/%s" % (base_url, chromium_rev, chrome_archive_file)
+
+            self.chrome_path = os.path.join(self.chrome_dest, 'chrome-win32', 'Chrome.exe')
 
         chrome_archive = os.path.join(self.chrome_dest, chrome_archive_file)
 
         self.info("installing google chrome - temporary install hack")
         self.info("chrome archive is: %s" % chrome_archive)
         self.info("chrome dest is: %s" % self.chrome_dest)
 
         if os.path.exists(self.chrome_path):
             self.info("google chrome binary already exists at: %s" % self.chrome_path)
             return
 
         if not os.path.exists(chrome_archive):
             # download the chrome installer
             self.download_file(chrome_url, parent_dir=self.chrome_dest)
 
         commands = []
-
-        if 'mac' in self.platform_name():
-            # open the chrome dmg to have it mounted
-            commands.append(["open", chrome_archive_file])
-
-            # then extract/copy app from mnt to our folder
-            commands.append(["cp", "-r", "/Volumes/Google Chrome/Google Chrome.app", "."])
-
-        elif 'linux' in self.platform_name():
-            # on linux in order to avoid needing sudo, we unpack the google chrome deb
-            # manually using ar, and then unpack the contents of the ar after that
-            commands.append(["ar", "x", chrome_archive_file])
-
-            # now we have the google chrome .deb file unpacked using ar, we need to
-            # unpack the tar.xz file that was inside the .deb
-            commands.append(['tar', '-xJf',
-                            os.path.join(self.chrome_dest, 'data.tar.xz'),
-                            '-C', self.chrome_dest])
-
-        else:
-            # TODO: Bug 1473389 - finish this for windows 7 (x32) and winows 10 (x64)
-            pass
+        commands.append(['unzip', '-q', '-o', chrome_archive_file, '-d', self.chrome_dest])
 
         # now run the commands to unpack / install google chrome
         for next_command in commands:
             return_code = self.run_command(next_command, cwd=self.chrome_dest)
             time.sleep(30)
             if return_code not in [0]:
                 self.info("abort: failed to install %s to %s with command: %s"
                           % (chrome_archive_file, self.chrome_dest, next_command))