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

Unified Diff: client/common_lib/test.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: 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/common_lib/utils.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/common_lib/test.py
diff --git a/client/common_lib/test.py b/client/common_lib/test.py
index 766766b4902e181f2dcca5dbffe51f7071263ba9..72e155877bb1ff0998d070fc1080746d910f46db 100644
--- a/client/common_lib/test.py
+++ b/client/common_lib/test.py
@@ -19,6 +19,7 @@
import fcntl, getpass, os, re, sys, shutil, tarfile, tempfile, time, traceback
import warnings, logging, glob, resource
+from datetime import datetime
from autotest_lib.client.common_lib import error
from autotest_lib.client.bin import utils
@@ -418,6 +419,13 @@ class base_test(object):
except:
pass # don't let logging exceptions here interfere
+ # 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.
+ now = datetime.now().strftime('%I:%M:%S.%f')
+ checkpoint_name = "%s-%s" % (self.tagged_testname, now)
sosa 2010/11/24 01:02:54 Don't mix "" and ''
sosa 2010/11/24 01:02:54 It may be more useful to get something about the m
thieule 2010/11/24 18:00:45 Done.
thieule 2010/11/24 18:00:45 The qcow2 file is tied to a particular base image.
+ utils.save_vm_state(checkpoint_name)
+
# Save the exception while we run our cleanup() before
# reraising it.
exc_info = sys.exc_info()
« no previous file with comments | « no previous file | client/common_lib/utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698