Re: [kvm-unit-tests RFC PATCH 1/5] lib: arm: Print test exit status on exit if chr-testdev is not available

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Drew,

Sorry for taking so long to reply, been busy with other things.

On 7/12/21 5:36 PM, Andrew Jones wrote:
> On Fri, Jul 02, 2021 at 05:31:18PM +0100, Alexandru Elisei wrote:
>> The arm64 tests can be run under kvmtool, which doesn't emulate a
>> chr-testdev device. In preparation for adding run script support for
>> kvmtool, print the test exit status so the scripts can pick it up and
>> correctly mark the test as pass or fail.
>>
>> Signed-off-by: Alexandru Elisei <alexandru.elisei@xxxxxxx>
>> ---
>>  lib/chr-testdev.h |  1 +
>>  lib/arm/io.c      | 10 +++++++++-
>>  lib/chr-testdev.c |  5 +++++
>>  3 files changed, 15 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/chr-testdev.h b/lib/chr-testdev.h
>> index ffd9a851aa9b..09b4b424670e 100644
>> --- a/lib/chr-testdev.h
>> +++ b/lib/chr-testdev.h
>> @@ -11,4 +11,5 @@
>>   */
>>  extern void chr_testdev_init(void);
>>  extern void chr_testdev_exit(int code);
>> +extern bool chr_testdev_available(void);
>>  #endif
>> diff --git a/lib/arm/io.c b/lib/arm/io.c
>> index 343e10822263..9e62b571a91b 100644
>> --- a/lib/arm/io.c
>> +++ b/lib/arm/io.c
>> @@ -125,7 +125,15 @@ extern void halt(int code);
>>  
>>  void exit(int code)
>>  {
>> -	chr_testdev_exit(code);
>> +	if (chr_testdev_available()) {
>> +		chr_testdev_exit(code);
> chr_testdev_exit() already has a 'if !vcon goto out' in it, so you can
> just call it unconditionally. No need for chr_testdev_available().

I'm not sure what you mean. There has to be a way to check if chr-testdev is
available, and if it's not present on the system, to print the EXIT: STATUS
message, and vcon is static in chr-testdev.c.

Are you suggesting that we move the message to chr_testdev_exit(code)?

Thanks,

Alex

>
>> +	} else {
>> +		/*
>> +		 * Print the test return code in the format used by chr-testdev
>> +		 * so the runner script can parse it.
>> +		 */
>> +		printf("\nEXIT: STATUS=%d\n", ((code) << 1) | 1);
>> +	}
>>  	psci_system_off();
>>  	halt(code);
>>  	__builtin_unreachable();
>> diff --git a/lib/chr-testdev.c b/lib/chr-testdev.c
>> index b3c641a833fe..301e73a6c064 100644
>> --- a/lib/chr-testdev.c
>> +++ b/lib/chr-testdev.c
>> @@ -68,3 +68,8 @@ void chr_testdev_init(void)
>>  	in_vq = vqs[0];
>>  	out_vq = vqs[1];
>>  }
>> +
>> +bool chr_testdev_available(void)
>> +{
>> +	return vcon != NULL;
>> +}
>> -- 
>> 2.32.0
>>
> Thanks,
> drew 
>



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux