diff mbox series

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

Message ID 20220630100324.3153655-27-nikos.nikoleris@arm.com (mailing list archive)
State New, archived
Headers show
Series EFI and ACPI support for arm64 | expand

Commit Message

Nikos Nikoleris June 30, 2022, 10:03 a.m. UTC
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(+)

Comments

Andrew Jones July 1, 2022, 10:48 a.m. UTC | #1
On Thu, Jun 30, 2022 at 11:03:23AM +0100, Nikos Nikoleris wrote:
> 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.

nit: The comment isn't worded quite right...

The printed format ("EXIT: STATUS=") isn't chr-testdev's format, but it
is the format we want, because it's consistent with powerpc and s390x.
The exit code format '(code << 1) | 1' is chr-testdev's and
isa-debug-exit's exit format.

> +	 */
> +	printf("\nEXIT: STATUS=%d\n", ((code) << 1) | 1);
> +
>  	chr_testdev_exit(code);
>  	psci_system_off();
>  	halt(code);
> -- 
> 2.25.1
>

Anyway,

Reviewed-by: Andrew Jones <andrew.jones@linux.dev>
diff mbox series

Patch

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);