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

Side by Side Diff: lib/cros_vm_lib.sh

Issue 4647001: crosutils: Add vnc view of tests and running multiple tests for VM tests (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Respond to sosa review 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « bin/cros_start_vm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 # 4 #
5 # Common vm functions for use in crosutils. 5 # Common vm functions for use in crosutils.
6 6
7 DEFINE_string kvm_pid "" \ 7 DEFINE_string kvm_pid "" \
8 "Use this pid file. If it exists and is set, use the vm specified by pid." 8 "Use this pid file. If it exists and is set, use the vm specified by pid."
9 DEFINE_boolean no_graphics ${FLAGS_FALSE} "Runs the KVM instance silently." 9 DEFINE_boolean no_graphics ${FLAGS_FALSE} "Runs the KVM instance silently."
10 DEFINE_boolean persist "${FLAGS_FALSE}" "Persist vm." 10 DEFINE_boolean persist "${FLAGS_FALSE}" "Persist vm."
11 DEFINE_boolean snapshot ${FLAGS_FALSE} "Don't commit changes to image." 11 DEFINE_boolean snapshot ${FLAGS_FALSE} "Don't commit changes to image."
12 DEFINE_integer ssh_port 9222 "Port to tunnel ssh traffic over." 12 DEFINE_integer ssh_port 9222 "Port to tunnel ssh traffic over."
13 DEFINE_string vnc "" "VNC Server to display to instead of SDL."
13 14
14 KVM_PID_FILE=/tmp/kvm.$$.pid 15 KVM_PID_FILE=/tmp/kvm.$$.pid
15 LIVE_VM_IMAGE= 16 LIVE_VM_IMAGE=
16 17
17 function get_pid() { 18 function get_pid() {
18 sudo cat "${KVM_PID_FILE}" 19 sudo cat "${KVM_PID_FILE}"
19 } 20 }
20 21
21 # TODO(rtc): These flags assume that we'll be using KVM on Lucid and won't work 22 # TODO(rtc): These flags assume that we'll be using KVM on Lucid and won't work
22 # on Hardy. 23 # on Hardy.
(...skipping 12 matching lines...) Expand all
35 exit 1 36 exit 1
36 fi 37 fi
37 else 38 else
38 # No pid specified by PID file. Let's create a VM instance in this case. 39 # No pid specified by PID file. Let's create a VM instance in this case.
39 echo "Starting a KVM instance" >&2 40 echo "Starting a KVM instance" >&2
40 local nographics="" 41 local nographics=""
41 local usesnapshot="" 42 local usesnapshot=""
42 if [ ${FLAGS_no_graphics} -eq ${FLAGS_TRUE} ]; then 43 if [ ${FLAGS_no_graphics} -eq ${FLAGS_TRUE} ]; then
43 nographics="-nographic -serial none" 44 nographics="-nographic -serial none"
44 fi 45 fi
46 if [ -n "${FLAGS_vnc}" ]; then
47 nographics="-vnc ${FLAGS_vnc}"
48 fi
45 49
46 if [ ${FLAGS_snapshot} -eq ${FLAGS_TRUE} ]; then 50 if [ ${FLAGS_snapshot} -eq ${FLAGS_TRUE} ]; then
47 snapshot="-snapshot" 51 snapshot="-snapshot"
48 fi 52 fi
49 53
50 sudo kvm -m 1024 \ 54 sudo kvm -m 1024 \
51 -vga std \ 55 -vga std \
52 -pidfile "${KVM_PID_FILE}" \ 56 -pidfile "${KVM_PID_FILE}" \
53 -daemonize \ 57 -daemonize \
54 -net nic,model=e1000 \ 58 -net nic,model=e1000 \
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 if [ -n "${pid}" ]; then 99 if [ -n "${pid}" ]; then
96 echo "Killing ${pid}" >&2 100 echo "Killing ${pid}" >&2
97 sudo kill ${pid} 101 sudo kill ${pid}
98 sudo rm "${KVM_PID_FILE}" 102 sudo rm "${KVM_PID_FILE}"
99 else 103 else
100 echo "No kvm pid found to stop." >&2 104 echo "No kvm pid found to stop." >&2
101 return 1 105 return 1
102 fi 106 fi
103 fi 107 fi
104 } 108 }
OLDNEW
« no previous file with comments | « bin/cros_start_vm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698