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

Unified Diff: client/bin/site_job.py

Issue 5303005: Add support for saving VM state after test failure (Closed) Base URL: http://git.chromium.org/git/autotest.git@master
Patch Set: Move save VM state code to be site specific Created 10 years, 1 month 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 | client/bin/site_utils.py » ('j') | client/bin/site_utils.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/bin/site_job.py
diff --git a/client/bin/site_job.py b/client/bin/site_job.py
index c824a8664727de50265f5176da9e164ba5e4ccb0..8c39b477e669ce7d0fb676b7787a905e4312b50b 100755
--- a/client/bin/site_job.py
+++ b/client/bin/site_job.py
@@ -6,6 +6,8 @@ import os
from autotest_lib.client.bin import boottool, site_logging, utils
from autotest_lib.client.bin.job import base_client_job
+from autotest_lib.client.common_lib import error
+from datetime import datetime
LAST_BOOT_TAG = object()
@@ -18,7 +20,16 @@ class site_job(base_client_job):
log_pauser = site_logging.LogRotationPauser()
try:
log_pauser.begin()
- base_client_job.run_test(self, url, *args, **dargs)
+ passed = base_client_job.run_test(self, url, *args, **dargs)
+ if not passed:
+ # Save the VM state immediately after the test failure.
+ # This is a NOOP if the the test isn't running in a VM or
+ # if the VM is not properly configured to save state.
+ group, testname = self.pkgmgr.get_package_name(url, 'test')
+ now = datetime.now().strftime('%I:%M:%S.%f')
+ checkpoint_name = '%s-%s' % (testname, now)
+ logging.info('Checkpoint name %s' % checkpoint_name)
+ utils.save_vm_state(checkpoint_name)
finally:
log_pauser.end()
« no previous file with comments | « no previous file | client/bin/site_utils.py » ('j') | client/bin/site_utils.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698