Put cleanup steps in finally block so cleanup happens after halt on failure.

The device_status_check hangs because there are still processes launched by the
buildbot script that are not cleaned up. E.g.
https://chromegw.corp.google.com/i/clank/builders/manta-sharded-official-perf-clankium/builds/2359
This makes sure the post commands are executed after halt on failure.

BUG=265578

Review URL: https://chromiumcodereview.appspot.com/21261006

git-svn-id: http://src.chromium.org/svn/trunk/src/build@215365 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
navabi@google.com 2013-08-02 21:08:06 +00:00
Родитель 1a1a93bb74
Коммит a95cc35c5e
1 изменённых файлов: 20 добавлений и 23 удалений

Просмотреть файл

@ -306,34 +306,32 @@ def GenerateTestReport(options):
os.remove(report) os.remove(report)
def GetPostTestStepCmds():
return [
('logcat_dump', LogcatDump),
('test_report', GenerateTestReport)
]
def MainTestWrapper(options): def MainTestWrapper(options):
# Spawn logcat monitor try:
SpawnLogcatMonitor() # Spawn logcat monitor
SpawnLogcatMonitor()
# Run all device setup steps # Run all device setup steps
for _, cmd in GetDeviceSetupStepCmds(): for _, cmd in GetDeviceSetupStepCmds():
cmd(options) cmd(options)
if options.install: if options.install:
test_obj = INSTRUMENTATION_TESTS[options.install] test_obj = INSTRUMENTATION_TESTS[options.install]
InstallApk(options, test_obj, print_step=True) InstallApk(options, test_obj, print_step=True)
if options.test_filter: if options.test_filter:
bb_utils.RunSteps(options.test_filter, GetTestStepCmds(), options) bb_utils.RunSteps(options.test_filter, GetTestStepCmds(), options)
if options.experimental: if options.experimental:
RunTestSuites(options, gtest_config.EXPERIMENTAL_TEST_SUITES) RunTestSuites(options, gtest_config.EXPERIMENTAL_TEST_SUITES)
# Run all post test steps finally:
for _, cmd in GetPostTestStepCmds(): # Run all post test steps
cmd(options) LogcatDump(options)
GenerateTestReport(options)
# KillHostHeartbeat() has logic to check if heartbeat process is running,
# and kills only if it finds the process is running on the host.
provision_devices.KillHostHeartbeat()
def GetDeviceStepsOptParser(): def GetDeviceStepsOptParser():
@ -377,7 +375,6 @@ def main(argv):
setattr(options, 'target', options.factory_properties.get('target', 'Debug')) setattr(options, 'target', options.factory_properties.get('target', 'Debug'))
MainTestWrapper(options) MainTestWrapper(options)
provision_devices.KillHostHeartbeat()
if __name__ == '__main__': if __name__ == '__main__':