xref: /kvm-unit-tests/x86/run (revision 70fcb64b7d548240f6f08680ccbe94f9c16104fb)
1#!/usr/bin/env bash
2
3if [ -z "$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
12qemu=$(search_qemu_binary)
13
14if ! ${qemu} -device '?' 2>&1 | grep -F -e \"testdev\" -e \"pc-testdev\" > /dev/null;
15then
16    echo "No Qemu test device support found"
17    exit 2
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
36initrd_create
37
38command="${qemu} -nodefaults -enable-kvm $pc_testdev -vnc none -serial stdio $pci_testdev $hyperv_testdev"
39command+=" $INITRD -kernel"
40command="$(timeout_cmd) $command"
41echo ${command} "$@"
42
43run_qemu ${command} "$@"
44