git.annexia.org
/
qemu-sanity-check.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add -m/--machine option.
[qemu-sanity-check.git]
/
qemu-sanity-check.in
diff --git
a/qemu-sanity-check.in
b/qemu-sanity-check.in
index
bda6cc7
..
e1abafd
100644
(file)
--- a/
qemu-sanity-check.in
+++ b/
qemu-sanity-check.in
@@
-1,7
+1,7
@@
#!/bin/bash
# -*- shell-script -*-
# qemu-sanity-check
#!/bin/bash
# -*- shell-script -*-
# qemu-sanity-check
-# Copyright (C) 2013 Red Hat Inc.
+# Copyright (C) 2013
-2020
Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@
-25,6
+25,15
@@
arch="$(uname -m)"
canonical_arch="$(uname -m | sed 's/i[456]86/i386/')"
timeout=10m
canonical_arch="$(uname -m | sed 's/i[456]86/i386/')"
timeout=10m
+accel=kvm:tcg
+
+# Default machine type depends on arch. You can override this using
+# -m|--machine option.
+case "$canonical_arch" in
+ arm*|aarch*) machine=virt ;;
+ # On non-ARM let qemu pick the default.
+ *) machine= ;;
+esac
# Handle command line parsing.
# Handle command line parsing.
@@
-32,8
+41,10
@@
function usage {
echo "qemu-sanity-check [options]"
echo "Options:"
echo " --help Display this help"
echo "qemu-sanity-check [options]"
echo "Options:"
echo " --help Display this help"
+ echo " --accel=[kvm|tcg] Force KVM or software emulation"
echo " -i|--initrd=initrd Set location of initramfs"
echo " -k|--kernel=vmlinuz Set location of kernel"
echo " -i|--initrd=initrd Set location of initramfs"
echo " -k|--kernel=vmlinuz Set location of kernel"
+ echo " -m|--machine=machine Set machine type"
echo " -q|--qemu=qemu Set location of qemu/KVM binary"
echo " -t|--timeout=timeout Set the timeout"
echo " -V|--version Display version and exit"
echo " -q|--qemu=qemu Set location of qemu/KVM binary"
echo " -t|--timeout=timeout Set the timeout"
echo " -V|--version Display version and exit"
@@
-41,10
+52,12
@@
function usage {
}
TEMP=$(getopt \
}
TEMP=$(getopt \
- -o i:k:q:t:V \
+ -o i:k:
m:
q:t:V \
--long help \
--long help \
+ --long accel: \
--long initrd: \
--long kernel: \
--long initrd: \
--long kernel: \
+ --long machine: \
--long qemu: \
--long timeout: \
--long version \
--long qemu: \
--long timeout: \
--long version \
@@
-57,6
+70,10
@@
while true; do
--help)
usage
;;
--help)
usage
;;
+ --accel)
+ accel="$2"
+ shift 2
+ ;;
-i|--initrd)
initrd="$2"
shift 2
-i|--initrd)
initrd="$2"
shift 2
@@
-65,6
+82,10
@@
while true; do
kernel="$2"
shift 2
;;
kernel="$2"
shift 2
;;
+ -m|--machine)
+ machine="$2"
+ shift 2
+ ;;
-q|--qemu)
qemu="$2"
shift 2
-q|--qemu)
qemu="$2"
shift 2
@@
-99,7
+120,7
@@
fi
# Locate kernel if not specified.
if [ -z "$kernel" ]; then
# Locate kernel if not specified.
if [ -z "$kernel" ]; then
- kernel="$(ls -
vr /boot/vmlinuz-*.$arch
| head -1)"
+ kernel="$(ls -
1dvr /boot/vmlinuz-*.$arch* 2>/dev/null | grep -v xen
| head -1)"
if [ -z "$kernel" ]; then
echo "$0: cannot find a Linux kernel in /boot"
echo "Choose a kernel to test using --kernel=/path/to/vmlinuz"
if [ -z "$kernel" ]; then
echo "$0: cannot find a Linux kernel in /boot"
echo "Choose a kernel to test using --kernel=/path/to/vmlinuz"
@@
-113,7
+134,7
@@
fi
# Locate qemu if not specified.
if [ -z "$qemu" ]; then
# Locate qemu if not specified.
if [ -z "$qemu" ]; then
- for q in
qemu-kvm qemu-system-$canonical_arch qemu kvm
; do
+ for q in
@QEMU_LIST@
; do
if "$q" --help >/dev/null 2>&1; then
qemu="$q"
break
if "$q" --help >/dev/null 2>&1; then
qemu="$q"
break
@@
-133,9
+154,12
@@
test_output="$(mktemp --suff=.out)"
declare -a argv
i=0
argv[$((i++))]="$qemu"
declare -a argv
i=0
argv[$((i++))]="$qemu"
-argv[$((i++))]="-nographic"
-argv[$((i++))]="-nodefconfig"
+argv[$((i++))]="-display"
+argv[$((i++))]="none"
+argv[$((i++))]="-no-user-config"
argv[$((i++))]="-nodefaults"
argv[$((i++))]="-nodefaults"
+argv[$((i++))]="-machine"
+argv[$((i++))]="$machine${machine:+,}accel=$accel"
argv[$((i++))]="-no-reboot"
argv[$((i++))]="-serial"
argv[$((i++))]="file:$test_output"
argv[$((i++))]="-no-reboot"
argv[$((i++))]="-serial"
argv[$((i++))]="file:$test_output"
@@
-144,7
+168,7
@@
argv[$((i++))]="$kernel"
argv[$((i++))]="-initrd"
argv[$((i++))]="$initrd"
argv[$((i++))]="-append"
argv[$((i++))]="-initrd"
argv[$((i++))]="$initrd"
argv[$((i++))]="-append"
-argv[$((i++))]="console=ttyS0
panic=
1"
+argv[$((i++))]="console=ttyS0
oops=panic panic=-
1"
#echo "${argv[@]}"
#echo "${argv[@]}"