Bug 1533445 - Make android tests shutdown faster when device unresponsive; r=bc

Differential Revision: https://phabricator.services.mozilla.com/D22610

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Geoff Brown 2019-03-07 22:45:13 +00:00
parent 8327974474
commit eea10fc31e
2 changed files with 12 additions and 5 deletions

View File

@ -15,7 +15,7 @@ import mozcrash
import mozinfo import mozinfo
import mozlog import mozlog
import moznetwork import moznetwork
from mozdevice import ADBDevice, ADBError from mozdevice import ADBDevice, ADBError, ADBTimeoutError
from mozprofile import Profile, DEFAULT_PORTS from mozprofile import Profile, DEFAULT_PORTS
from mozprofile.permissions import ServerLocations from mozprofile.permissions import ServerLocations
from runtests import MochitestDesktop, update_mozinfo from runtests import MochitestDesktop, update_mozinfo
@ -441,17 +441,21 @@ def run_test_harness(parser, options):
runner = JUnitTestRunner(log, options) runner = JUnitTestRunner(log, options)
result = -1 result = -1
try: try:
device_exception = False
result = runner.run_tests(options.test_filters) result = runner.run_tests(options.test_filters)
except KeyboardInterrupt: except KeyboardInterrupt:
log.info("runjunit.py | Received keyboard interrupt") log.info("runjunit.py | Received keyboard interrupt")
result = -1 result = -1
except Exception: except Exception as e:
traceback.print_exc() traceback.print_exc()
log.error( log.error(
"runjunit.py | Received unexpected exception while running tests") "runjunit.py | Received unexpected exception while running tests")
result = 1 result = 1
if isinstance(e, ADBTimeoutError):
device_exception = True
finally: finally:
runner.cleanup() if not device_exception:
runner.cleanup()
return result return result

View File

@ -599,8 +599,11 @@ class AndroidMixin(object):
for t in self.timers: for t in self.timers:
t.cancel() t.cancel()
self.check_for_ANRs() if self.worst_status != TBPL_RETRY:
self.check_for_tombstones() self.check_for_ANRs()
self.check_for_tombstones()
else:
self.info("ANR and tombstone checks skipped due to TBPL_RETRY")
self.logcat_stop() self.logcat_stop()
if self.is_emulator: if self.is_emulator:
self.kill_processes(self.config["emulator_process_name"]) self.kill_processes(self.config["emulator_process_name"])