mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] selftests/nolibc: drop readdir_r() override
@ 2026-11-02  3:27 Thomas Weißschuh
  2026-11-02  8:05 ` Willy Tarreau
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Weißschuh @ 2026-11-02  3:27 UTC (permalink / raw)
  To: Willy Tarreau; +Cc: linux-kernel, Thomas Weißschuh

Running the testcases using readdir_r() on regular libcs is useful to
detect mismatching behavior of nolibc. The deprecation warnings can be
avoided with a compiler pragma instead.

Drop the override and enable the testcases relying on the function for
regular libcs.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 tools/testing/selftests/nolibc/nolibc-test.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
index 048c2d2850a9..1157b521e65b 100644
--- a/tools/testing/selftests/nolibc/nolibc-test.c
+++ b/tools/testing/selftests/nolibc/nolibc-test.c
@@ -50,6 +50,7 @@
 #include <alloca.h>
 
 #pragma GCC diagnostic ignored "-Wmissing-prototypes"
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 
 #include "nolibc-test-linkage.h"
 
@@ -99,10 +100,6 @@ static const int is_glibc =
 #define strlcat(d, s, l) 0
 #define strlcpy(d, s, l) 0
 
-/* readdir_r() is likely to be marked deprecated */
-#undef readdir_r
-#define readdir_r(dir, dirent, result) ((errno = EINVAL), -1)
-
 #define _syscall(...) 0
 #endif
 
@@ -1802,8 +1799,8 @@ int run_syscall(int min, int max)
 		CASE_TEST(ftruncate);         EXPECT_SYSZR(1, test_ftruncate()); break;
 		CASE_TEST(getdents64_root);   EXPECT_SYSNE(1, test_getdents64("/"), -1); break;
 		CASE_TEST(getdents64_null);   EXPECT_SYSER(1, test_getdents64("/dev/null"), -1, ENOTDIR); break;
-		CASE_TEST(directories);       EXPECT_SYSZR(is_nolibc && proc, test_dirent()); break;
-		CASE_TEST(dirfd);             EXPECT_SYSZR(is_nolibc && has_working_64bit_syscall_arg, test_dirfd()); break;
+		CASE_TEST(directories);       EXPECT_SYSZR(proc, test_dirent()); break;
+		CASE_TEST(dirfd);             EXPECT_SYSZR(has_working_64bit_syscall_arg, test_dirfd()); break;
 		CASE_TEST(getrandom);         EXPECT_SYSZR(1, test_getrandom()); break;
 		CASE_TEST(gettimeofday_tv);   EXPECT_SYSZR(1, gettimeofday(&tv, NULL)); break;
 		CASE_TEST(gettimeofday_tv_tz);EXPECT_SYSZR(1, gettimeofday(&tv, &tz)); break;

---
base-commit: 228a318052869ab08f01f53b5cedfae0e930f6dd
change-id: 20261102-nolibc-selftests-readdir_r-1dab2edffb12

Best regards,
--  
Thomas Weißschuh <linux@weissschuh.net>


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] selftests/nolibc: drop readdir_r() override
  2026-11-02  3:27 [PATCH] selftests/nolibc: drop readdir_r() override Thomas Weißschuh
@ 2026-11-02  8:05 ` Willy Tarreau
  0 siblings, 0 replies; 2+ messages in thread
From: Willy Tarreau @ 2026-11-02  8:05 UTC (permalink / raw)
  To: Thomas Weißschuh; +Cc: linux-kernel

On Mon, Nov 02, 2026 at 03:27:35AM +0000, Thomas Weißschuh wrote:
> Running the testcases using readdir_r() on regular libcs is useful to
> detect mismatching behavior of nolibc. The deprecation warnings can be
> avoided with a compiler pragma instead.
> 
> Drop the override and enable the testcases relying on the function for
> regular libcs.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
>  tools/testing/selftests/nolibc/nolibc-test.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
> index 048c2d2850a9..1157b521e65b 100644
> --- a/tools/testing/selftests/nolibc/nolibc-test.c
> +++ b/tools/testing/selftests/nolibc/nolibc-test.c
> @@ -50,6 +50,7 @@
>  #include <alloca.h>
>  
>  #pragma GCC diagnostic ignored "-Wmissing-prototypes"
> +#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
>  
>  #include "nolibc-test-linkage.h"
>  
> @@ -99,10 +100,6 @@ static const int is_glibc =
>  #define strlcat(d, s, l) 0
>  #define strlcpy(d, s, l) 0
>  
> -/* readdir_r() is likely to be marked deprecated */
> -#undef readdir_r
> -#define readdir_r(dir, dirent, result) ((errno = EINVAL), -1)
> -
>  #define _syscall(...) 0
>  #endif
>  
> @@ -1802,8 +1799,8 @@ int run_syscall(int min, int max)
>  		CASE_TEST(ftruncate);         EXPECT_SYSZR(1, test_ftruncate()); break;
>  		CASE_TEST(getdents64_root);   EXPECT_SYSNE(1, test_getdents64("/"), -1); break;
>  		CASE_TEST(getdents64_null);   EXPECT_SYSER(1, test_getdents64("/dev/null"), -1, ENOTDIR); break;
> -		CASE_TEST(directories);       EXPECT_SYSZR(is_nolibc && proc, test_dirent()); break;
> -		CASE_TEST(dirfd);             EXPECT_SYSZR(is_nolibc && has_working_64bit_syscall_arg, test_dirfd()); break;
> +		CASE_TEST(directories);       EXPECT_SYSZR(proc, test_dirent()); break;
> +		CASE_TEST(dirfd);             EXPECT_SYSZR(has_working_64bit_syscall_arg, test_dirfd()); break;
>  		CASE_TEST(getrandom);         EXPECT_SYSZR(1, test_getrandom()); break;
>  		CASE_TEST(gettimeofday_tv);   EXPECT_SYSZR(1, gettimeofday(&tv, NULL)); break;
>  		CASE_TEST(gettimeofday_tv_tz);EXPECT_SYSZR(1, gettimeofday(&tv, &tz)); break;
> 
> ---
> base-commit: 228a318052869ab08f01f53b5cedfae0e930f6dd
> change-id: 20261102-nolibc-selftests-readdir_r-1dab2edffb12

Oh nice, I wasn't aware this one was possible. Nice to learn something
in the morning ;-)

Reviewed-by: Willy Tarreau <w@1wt.eu>

thanks,
Willy

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-02  8:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-02  3:27 [PATCH] selftests/nolibc: drop readdir_r() override Thomas Weißschuh
2026-11-02  8:05 ` Willy Tarreau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®