From: Karel Zak Date: Tue, 16 Jun 2026 07:24:40 +0000 (+0200) Subject: tests: handle ENOSYS in multiplexing syscall tests X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5370abcc8d4a1c0f2d5a5fd1db0aee51f81fd6c0;p=thirdparty%2Futil-linux.git tests: handle ENOSYS in multiplexing syscall tests On ppc64le, __NR_select is defined at compile time, so test_mkfds -W lists "select" as available. However, the kernel returns ENOSYS at runtime. The helper process prints its PID, then calls select() which fails immediately with ENOSYS. This creates a race where the bash script's kill -0 liveness check can succeed while the process is still dying, causing lsfd to run against a dead process and produce wrong output. Exit with EXIT_ENOSYS (23) instead of EXIT_FAILURE when the multiplexer syscall returns ENOSYS. This applies to both DEFUN_WAIT_EVENT_SELECT and DEFUN_WAIT_EVENT_POLL macros. In the bash test, check the wait exit code for 23 after the coproc finishes and skip the subtest cleanly. Signed-off-by: Karel Zak --- diff --git a/tests/helpers/test_mkfds.c b/tests/helpers/test_mkfds.c index 746174e80..302c3d33c 100644 --- a/tests/helpers/test_mkfds.c +++ b/tests/helpers/test_mkfds.c @@ -78,7 +78,7 @@ #define EXIT_EPROTONOSUPPORT 20 #define EXIT_EACCES 21 #define EXIT_ENOENT 22 -#define EXIT_ENOSYS 23 +/* EXIT_ENOSYS also defined in test_mkfds.h */ #define EXIT_EADDRNOTAVAIL 24 #define EXIT_ENODEV 25 @@ -4551,8 +4551,11 @@ static void sighandler_nop(int si _U_) SETUP_SIG_HANDLER \ \ if (SYSCALL_INVOCATION < 0 \ - && errno != EINTR) \ + && errno != EINTR) { \ + if (errno == ENOSYS) \ + errx(EXIT_ENOSYS, "no syscall: " SYSCALL); \ err(EXIT_FAILURE, "failed in " SYSCALL); \ + } \ } DEFUN_WAIT_EVENT_SELECT(default, diff --git a/tests/helpers/test_mkfds.h b/tests/helpers/test_mkfds.h index 1002ee19d..e7a1f06e5 100644 --- a/tests/helpers/test_mkfds.h +++ b/tests/helpers/test_mkfds.h @@ -23,6 +23,8 @@ #include #include +#define EXIT_ENOSYS 23 + enum multiplexing_mode { MX_READ = 1 << 0, MX_WRITE = 1 << 1, @@ -72,8 +74,11 @@ struct fdesc { SETUP_SIG_HANDLER \ \ if (SYSCALL_INVOCATION < 0 \ - && errno != EINTR) \ + && errno != EINTR) { \ + if (errno == ENOSYS) \ + errx(EXIT_ENOSYS, "no syscall: " SYSCALL); \ err(EXIT_FAILURE, "failed in " SYSCALL); \ + } \ free(pfds); \ } diff --git a/tests/ts/lsfd/mkfds-multiplexing b/tests/ts/lsfd/mkfds-multiplexing index fdb175f8a..79f4d5530 100755 --- a/tests/ts/lsfd/mkfds-multiplexing +++ b/tests/ts/lsfd/mkfds-multiplexing @@ -89,6 +89,9 @@ for multiplexer in pselect6 select poll ppoll; do fi wait "$MKFDS_CPID" + if [ $? -eq 23 ]; then + ts_skip "the $multiplexer syscall is not available (ENOSYS)" + fi ts_finalize_subtest done