Skip to content

testing/fs/epoll: Add cases for a polled or nested epoll set. - #4183

Draft
casaroli wants to merge 1 commit into
apache:masterfrom
casaroli:epoll-rearm-tests-up
Draft

casaroli wants to merge 1 commit into
apache:masterfrom
casaroli:epoll-rearm-tests-up

Conversation

@casaroli

Copy link
Copy Markdown
Contributor

depends-on: apache/nuttx#22511

Summary

The nuttx PR above keeps a reported level-triggered file watched, so that a file that epoll_wait() reported still wakes poll() of the epoll set and an epoll set that holds the set. This PR adds the test cases for it.

This PR adds the program cmocka_epoll_nest to testing/fs/epoll (the same option, CONFIG_TESTING_EPOLL). Each case has a pipe in an inner epoll set and the inner set in an outer set:

  • epoll_nest_pending, epoll_nest_later: one round of a library that gives its set to the event loop of its user (epoll_wait() with timeout 0 on its set, then read), then a byte that is already there or that comes 200 ms later must wake the outer set.
  • epoll_poll_pending: the same with poll() of the inner set.
  • epoll_nest_stream: 20 bytes 20 ms apart through the nested set, no wait of 1 s may time out.
  • epoll_poll_set, epoll_poll_wakes, epoll_nest_level, epoll_nest_three, epoll_nest_timer: poll() and epoll on an epoll descriptor (ready, still ready after a report, drained, a late byte, a set in a set in a set, a timerfd in the inner set).

The cases are in a new program, so the cases of cmocka_epoll do not change.

Impact

Test only. Make and CMake.

Testing

Host: macOS arm64 (Arm GNU 13.2.Rel1, QEMU 11.1 TCG). NuttX master 0c45a2fc48b, nuttx-apps master c621be6. Configs: qemu-armv8a:nsh (flat) and qemu-armv8a:knsh (kernel, the program runs from /system/bin) with cmocka, timerfd, local sockets and CONFIG_TESTING_EPOLL. Builds with -Werror.

  • NuttX master: 4 passed, 5 failed (epoll_nest_pending, epoll_nest_later, epoll_poll_pending, epoll_nest_stream, epoll_poll_set), flat and kernel.
  • NuttX master + the nuttx PR above: 9 passed, flat and kernel.

Builds with -Werror in the CI image (with the options above): rv-virt:nsh64 (Make and CMake) on the nuttx PR, qemu-armv8a:nsh on master. 0 warnings (rv-virt has the RWX segment linker warning of master).

tools/checkpatch.sh -c -u -m -g: pass.

Add the program cmocka_epoll_nest: a pipe in an inner epoll set, and the
inner set in an outer set.  The cases check that a level-triggered file
that epoll_wait() reported still wakes poll() of the set and an epoll
set that holds the set, as on Linux.

The cases: one round of a library that gives its set to the event loop
of its user, then a byte that is already there or that comes later; a
stream of 20 bytes; poll() of the set; a set in a set in a set; a
timerfd in the inner set.  A writer thread gives the late bytes.

The cases are in a new program, so the cases of cmocka_epoll do not
change.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
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.

2 participants