blob: 867a1cccd3ba382c37d4b45a56657101cb0e688b [file] [log] [blame] [raw]
#!/bin/bash
[ -z "$STANDALONE" ] && source scripts/arch-run.bash
qemubinarysearch="${QEMU:-qemu-kvm qemu-system-x86_64}"
for qemucmd in ${qemubinarysearch}
do
unset QEMUFOUND
unset qemu
if ! [ -z "${QEMUFOUND=$(${qemucmd} --help 2>/dev/null | grep "QEMU")}" ] &&
${qemucmd} -device '?' 2>&1 | grep -F -e \"testdev\" -e \"pc-testdev\" > /dev/null;
then
qemu="${qemucmd}"
break
fi
done
if [ -z "${QEMUFOUND}" ]
then
echo "A QEMU binary was not found, You can set a custom location by using the QEMU=<path> environment variable "
exit 2
elif [ -z "${qemu}" ]
then
echo "No Qemu test device support found"
exit 2
fi
if
${qemu} -device '?' 2>&1 | grep -F "pci-testdev" > /dev/null;
then
pci_testdev="-device pci-testdev"
else
pci_testdev=""
fi
if
${qemu} -device '?' 2>&1 | grep -F "pc-testdev" > /dev/null;
then
pc_testdev="-device pc-testdev -device isa-debug-exit,iobase=0xf4,iosize=0x4"
else
pc_testdev="-device testdev,chardev=testlog -chardev file,id=testlog,path=msr.out"
fi
command="${qemu} -nodefaults -enable-kvm $pc_testdev -vnc none -serial stdio $pci_testdev $hyperv_testdev"
[ -f "$ENV" ] && command+=" -initrd $ENV"
command+=" -kernel"
command="$(timeout_cmd) $command"
echo ${command} "$@"
run_qemu ${command} "$@"