Skip to content

testing/ostest: Add a test of close() during poll(). - #3980

Merged
acassis merged 1 commit into
apache:masterfrom
casaroli:apps-poll-close-test-up
Nov 6, 2026
Merged

acassis merged 1 commit into
apache:masterfrom
casaroli:apps-poll-close-test-up

Conversation

@casaroli

@casaroli casaroli commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A test of close() during poll() for apache/nuttx#21490. poll_close_test() in ostest: another thread closes the read end of a pipe while the main thread is in poll() on it. When poll() ends the read end must be gone, so the write end reports POLLERR, and no driver may keep a pointer to the entry of that poll().

Impact

A new file in ostest and the option CONFIG_TESTING_OSTEST_POLL_CLOSE. It depends on PIPES and on pthreads, and it is on unless DEFAULT_SMALL is set. No change to any other code.

This test fails on NuttX master until apache/nuttx#21490 merges, so this PR must merge after it.

Testing

ostest under QEMU:

Config NuttX master 6e1126a2362 apache/nuttx#21490
qemu-armv8a:knsh (kernel) ERROR: no POLLERR, then kernel panic PASS, status 0
qemu-armv8a:nsh (flat) ERROR: no POLLERR, status 256 PASS, status 0
rv-virt:knsh64 (kernel) not run PASS, status 0
mps2-an500:knsh (protected) not run PASS, status 0

Make builds only; CMake was not built. tools/checkpatch.sh -c -u -m -g passes.

Another thread closes the read end of a pipe while the main thread is in
poll() on it.  When poll() ends the read end must be gone, so the write
end reports POLLERR, and no driver may keep a pointer to the entry of
that poll().

Option TESTING_OSTEST_POLL_CLOSE selects the test.  It is on unless
DEFAULT_SMALL is set.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <[email protected]>
@casaroli
casaroli marked this pull request as ready for review November 6, 2026 07:45
@acassis
acassis merged commit 114f7c7 into apache:master Nov 6, 2026
51 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