Bug 1467824 - Port raptor-speedometer google chrome to linux64 and win10 (wip) draft
authorRob Wood <rwood@mozilla.com>
Wed, 27 Jun 2018 15:44:25 -0400
changeset 812140 7e1a544a10316ab7991b12f287bc43ae2abbac9b
parent 812139 bad873c0dbbe1c34582ba3ceefd58c7be7eecd8e
push id114453
push userrwood@mozilla.com
push dateThu, 28 Jun 2018 15:10:03 +0000
bugs1467824
milestone63.0a1
Bug 1467824 - Port raptor-speedometer google chrome to linux64 and win10 (wip) MozReview-Commit-ID: Lb5EiKzjAtp
testing/mozharness/mozharness/mozilla/testing/raptor.py
testing/raptor/raptor/raptor.py
--- a/testing/mozharness/mozharness/mozilla/testing/raptor.py
+++ b/testing/mozharness/mozharness/mozilla/testing/raptor.py
@@ -160,49 +160,77 @@ class Raptor(TestingMixin, MercurialScri
         if self.app != "chrome":
             self.info("Google Chrome is not required")
             return
 
         if self.config.get("run_local"):
             self.info("expecting Google Chrome to be pre-installed locally")
             return
 
-        chrome_url = "https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg"
         # in production we can put the chrome build in mozharness/mozilla/testing/chrome
         self.chrome_dest = os.path.join(here, 'chrome')
-        chrome_dmg = os.path.join(self.chrome_dest, 'googlechrome.dmg')
+
+        if 'mac' in self.config['platform']:
+            chrome_url = "https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg"
+            chrome_archive_file = "googlechrome.dmg"
+            self.chrome_path = os.path.join(self.chrome_dest, 'Google Chrome.app',
+                                        'Contents', 'MacOS', 'Google Chrome')
+
+        elif 'linux' in self.config['platform']:
+            chrome_url = "https://dl.google.com/chrome/linux/direct" \
+                         "/google-chrome-stable_current_amd64.deb"
+            chrome_archive_file = "google-chrome-stable_current_amd64.deb"
+            self.chrome_path = "/usr/bin/google-chrome"
+
+        else:
+            # chrome_url = TODO
+            # chrome_archive_file =  TODO
+            # self.chrome_path = TODO
+            pass
+
+        chrome_archive = os.path.join(self.chrome_dest, chrome_archive_file)
 
         self.info("installing google chrome - temporary install hack")
-        self.info("chrome_dest is: %s" % self.chrome_dest)
-
-        self.chrome_path = os.path.join(self.chrome_dest, 'Google Chrome.app',
-                                        'Contents', 'MacOS', 'Google Chrome')
+        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_dmg):
+        if not os.path.exists(chrome_archive):
             # download the chrome dmg
             self.download_file(chrome_url, parent_dir=self.chrome_dest)
 
-        command = ["open", "googlechrome.dmg"]
+        if 'mac' in self.config['platform']:
+            command = ["open", chrome_archive_file]
+
+        elif 'linux' in self.config['platform']:
+            command = ["dpkg", "-i", chrome_archive_file]
+        else:
+            # todo
+            pass
+
         return_code = self.run_command(command, cwd=self.chrome_dest)
+
         if return_code not in [0]:
-            self.info("abort: failed to open %s/googlechrome.dmg" % self.chrome_dest)
+            self.info("abort: failed to open %s" % chrome_archive)
             return
+
         # give 30 sec for open cmd to finish
         time.sleep(30)
 
-        # now that the googlechrome dmg is mounted, extract/copy app from mnt to our folder
-        command = ["cp", "-r", "/Volumes/Google Chrome/Google Chrome.app", "."]
-        return_code = self.run_command(command, cwd=self.chrome_dest)
-        if return_code not in [0]:
-            self.info("abort: failed to open %s/googlechrome.dmg" % self.chrome_dest)
-            return
+        if 'mac' in self.config['platform']:
+            # now that the googlechrome dmg is mounted, extract/copy app from mnt to our folder
+            command = ["cp", "-r", "/Volumes/Google Chrome/Google Chrome.app", "."]
+            return_code = self.run_command(command, cwd=self.chrome_dest)
+
+            if return_code not in [0]:
+                self.info("abort: failed to copy chrome from mount to %s" % self.chrome_dest)
+                return
 
         # now ensure chrome binary exists
         if os.path.exists(self.chrome_path):
             self.info("successfully installed Google Chrome to: %s" % self.chrome_path)
         else:
             self.info("abort: failed to install Google Chrome")
 
     def raptor_options(self, args=None, **kw):
--- a/testing/raptor/raptor/raptor.py
+++ b/testing/raptor/raptor/raptor.py
@@ -135,16 +135,17 @@ class Raptor(object):
         self.runner.start()
 
         proc = self.runner.process_handler
         self.output_handler.proc = proc
         self.control_server.browser_proc = proc
 
         try:
             self.runner.wait(timeout)
+
         finally:
             try:
                 self.runner.check_for_crashes()
             except NotImplementedError:  # not implemented for Chrome
                 pass
 
         if self.playback is not None:
             self.playback.stop()