xref: /kvm-unit-tests/x86/run (revision 33a6576c6e1bfd98fd35402c9f64dfd7537dd2ff)
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
12ACCEL=$(get_qemu_accelerator) ||
13	exit $?
14
15qemu=$(search_qemu_binary) ||
16	exit $?
17
18if ! ${qemu} -device '?' 2>&1 | grep -F -e \"testdev\" -e \"pc-testdev\" > /dev/null;
19then
20    echo "No Qemu test device support found"
21    exit 2
22fi
23
24if
25	${qemu} -device '?' 2>&1 | grep -F "pci-testdev" > /dev/null;
26then
27	pci_testdev="-device pci-testdev"
28else
29	pci_testdev=""
30fi
31
32if
33	${qemu} -device '?' 2>&1 | grep -F "pc-testdev" > /dev/null;
34then
35	pc_testdev="-device pc-testdev -device isa-debug-exit,iobase=0xf4,iosize=0x4"
36else
37	pc_testdev="-device testdev,chardev=testlog -chardev file,id=testlog,path=msr.out"
38fi
39
40command="${qemu} --no-reboot -nodefaults $pc_testdev -vnc none -serial stdio $pci_testdev"
41command+=" -machine accel=$ACCEL -kernel"
42command="$(timeout_cmd) $command"
43
44run_qemu ${command} "$@"
45