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

Andrew Jones
2022-07-01T10:48:19Z

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>