[kvm-unit-tests PATCH v3 26/27] lib: arm: Print test exit status

Nikos Nikoleris
2022-06-30T10:04:40Z

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

The arm tests can be run under kvmtool, which doesn't emulate a chr-testdev
device. Print the test exit status to make it possible for the runner
scripts to pick it up when they have support for it.

Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
Signed-off-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
---
lib/arm/io.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/lib/arm/io.c b/lib/arm/io.c
index a91f116..337cf1b 100644
--- a/lib/arm/io.c
+++ b/lib/arm/io.c
@@ -138,6 +138,12 @@ extern void halt(int code);

void exit(int code)
{
+ /*
+ * Print the test return code in the format used by chr-testdev so the
+ * runner can pick it up if there is chr-testdev is not present.
+ */
+ printf("\nEXIT: STATUS=%d\n", ((code) << 1) | 1);
+
chr_testdev_exit(code);
psci_system_off();
halt(code);
--
2.25.1