[PATCH] selftests/nolibc: drop readdir_r() override

From: Thomas Weißschuh

Date: Mon Nov 02 2026 - 00:59:24 EST


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@xxxxxxxxxxxxxx>
---
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@xxxxxxxxxxxxxx>