xref: /kvm-unit-tests/s390x/run (revision 9cab58249f98adc451933530fd7e618e1856eb94)
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
12set_qemu_accelerator || exit $?
13
14qemu=$(search_qemu_binary) ||
15	exit $?
16
17is_pv() {
18	if [ "${1: -7}" = ".pv.bin" ] || [ "${TESTNAME: -3}" = "_PV" ]; then
19		return 0
20	fi
21	return 1
22}
23
24if is_pv "$@" && [ "$ACCEL" = "tcg" ]; then
25	echo "Protected Virtualization isn't supported under TCG"
26	exit 2
27fi
28
29if is_pv "$@" && [ "$MIGRATION" = "yes" ]; then
30	echo "Migration isn't supported under Protected Virtualization"
31	exit 2
32fi
33
34M='-machine s390-ccw-virtio'
35M+=",accel=$ACCEL$ACCEL_PROPS"
36
37if is_pv "$@"; then
38	M+=",confidential-guest-support=pv0"
39fi
40
41command="$qemu -nodefaults -nographic $M"
42if is_pv "$@"; then
43	command+=" -object s390-pv-guest,id=pv0"
44fi
45command+=" -chardev stdio,id=con0 -device sclpconsole,chardev=con0"
46command+=" -kernel"
47command="$(panic_cmd) $(migration_cmd) $(timeout_cmd) $command"
48
49# We return the exit code via stdout, not via the QEMU return code
50run_qemu_status $command "$@"
51