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