1#!/bin/bash 2 3qemukvm="${QEMU:-qemu-kvm}" 4qemusystem="${QEMU:-qemu-system-x86_64}" 5if 6 ${qemukvm} -device '?' 2>&1 | grep -F -e \"testdev\" -e \"pc-testdev\" > /dev/null; 7then 8 qemu="${qemukvm}" 9else 10 if 11 ${qemusystem} -device '?' 2>&1 | grep -F -e \"testdev\" -e \"pc-testdev\" > /dev/null; 12 then 13 qemu="${qemusystem}" 14 else 15 echo QEMU binary ${QEMU} has no support for test device. Exiting. 16 exit 2 17 fi 18fi 19 20if 21 ${qemu} -device '?' 2>&1 | grep -F "pci-testdev" > /dev/null; 22then 23 pci_testdev="-device pci-testdev" 24else 25 pci_testdev="" 26fi 27 28if 29 ${qemu} -device '?' 2>&1 | grep -F "pc-testdev" > /dev/null; 30then 31 pc_testdev="-device pc-testdev -device isa-debug-exit,iobase=0xf4,iosize=0x4" 32else 33 pc_testdev="-device testdev,chardev=testlog -chardev file,id=testlog,path=msr.out" 34fi 35 36command="${qemu} -enable-kvm $pc_testdev -display none -serial stdio $pci_testdev -kernel" 37echo ${command} "$@" 38${command} "$@" 39ret=$? 40echo Return value from qemu: $ret 41exit $ret 42