Bug 1550417 - Capture logcat if apk installation fails in raptor, r=gbrown,rwood.
authorBob Clary <bclary@bclary.com>
Fri, 10 May 2019 16:31:18 +0000
changeset 532242 852d2cec86d68cf5897fa92edb14fd70ebed42fb
parent 532241 186144ac4762b3b64311290a7b9c5ecf1addea19
child 532243 e978f9960f5759e80511573a05fd649cab27f0dc
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgbrown, rwood
bugs1550417
milestone68.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 1550417 - Capture logcat if apk installation fails in raptor, r=gbrown,rwood. Differential Revision: https://phabricator.services.mozilla.com/D30633
testing/mozharness/mozharness/mozilla/testing/android.py
testing/mozharness/mozharness/mozilla/testing/raptor.py
--- a/testing/mozharness/mozharness/mozilla/testing/android.py
+++ b/testing/mozharness/mozharness/mozilla/testing/android.py
@@ -332,21 +332,22 @@ class AndroidMixin(object):
 
     def install_apk(self, apk):
         """
            Install the specified apk.
         """
         import mozdevice
         try:
             self.device.install_app(apk)
-        except (mozdevice.ADBError, mozdevice.ADBTimeoutError):
-            self.info('Failed to install %s on %s' %
-                      (self.installer_path, self.device_name))
+        except (mozdevice.ADBError, mozdevice.ADBTimeoutError), e:
+            self.info('Failed to install %s on %s: %s %s' %
+                      (self.installer_path, self.device_name,
+                       type(e).__name__, e))
             self.fatal('INFRA-ERROR: Failed to install %s' %
-                       self.installer_path,
+                       os.path.basename(self.installer_path),
                        EXIT_STATUS_DICT[TBPL_RETRY])
 
     def is_boot_completed(self):
         import mozdevice
         try:
             out = self.device.get_prop('sys.boot_completed', timeout=30)
             if out.strip() == '1':
                 return True
--- a/testing/mozharness/mozharness/mozilla/testing/raptor.py
+++ b/testing/mozharness/mozharness/mozilla/testing/raptor.py
@@ -393,16 +393,34 @@ class Raptor(TestingMixin, MercurialScri
             self.query_abs_dirs()['abs_test_install_dir'], 'raptor'
         )
         if self.config.get('run_local'):
             self.raptor_path = os.path.join(self.repo_path, 'testing', 'raptor')
 
     # Action methods. {{{1
     # clobber defined in BaseScript
 
+    def clobber(self):
+        # Recreate the upload directory for storing the logcat collected
+        # during apk installation.
+        super(Raptor, self).clobber()
+        upload_dir = self.query_abs_dirs()['abs_blob_upload_dir']
+        if not os.path.isdir(upload_dir):
+            self.mkdir_p(upload_dir)
+
+    def install_apk(self, apk):
+        # Override AnroidMixin's install_apk in order to capture
+        # logcat during the installation. If the installation fails,
+        # the logcat file will be left in the upload directory.
+        self.logcat_start()
+        try:
+            super(Raptor, self).install_apk(apk)
+        finally:
+            self.logcat_stop()
+
     def download_and_extract(self, extract_dirs=None, suite_categories=None):
         if 'MOZ_FETCHES' in os.environ:
             self.fetch_content()
 
         return super(Raptor, self).download_and_extract(
             suite_categories=['common', 'raptor']
         )