1#!/usr/bin/env bash 2 3if [ -z "$KUT_STANDALONE" ]; then 4 if [ ! -f config.mak ]; then 5 echo "run ./configure && make first. See ./configure -h" 6 exit 2 7 fi 8 source config.mak 9 source scripts/arch-run.bash 10fi 11 12set_qemu_accelerator || exit $? 13 14qemu=$(search_qemu_binary) || 15 exit $? 16 17if ! ${qemu} -device '?' 2>&1 | grep -F -e \"testdev\" -e \"pc-testdev\" > /dev/null; 18then 19 echo "No Qemu test device support found" 20 exit 2 21fi 22 23if 24 ${qemu} -device '?' 2>&1 | grep -F "pci-testdev" > /dev/null; 25then 26 pci_testdev="-device pci-testdev" 27else 28 pci_testdev="" 29fi 30 31if 32 ${qemu} -device '?' 2>&1 | grep -F "pc-testdev" > /dev/null; 33then 34 pc_testdev="-device pc-testdev -device isa-debug-exit,iobase=0xf4,iosize=0x4" 35else 36 pc_testdev="-device testdev,chardev=testlog -chardev file,id=testlog,path=msr.out" 37fi 38 39command="${qemu} --no-reboot -nodefaults $pc_testdev -vnc none -serial stdio $pci_testdev" 40command+=" -machine accel=$ACCEL$ACCEL_PROPS" 41if [ "${CONFIG_EFI}" != y ]; then 42 command+=" -kernel" 43fi 44command="$(timeout_cmd) $command" 45 46if [ "${CONFIG_EFI}" = y ]; then 47 # Set ENVIRON_DEFAULT=n to remove '-initrd' flag for QEMU (see 48 # 'scripts/arch-run.bash' for more details). This is because when using 49 # UEFI, the test case binaries are passed to QEMU through the disk 50 # image, not through the '-kernel' flag. And QEMU reports an error if it 51 # gets '-initrd' without a '-kernel' 52 ENVIRON_DEFAULT=n run_qemu ${command} "$@" 53else 54 run_qemu ${command} "$@" 55fi 56