[RFC kvm-unit-tests 27/27] NOT-FOR-MERGING: add run-realm-tests

Joey Gouly
2023-01-27T11:55:37Z

From: Alexandru Elisei <alexandru.elisei@arm.com>

Until we add support for KVMTOOL to run the tests using the
scripts, provide a temporary script to run all the Realm tests.

Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
Signed-off-by: Joey Gouly <joey.gouly@arm.com>
---
arm/run-realm-tests | 56 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
create mode 100755 arm/run-realm-tests

diff --git a/arm/run-realm-tests b/arm/run-realm-tests
new file mode 100755
index 00000000..39f431d5
--- /dev/null
+++ b/arm/run-realm-tests
@@ -0,0 +1,56 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-only
+# Copyright (C) 2023, Arm Ltd
+# All rights reserved
+#
+
+TASKSET=${TASKSET:-taskset}
+LKVM=${LKVM:-lkvm}
+ARGS="--realm --irqchip=gicv3 --console=serial --network mode=none --nodefaults"
+
+TESTDIR="."
+while getopts "d:" option; do
+ case "${option}" in
+ d) TESTDIR=${OPTARG};;
+ ?)
+ exit 1
+ ;;
+ esac
+done
+if [[ ! -d ${TESTDIR} ]]; then
+ echo "Invalid directory: ${TESTDIR}"
+ exit 1
+fi
+
+function run_tests {
+ DIR="$1"
+
+ $LKVM run $ARGS -c 2 -m 16 -k $DIR/selftest.flat -p "setup smp=2 mem=16"
+ $LKVM run $ARGS -c 1 -m 16 -k $DIR/selftest.flat -p "vectors-kernel"
+ $LKVM run $ARGS -c 1 -m 16 -k $DIR/selftest.flat -p "vectors-user"
+ $LKVM run $ARGS -c 4 -m 32 -k $DIR/selftest.flat -p "smp"
+
+ $LKVM run $ARGS -c 1 -m 32 -k $DIR/realm-ns-memory.flat
+
+ $LKVM run $ARGS -c 4 -m 32 -k $DIR/psci.flat
+
+ $LKVM run $ARGS -c 4 -m 32 -k $DIR/gic.flat -p "ipi"
+ $LKVM run $ARGS -c 4 -m 32 -k $DIR/gic.flat -p "active"
+
+ $LKVM run $ARGS -c 1 -m 16 -k $DIR/timer.flat
+
+ $LKVM run $ARGS -c 1 -m 16 -k $DIR/realm-rsi.flat -p "version"
+ $LKVM run $ARGS -c 1 -m 16 -k $DIR/realm-rsi.flat -p "host_call hvc"
+ $LKVM run $ARGS -c 1 -m 16 -k $DIR/realm-sea.flat
+
+ $LKVM run $ARGS -c 1 -m 24 -k $DIR/realm-attest.flat -p "attest"
+ $LKVM run $ARGS -c 2 -m 24 -k $DIR/realm-attest.flat -p "attest_smp"
+ $LKVM run $ARGS -c 1 -m 24 -k $DIR/realm-attest.flat -p "extend"
+ $LKVM run $ARGS -c 2 -m 24 -k $DIR/realm-attest.flat -p "extend_smp"
+ $LKVM run $ARGS -c 1 -m 24 -k $DIR/realm-attest.flat -p "extend_and_attest"
+ $LKVM run $ARGS -c 1 -m 24 -k $DIR/realm-attest.flat -p "measurement"
+
+ $TASKSET -c 0 $LKVM run $ARGS -c 4 -m 32 -k $DIR/realm-fpu.flat
+}
+
+run_tests "${TESTDIR}"
--
2.17.1