xref: /kvm-unit-tests/x86/run (revision 4da0bc9a24a78cf61f046898b24c45577b645492)
1#!/usr/bin/env bash
2
3[ -z "$STANDALONE" ] && source scripts/arch-run.bash
4
5qemu=$(search_qemu_binary)
6
7if ! ${qemu} -device '?' 2>&1 | grep -F -e \"testdev\" -e \"pc-testdev\" > /dev/null;
8then
9    echo "No Qemu test device support found"
10    exit 2
11fi
12
13if
14	${qemu} -device '?' 2>&1 | grep -F "pci-testdev" > /dev/null;
15then
16	pci_testdev="-device pci-testdev"
17else
18	pci_testdev=""
19fi
20
21if
22	${qemu} -device '?' 2>&1 | grep -F "pc-testdev" > /dev/null;
23then
24	pc_testdev="-device pc-testdev -device isa-debug-exit,iobase=0xf4,iosize=0x4"
25else
26	pc_testdev="-device testdev,chardev=testlog -chardev file,id=testlog,path=msr.out"
27fi
28
29initrd_create
30
31command="${qemu} -nodefaults -enable-kvm $pc_testdev -vnc none -serial stdio $pci_testdev $hyperv_testdev"
32command+=" $INITRD -kernel"
33command="$(timeout_cmd) $command"
34echo ${command} "$@"
35
36run_qemu ${command} "$@"
37