11b7dd7d3SSergey Bronnikov#!/usr/bin/env bash 2928ec374SMichael S. Tsirkin 357ab5a6dSThomas Huthif [ -z "$KUT_STANDALONE" ]; then 4786bfc8dSAndrew Jones if [ ! -f config.mak ]; then 5786bfc8dSAndrew Jones echo "run ./configure && make first. See ./configure -h" 6786bfc8dSAndrew Jones exit 2 7786bfc8dSAndrew Jones fi 8786bfc8dSAndrew Jones source config.mak 9786bfc8dSAndrew Jones source scripts/arch-run.bash 10786bfc8dSAndrew Jonesfi 11b2a2aa5dSAndrew Jones 12*01e047d0SGavin Shanset_qemu_accelerator || exit $? 1323505cedSRadim Krčmář 14fcf4e0d9SRadim Krčmářqemu=$(search_qemu_binary) || 15fcf4e0d9SRadim Krčmář exit $? 16b895b967SBandan Das 17eff4e220SBalamuruhan Sif ! ${qemu} -device '?' 2>&1 | grep -F -e \"testdev\" -e \"pc-testdev\" > /dev/null; 18b895b967SBandan Dasthen 19b895b967SBandan Das echo "No Qemu test device support found" 20a3831260SAndrew Jones exit 2 21928ec374SMichael S. Tsirkinfi 22928ec374SMichael S. Tsirkin 23ec3c77fbSRen, Yongjieif 24740001b3SRen, Yongjie ${qemu} -device '?' 2>&1 | grep -F "pci-testdev" > /dev/null; 255292dbf7SMichael S. Tsirkinthen 265292dbf7SMichael S. Tsirkin pci_testdev="-device pci-testdev" 275292dbf7SMichael S. Tsirkinelse 285292dbf7SMichael S. Tsirkin pci_testdev="" 295292dbf7SMichael S. Tsirkinfi 305292dbf7SMichael S. Tsirkin 31928ec374SMichael S. Tsirkinif 32740001b3SRen, Yongjie ${qemu} -device '?' 2>&1 | grep -F "pc-testdev" > /dev/null; 33928ec374SMichael S. Tsirkinthen 345292dbf7SMichael S. Tsirkin pc_testdev="-device pc-testdev -device isa-debug-exit,iobase=0xf4,iosize=0x4" 35928ec374SMichael S. Tsirkinelse 365292dbf7SMichael S. Tsirkin pc_testdev="-device testdev,chardev=testlog -chardev file,id=testlog,path=msr.out" 37928ec374SMichael S. Tsirkinfi 3809142098SKevin Wolf 39e6137187SSean Christophersoncommand="${qemu} --no-reboot -nodefaults $pc_testdev -vnc none -serial stdio $pci_testdev" 40*01e047d0SGavin Shancommand+=" -machine accel=$ACCEL$ACCEL_PROPS" 41c98ce6e0SAlexandru Eliseiif [ "${CONFIG_EFI}" != y ]; then 42ad5fb883SZixuan Wang command+=" -kernel" 43ad5fb883SZixuan Wangfi 44fd149358SAndrew Jonescommand="$(timeout_cmd) $command" 4592a1afcbSAndrew Jones 46c98ce6e0SAlexandru Eliseiif [ "${CONFIG_EFI}" = y ]; then 47ad5fb883SZixuan Wang # Set ENVIRON_DEFAULT=n to remove '-initrd' flag for QEMU (see 48ad5fb883SZixuan Wang # 'scripts/arch-run.bash' for more details). This is because when using 49ad5fb883SZixuan Wang # UEFI, the test case binaries are passed to QEMU through the disk 50ad5fb883SZixuan Wang # image, not through the '-kernel' flag. And QEMU reports an error if it 51ad5fb883SZixuan Wang # gets '-initrd' without a '-kernel' 52ad5fb883SZixuan Wang ENVIRON_DEFAULT=n run_qemu ${command} "$@" 53ad5fb883SZixuan Wangelse 54b2a2aa5dSAndrew Jones run_qemu ${command} "$@" 55ad5fb883SZixuan Wangfi 56