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

Unified Diff: lib/cros_vm_lib.sh

Issue 5174009: Add support for saving VM state when a test fails. (Closed) Base URL: http://git.chromium.org/git/crosutils.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
« bin/cros_run_vm_test ('K') | « lib/cros_vm_constants.sh ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/cros_vm_lib.sh
diff --git a/lib/cros_vm_lib.sh b/lib/cros_vm_lib.sh
index 7a99cbebe25774791d68a0892780977a8a402f22..543de1aa60579acd87f198908a3afdc341ff43a1 100644
--- a/lib/cros_vm_lib.sh
+++ b/lib/cros_vm_lib.sh
@@ -40,6 +40,7 @@ function start_kvm() {
echo "Starting a KVM instance" >&2
local nographics=""
local usesnapshot=""
+ local save_vm_state=""
if [ ${FLAGS_no_graphics} -eq ${FLAGS_TRUE} ]; then
nographics="-nographic -serial none"
fi
@@ -51,6 +52,13 @@ function start_kvm() {
snapshot="-snapshot"
fi
+ if [ ${FLAGS_save_vm_state} -eq ${FLAGS_TRUE} ]; then
+ # Redirect the QEMU monitor to the guest usb serial port so tests
+ # can trigger a "savevm" command.
+ save_vm_state="-monitor telnet::4555,server,nowait
+ -usbdevice serial::telnet:127.0.0.1:4555"
+ fi
+
sudo kvm -m 1024 \
-vga std \
-pidfile "${KVM_PID_FILE}" \
@@ -58,6 +66,7 @@ function start_kvm() {
-net nic,model=e1000 \
${nographics} \
${snapshot} \
+ ${save_vm_state} \
-net user,hostfwd=tcp::${FLAGS_ssh_port}-:22 \
-hda "${1}"
« bin/cros_run_vm_test ('K') | « lib/cros_vm_constants.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698