diff mbox series

selftests: kselftest: Use strerror() on nolibc

Message ID 20240911044230.5914-1-zhangjiao2@cmss.chinamobile.com
State Accepted
Commit a0474b8d5974e142461ac7584c996feea167bcc1
Headers show
Series selftests: kselftest: Use strerror() on nolibc | expand

Commit Message

zhangjiao2 Sept. 11, 2024, 4:42 a.m. UTC
From: zhang jiao <zhangjiao2@cmss.chinamobile.com>

Nolibc gained an implementation of strerror() recently.
Use it and drop the ifndef.

Signed-off-by: zhang jiao <zhangjiao2@cmss.chinamobile.com>
---
 tools/testing/selftests/kselftest.h | 8 --------
 1 file changed, 8 deletions(-)

Comments

Shuah Khan Sept. 11, 2024, 3:36 p.m. UTC | #1
On 9/10/24 22:42, zhangjiao2 wrote:
> From: zhang jiao <zhangjiao2@cmss.chinamobile.com>
> 
> Nolibc gained an implementation of strerror() recently.
> Use it and drop the ifndef.
> 
> Signed-off-by: zhang jiao <zhangjiao2@cmss.chinamobile.com>
> ---
>   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 e195ec156859..29fedf609611 100644
> --- a/tools/testing/selftests/kselftest.h
> +++ b/tools/testing/selftests/kselftest.h
> @@ -373,15 +373,7 @@ static inline __noreturn __printf(1, 2) void ksft_exit_fail_msg(const char *msg,
>   
>   static inline __noreturn void ksft_exit_fail_perror(const char *msg)
>   {
> -#ifndef NOLIBC
>   	ksft_exit_fail_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_exit_fail_msg("%s: %d)\n", msg, errno);
> -#endif
>   }
>   
>   static inline __noreturn void ksft_exit_xfail(void)

Adding nolibc maintainers for review.

Willy and Thomas, please review.

thanks,
-- Shuah
diff mbox series

Patch

diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h
index e195ec156859..29fedf609611 100644
--- a/tools/testing/selftests/kselftest.h
+++ b/tools/testing/selftests/kselftest.h
@@ -373,15 +373,7 @@  static inline __noreturn __printf(1, 2) void ksft_exit_fail_msg(const char *msg,
 
 static inline __noreturn void ksft_exit_fail_perror(const char *msg)
 {
-#ifndef NOLIBC
 	ksft_exit_fail_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_exit_fail_msg("%s: %d)\n", msg, errno);
-#endif
 }
 
 static inline __noreturn void ksft_exit_xfail(void)