Bug 1300163 - Move the Android 'stop-emulator' step to a PostScriptAction of 'run-tests', r=gbrown

Currently 'stop-emulator' is its own action in mozharness. This means that anytime the mozharness
script finishes emulators will get shutdown. Usually, this is what we want to do. But if the user passes
in --no-run-tests, then presumably they are intending to run tests at a later time for some reason.
But when they do this, the emulator will be terminated, and then running tests later no longer works.

The main place where this becomes a problem is on interactive loaners in taskcluster. This patch fixes
the problem by instead running 'stop-emulator' only after the 'run-tests' step finishes. So if
--no-run-tests is passed in, the emulator will be left open.

MozReview-Commit-ID: 4lsKGpizfH7

--HG--
extra : rebase_source : e29733a4a69d4d063f225754d2ad8886e22b4782
This commit is contained in:
Andrew Halberstadt 2016-09-02 14:22:23 -04:00
parent e2ec095399
commit aa78ee9e95
5 changed files with 15 additions and 12 deletions

View File

@ -43,7 +43,6 @@ config = {
'verify-emulator',
'install',
'run-tests',
'stop-emulator',
],
"emulator": {
"name": "test-1",

View File

@ -53,7 +53,6 @@ config = {
'verify-emulator',
'install',
'run-tests',
'stop-emulator',
],
"emulator": {
"name": "test-1",

View File

@ -38,7 +38,6 @@ config = {
'create-virtualenv',
'verify-emulator',
'run-tests',
'stop-emulator',
],
"emulator": {
"name": "test-1",

View File

@ -24,7 +24,7 @@ sys.path.insert(1, os.path.dirname(sys.path[0]))
from mozprocess import ProcessHandler
from mozharness.base.log import FATAL
from mozharness.base.script import BaseScript, PreScriptAction
from mozharness.base.script import BaseScript, PreScriptAction, PostScriptAction
from mozharness.base.vcs.vcsbase import VCSMixin
from mozharness.mozilla.blob_upload import BlobUploadMixin, blobupload_config_options
from mozharness.mozilla.mozbase import MozbaseMixin
@ -85,7 +85,7 @@ class AndroidEmulatorTest(BlobUploadMixin, TestingMixin, EmulatorMixin, VCSMixin
'verify-emulator',
'install',
'run-tests',
'stop-emulator'],
],
default_actions=['clobber',
'start-emulator',
'download-and-extract',
@ -93,7 +93,7 @@ class AndroidEmulatorTest(BlobUploadMixin, TestingMixin, EmulatorMixin, VCSMixin
'verify-emulator',
'install',
'run-tests',
'stop-emulator'],
],
require_config_file=require_config_file,
config={
'virtualenv_modules': self.virtualenv_modules,
@ -724,7 +724,8 @@ class AndroidEmulatorTest(BlobUploadMixin, TestingMixin, EmulatorMixin, VCSMixin
self._dump_emulator_log()
self.buildbot_status(tbpl_status, level=log_level)
def stop_emulator(self):
@PostScriptAction('run-tests')
def stop_emulator(self, action, success=None):
'''
Report emulator health, then make sure that the emulator has been stopped
'''
@ -737,7 +738,11 @@ class AndroidEmulatorTest(BlobUploadMixin, TestingMixin, EmulatorMixin, VCSMixin
first (if the emulator is still running, logcat may still be running, which
may lock the blob upload directory, causing a hang).
'''
self._kill_processes(self.config["emulator_process_name"])
if self.config.get('blob_upload_branch'):
# Except on interactive workers, we want the emulator to keep running
# after the script is finished. So only kill it if blobber would otherwise
# have run anyway (it doesn't get run on interactive workers).
self._kill_processes(self.config["emulator_process_name"])
super(AndroidEmulatorTest, self).upload_blobber_files()
if __name__ == '__main__':

View File

@ -22,7 +22,7 @@ sys.path.insert(1, os.path.dirname(sys.path[0]))
from mozprocess import ProcessHandler
from mozharness.base.log import FATAL
from mozharness.base.script import BaseScript, PostScriptRun, PreScriptAction
from mozharness.base.script import BaseScript, PostScriptRun, PreScriptAction, PostScriptAction
from mozharness.base.vcs.vcsbase import VCSMixin
from mozharness.mozilla.blob_upload import BlobUploadMixin, blobupload_config_options
from mozharness.mozilla.mozbase import MozbaseMixin
@ -76,14 +76,14 @@ class AndroidEmulatorTest(BlobUploadMixin, TestingMixin, EmulatorMixin, VCSMixin
'create-virtualenv',
'install',
'run-tests',
'stop-emulators'],
],
default_actions=['clobber',
'start-emulators',
'download-and-extract',
'create-virtualenv',
'install',
'run-tests',
'stop-emulators'],
],
require_config_file=require_config_file,
config={
'virtualenv_modules': self.virtualenv_modules,
@ -822,7 +822,8 @@ class AndroidEmulatorTest(BlobUploadMixin, TestingMixin, EmulatorMixin, VCSMixin
self.buildbot_status(joint_tbpl_status, level=joint_log_level)
def stop_emulators(self):
@PostScriptAction('run-tests')
def stop_emulators(self, action, success=None):
'''
Report emulator health, then make sure that every emulator has been stopped
'''