diff options
author | Amit Shah <amit.shah@redhat.com> | 2010-04-22 19:02:21 +0530 |
---|---|---|
committer | Amit Shah <amit.shah@redhat.com> | 2010-04-22 19:10:53 +0530 |
commit | 274a19722c8262fe078398357006973e09f4e33f (patch) | |
tree | 48addae3786fec9aeb38aa549069db5a449b8559 | |
parent | 58b261ec82876abc22595fdf74bfe2dd8d94e2f2 (diff) | |
download | test-virtserial-274a19722c8262fe078398357006973e09f4e33f.tar.gz test-virtserial-274a19722c8262fe078398357006973e09f4e33f.tar.xz test-virtserial-274a19722c8262fe078398357006973e09f4e33f.zip |
run-test: Store pid of spawned qemu process to only kill that pid later
We used to kill all processes that had 'qemu' in their name. This was
obviously not a good thing for other running qemu processes. Record the
pid of the spawned process to only kill that one later.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
-rwxr-xr-x | run-test.sh | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/run-test.sh b/run-test.sh index 6ebc3f3..8bcfa51 100755 --- a/run-test.sh +++ b/run-test.sh @@ -32,12 +32,31 @@ MISCOPT="-net none -enable-kvm -m 1G -serial file:/tmp/amit/test-serial.log \ KVMOPT="-smp $VCPUS" SNAPSHOT="-snapshot" +QEMU_PIDFILE=/tmp/amit/qemu.pid + +function kill_qemu { + + if [ -s $QEMU_PIDFILE ]; then + declare -i qemu_pid + + qemu_pid=`cat $QEMU_PIDFILE` + rm $QEMU_PIDFILE + kill -9 $qemu_pid + qemu_pid= + fi +} + function do_test { + declare -i qemu_pid + pkill -9 auto-virtserial - pkill -9 qemu + kill_qemu echo $QEMU $QEMU_OPTS $QEMU $QEMU_OPTS & + qemu_pid=$! + echo $qemu_pid > $QEMU_PIDFILE + qemu_pid= # Give some time for the guest to come up sleep 5 @@ -45,7 +64,8 @@ function do_test { > /tmp/amit/guest-big-file > /tmp/amit/guest-csumfile time ./auto-virtserial - pkill qemu + + kill_qemu } # -- Iteration 1: new kernel, new qemu -- |