Re: [PATCH 2/2] kselftest: add ksft_print_msg() function to output general information

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

 



On 06/28/2017 08:32 AM, Shuah Khan wrote:
> On 06/27/2017 11:29 AM, Paul Elder wrote:
>> Add a generic information output function: ksft_print_msg()
>>
>> Signed-off-by: Paul Elder <paul.elder@xxxxxxxx>
>> ---
>> I decided that it should use the comment output format rather than
>> yaml because yaml could be both restrictive or excessive.
>> Many tests seem to only output one simple error information string
>> (while keeping the test name constant) so wrapping that in yaml
>> seemed pointless.
> 
> Agreed. yaml isn't that appropriate for selftests.
> 
>>
>>  tools/testing/selftests/kselftest.h | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h
>> index b156e601f478..ccc6627af468 100644
>> --- a/tools/testing/selftests/kselftest.h
>> +++ b/tools/testing/selftests/kselftest.h
>> @@ -55,6 +55,17 @@ static inline void ksft_print_cnts(void)
>>  	printf("1..%d\n", ksft_test_num());
>>  }
>>  
>> +static inline void ksft_print_msg(const char *msg, ...)
>> +{
>> +	va_list args;
>> +
>> +	va_start(args, msg);
>> +	printf("# ");
>> +	vprintf(msg, args);
>> +	printf("\n");
> My concern with appending newline here is that we will end up with two.
> Users will have to know to not add the newline - it is a general practice
> to add it, so users will have to remember to not add it.
I did not realize that adding newlines was the general practice. I thought that
just for these ksft_* output functions we could make them all not require newlines,
like perror().

Should I remove the newlines from all the other ksft_* output functions as well?

Thank you,

Paul

> 
>> +	va_end(args);
>> +}
>> +
>>  static inline void ksft_test_result_pass(const char *msg, ...)
>>  {
>>  	va_list args;
>>
> 
> thanks,
> -- Shuah
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux