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