Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(878)

Unified Diff: build/android/buildbot/bb_device_steps.py

Issue 21261006: Put cleanup steps in finally block so cleanup happens after halt on failure. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use finally block. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/buildbot/bb_device_steps.py
diff --git a/build/android/buildbot/bb_device_steps.py b/build/android/buildbot/bb_device_steps.py
index 9ec3fe3dcf48579350e651343a303660d74ec79b..56937223d0ff87cf41f65f5afa89773e720f11e6 100755
--- a/build/android/buildbot/bb_device_steps.py
+++ b/build/android/buildbot/bb_device_steps.py
@@ -320,35 +320,43 @@ def GenerateTestReport(options):
os.remove(report)
+def KillHostHeartbeat(_):
+ # PostTestStepCmds take an option argument, but the provision script doesn't
+ # need options to kill the host heartbeat.
+ provision_devices.KillHostHeartbeat()
+
+
def GetPostTestStepCmds():
return [
('logcat_dump', LogcatDump),
- ('test_report', GenerateTestReport)
+ ('test_report', GenerateTestReport),
+ ('kill_host_heartbeat', KillHostHeartbeat)
]
def MainTestWrapper(options):
- # Spawn logcat monitor
- SpawnLogcatMonitor()
-
- # Run all device setup steps
- for _, cmd in GetDeviceSetupStepCmds():
- cmd(options)
+ try:
+ # Spawn logcat monitor
+ SpawnLogcatMonitor()
- if options.install:
- test_obj = INSTRUMENTATION_TESTS[options.install]
- InstallApk(options, test_obj, print_step=True)
+ # Run all device setup steps
+ for _, cmd in GetDeviceSetupStepCmds():
+ cmd(options)
- if options.test_filter:
- bb_utils.RunSteps(options.test_filter, GetTestStepCmds(), options)
+ if options.install:
+ test_obj = INSTRUMENTATION_TESTS[options.install]
+ InstallApk(options, test_obj, print_step=True)
- if options.experimental:
- RunTestSuites(options, gtest_config.EXPERIMENTAL_TEST_SUITES)
- RunBrowserTestSuite(options)
+ if options.test_filter:
+ bb_utils.RunSteps(options.test_filter, GetTestStepCmds(), options)
- # Run all post test steps
- for _, cmd in GetPostTestStepCmds():
- cmd(options)
+ if options.experimental:
+ RunTestSuites(options, gtest_config.EXPERIMENTAL_TEST_SUITES)
+ RunBrowserTestSuite(options)
+ finally:
Isaac (away) 2013/08/02 02:20:26 Could we just call the functions here and remove G
navabi 2013/08/02 16:26:43 Sure. That way we also don't need KillHostHeartbea
+ # Run all post test steps
+ for _, cmd in GetPostTestStepCmds():
+ cmd(options)
def GetDeviceStepsOptParser():
@@ -392,7 +400,6 @@ def main(argv):
setattr(options, 'target', options.factory_properties.get('target', 'Debug'))
MainTestWrapper(options)
- provision_devices.KillHostHeartbeat()
navabi 2013/08/02 00:29:32 This moved to GetPostTestStepCmds.
if __name__ == '__main__':
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698