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() |