diff mbox series

[3/3] selftests: kselftest: also use strerror() on nolibc

Message ID 20240426-nolibc-strerror-v1-3-76a4c9c5271d@weissschuh.net (mailing list archive)
State Accepted
Commit 6ca8f2e20bd1ced8a7cd12b3ae4b1ceca85cfc2b
Headers show
Series tools/nolibc: implement strerror() | expand

Commit Message

Thomas Weißschuh April 26, 2024, 11:08 a.m. UTC
nolibc gained an implementation of strerror() recently.
Use it and drop the ifdeffery.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 tools/testing/selftests/kselftest.h | 8 --------
 1 file changed, 8 deletions(-)

Comments

Thomas Weißschuh May 27, 2024, 4:11 p.m. UTC | #1
Hi Shuah,

Could you Ack the patch below to kselftest.h?

Thanks,
Thomas

On 2024-04-26 13:08:58+0000, Thomas Weißschuh wrote:
> nolibc gained an implementation of strerror() recently.
> Use it and drop the ifdeffery.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
>  tools/testing/selftests/kselftest.h | 8 --------
>  1 file changed, 8 deletions(-)
> 
> diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h
> index 541bf192e30e..f4bfe98c31e4 100644
> --- a/tools/testing/selftests/kselftest.h
> +++ b/tools/testing/selftests/kselftest.h
> @@ -161,15 +161,7 @@ static inline __printf(1, 2) void ksft_print_msg(const char *msg, ...)
>  
>  static inline void ksft_perror(const char *msg)
>  {
> -#ifndef NOLIBC
>  	ksft_print_msg("%s: %s (%d)\n", msg, strerror(errno), errno);
> -#else
> -	/*
> -	 * nolibc doesn't provide strerror() and it seems
> -	 * inappropriate to add one, just print the errno.
> -	 */
> -	ksft_print_msg("%s: %d)\n", msg, errno);
> -#endif
>  }
>  
>  static inline __printf(1, 2) void ksft_test_result_pass(const char *msg, ...)
> 
> -- 
> 2.44.0
>
Shuah Khan June 28, 2024, 8:56 p.m. UTC | #2
On 5/27/24 10:11, Thomas Weißschuh wrote:
> Hi Shuah,
> 
> Could you Ack the patch below to kselftest.h?
> 
> Thanks,
> Thomas
> 
> On 2024-04-26 13:08:58+0000, Thomas Weißschuh wrote:
>> nolibc gained an implementation of strerror() recently.
>> Use it and drop the ifdeffery.
>>
>> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
>> ---
>>   tools/testing/selftests/kselftest.h | 8 --------
>>   1 file changed, 8 deletions(-)
>>
>> diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h
>> index 541bf192e30e..f4bfe98c31e4 100644
>> --- a/tools/testing/selftests/kselftest.h
>> +++ b/tools/testing/selftests/kselftest.h
>> @@ -161,15 +161,7 @@ static inline __printf(1, 2) void ksft_print_msg(const char *msg, ...)
>>   
>>   static inline void ksft_perror(const char *msg)
>>   {
>> -#ifndef NOLIBC
>>   	ksft_print_msg("%s: %s (%d)\n", msg, strerror(errno), errno);
>> -#else
>> -	/*
>> -	 * nolibc doesn't provide strerror() and it seems
>> -	 * inappropriate to add one, just print the errno.
>> -	 */
>> -	ksft_print_msg("%s: %d)\n", msg, errno);
>> -#endif
>>   }
>>   
>>   static inline __printf(1, 2) void ksft_test_result_pass(const char *msg, ...)
>>
>> -- 
>> 2.44.0
>>


Sorry - this git lost in my Inbox.

Acked-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah
Shuah Khan June 28, 2024, 9:25 p.m. UTC | #3
On 4/26/24 05:08, Thomas Weißschuh wrote:
> nolibc gained an implementation of strerror() recently.
> Use it and drop the ifdeffery.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
>   tools/testing/selftests/kselftest.h | 8 --------
>   1 file changed, 8 deletions(-)
> 
> diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h
> index 541bf192e30e..f4bfe98c31e4 100644
> --- a/tools/testing/selftests/kselftest.h
> +++ b/tools/testing/selftests/kselftest.h
> @@ -161,15 +161,7 @@ static inline __printf(1, 2) void ksft_print_msg(const char *msg, ...)
>   
>   static inline void ksft_perror(const char *msg)
>   {
> -#ifndef NOLIBC
>   	ksft_print_msg("%s: %s (%d)\n", msg, strerror(errno), errno);
> -#else
> -	/*
> -	 * nolibc doesn't provide strerror() and it seems
> -	 * inappropriate to add one, just print the errno.
> -	 */
> -	ksft_print_msg("%s: %d)\n", msg, errno);
> -#endif
>   }
>   
>   static inline __printf(1, 2) void ksft_test_result_pass(const char *msg, ...)
> 

Sorry for the delay o this.

Acked-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah
diff mbox series

Patch

diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h
index 541bf192e30e..f4bfe98c31e4 100644
--- a/tools/testing/selftests/kselftest.h
+++ b/tools/testing/selftests/kselftest.h
@@ -161,15 +161,7 @@  static inline __printf(1, 2) void ksft_print_msg(const char *msg, ...)
 
 static inline void ksft_perror(const char *msg)
 {
-#ifndef NOLIBC
 	ksft_print_msg("%s: %s (%d)\n", msg, strerror(errno), errno);
-#else
-	/*
-	 * nolibc doesn't provide strerror() and it seems
-	 * inappropriate to add one, just print the errno.
-	 */
-	ksft_print_msg("%s: %d)\n", msg, errno);
-#endif
 }
 
 static inline __printf(1, 2) void ksft_test_result_pass(const char *msg, ...)