Skip to content

testing/ostest: Add a test of the signal mask of ppoll() and epoll_pwait(). - #4073

Merged
acassis merged 1 commit into
apache:masterfrom
casaroli:fb-epoll-pwait-signal-test-up
Nov 19, 2026
Merged

acassis merged 1 commit into
apache:masterfrom
casaroli:fb-epoll-pwait-signal-test-up

Conversation

@casaroli

@casaroli casaroli commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add pwait_test() to ostest. The thread blocks SIGUSR1 and unblocks it only in the mask of ppoll(), pselect() or epoll_pwait(). For each call there are two cases: SIGUSR1 is pending before the call, and another thread sends SIGUSR1 during the wait. The call must return EINTR after the handler ran once, and SIGUSR1 must be blocked again after the call.

The calls wait with no descriptor (an empty fd set, an empty epoll set), so the test needs no pipe and no other driver.

Impact

ostest only. The test is built with CONFIG_ENABLE_ALL_SIGNALS (it uses sigaction()) and pthreads. On a correct kernel it adds about 0.3 s to ostest.

On master, epoll_pwait() fails the test (apache/nuttx#21943 fixes it), so this PR must merge after that one. ppoll() and pselect() pass on master.

Testing

QEMU with HVF on an Apple Mac (arm64), qemu-armv8a:knsh (kernel build) and qemu-armv8a:nsh (flat build).

nuttx master, knsh:

pwait_test: ERROR: epoll_pwait, signal pending: ret -1 errno 4 handler ran 0 times
pwait_test: ERROR: epoll_pwait, signal during the wait: ret -1 errno 4 handler ran 0 times
pwait_test: ERROR: 2 checks failed

nuttx master, nsh:

pwait_test: ERROR: epoll_pwait, signal pending: ret 0 errno 4 handler ran 1 times
pwait_test: ERROR: 1 checks failed

With apache/nuttx#21943: pwait_test: PASS and ostest_main: Exiting with status 0 on knsh and nsh.

Also built in rv-virt:knsh64, rv-virt:knsh, rv-virt:nsh64, lm3s6965-ek:qemu-protected, lm3s6965-ek:qemu-kostest and lm3s6965-ek:qemu-flat.

tools/checkpatch.sh -c -u -m -g passes.

acassis
acassis previously approved these changes Nov 18, 2026
@casaroli
casaroli marked this pull request as ready for review November 18, 2026 15:00
…ait().

The thread blocks SIGUSR1 and unblocks it only in the mask of ppoll(),
pselect() or epoll_pwait().  A SIGUSR1 that is pending before the call, or
that comes during the wait, must run the handler before the call gives
EINTR.  After the call, SIGUSR1 must be blocked again.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
@casaroli
casaroli dismissed stale reviews from acassis and xiaoxiang781216 via aefb1e8 November 18, 2026 16:38
@casaroli
casaroli force-pushed the fb-epoll-pwait-signal-test-up branch from d582c4e to aefb1e8 Compare November 18, 2026 16:38
@acassis
acassis merged commit 6dce52b into apache:master Nov 19, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants