xref: /kvm-unit-tests/s390x/run (revision b4667f4ca26aea926a2ddecfcb5669e0e4e7cbf4)
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 [ "${1: -7}" = ".pv.bin" ] || [ "${TESTNAME: -3}" = "_PV" ] && [ "$ACCEL" = "tcg" ]; then
19	echo "Protected Virtualization isn't supported under TCG"
20	exit 2
21fi
22
23M='-machine s390-ccw-virtio'
24M+=",accel=$ACCEL"
25command="$qemu -nodefaults -nographic $M"
26command+=" -chardev stdio,id=con0 -device sclpconsole,chardev=con0"
27command+=" -kernel"
28command="$(timeout_cmd) $command"
29
30# We return the exit code via stdout, not via the QEMU return code
31run_qemu_status $command "$@"
32