Bug 1533445 - Make android tests shutdown faster when device unresponsive; r=bc
authorGeoff Brown <gbrown@mozilla.com>
Thu, 07 Mar 2019 22:45:13 +0000
changeset 520942 3fd4a7b0872e76f8396355a1811676dcfbd86a79
parent 520941 b202d2f7c0cebbf53d64661ff5f1b1b51f76e79a
child 520943 289a463d4dedadaa43e72903b726568a13c944b9
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbc
bugs1533445
milestone67.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 1533445 - Make android tests shutdown faster when device unresponsive; r=bc Differential Revision: https://phabricator.services.mozilla.com/D22610
testing/mochitest/runjunit.py
testing/mozharness/mozharness/mozilla/testing/android.py
--- a/testing/mochitest/runjunit.py
+++ b/testing/mochitest/runjunit.py
@@ -10,17 +10,17 @@ import shutil
 import sys
 import tempfile
 import traceback
 
 import mozcrash
 import mozinfo
 import mozlog
 import moznetwork
-from mozdevice import ADBDevice, ADBError
+from mozdevice import ADBDevice, ADBError, ADBTimeoutError
 from mozprofile import Profile, DEFAULT_PORTS
 from mozprofile.permissions import ServerLocations
 from runtests import MochitestDesktop, update_mozinfo
 
 here = os.path.abspath(os.path.dirname(__file__))
 
 try:
     from mozbuild.base import (
@@ -436,27 +436,31 @@ def run_test_harness(parser, options):
     if hasattr(options, 'log'):
         log = options.log
     else:
         log = mozlog.commandline.setup_logging("runjunit", options,
                                                {"tbpl": sys.stdout})
     runner = JUnitTestRunner(log, options)
     result = -1
     try:
+        device_exception = False
         result = runner.run_tests(options.test_filters)
     except KeyboardInterrupt:
         log.info("runjunit.py | Received keyboard interrupt")
         result = -1
-    except Exception:
+    except Exception as e:
         traceback.print_exc()
         log.error(
             "runjunit.py | Received unexpected exception while running tests")
         result = 1
+        if isinstance(e, ADBTimeoutError):
+            device_exception = True
     finally:
-        runner.cleanup()
+        if not device_exception:
+            runner.cleanup()
     return result
 
 
 def main(args=sys.argv[1:]):
     parser = JunitArgumentParser()
     options = parser.parse_args()
     return run_test_harness(parser, options)
 
--- a/testing/mozharness/mozharness/mozilla/testing/android.py
+++ b/testing/mozharness/mozharness/mozilla/testing/android.py
@@ -594,13 +594,16 @@ class AndroidMixin(object):
         """
         Stop logcat and kill the emulator, if necessary.
         """
         if not self.is_android:
             return
 
         for t in self.timers:
             t.cancel()
-        self.check_for_ANRs()
-        self.check_for_tombstones()
+        if self.worst_status != TBPL_RETRY:
+            self.check_for_ANRs()
+            self.check_for_tombstones()
+        else:
+            self.info("ANR and tombstone checks skipped due to TBPL_RETRY")
         self.logcat_stop()
         if self.is_emulator:
             self.kill_processes(self.config["emulator_process_name"])