summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2015-11-19 13:17:15 +0100
committerDaniel Mack <daniel@zonque.org>2015-11-19 14:25:32 +0100
commitdbf43a42b8bb66d53c7cbab05f104c28097f811e (patch)
treef02452c82181f6c3ce6923380c1e51fc6c2564da
parent1b1eae69ce52ef6c89a1200e8d3758549b291991 (diff)
test: make qemu use kvm if available
If we're running in a KVM virtualized environment (such as Semaphore's Docker enabled platform), pass '-cpu host' to QEMU.
-rw-r--r--test/test-functions7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/test-functions b/test/test-functions
index 0a9d4f80ac..5d223dbc63 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -68,8 +68,7 @@ selinux=0 \
$KERNEL_APPEND \
"
- QEMU_OPTIONS="-machine accel=kvm:tcg \
--smp $QEMU_SMP \
+ QEMU_OPTIONS="-smp $QEMU_SMP \
-net none \
-m 512M \
-nographic \
@@ -80,6 +79,10 @@ $KERNEL_APPEND \
QEMU_OPTIONS="$QEMU_OPTIONS -initrd $INITRD"
fi
+ if [ -c /dev/kvm ]; then
+ QEMU_OPTIONS="$QEMU_OPTIONS -machine accel=kvm -enable-kvm -cpu host"
+ fi
+
( set -x
$QEMU_BIN $QEMU_OPTIONS -append "$KERNEL_APPEND" $TESTDIR/rootdisk.img ) || return 1
}