Skip to content

testing/nettest: Test sends of local sockets that wait for space, in many parts and as whole datagrams - #4038

Merged
acassis merged 2 commits into
apache:masterfrom
casaroli:apps-net-local-send-frame-test-up
Nov 17, 2026
Merged

acassis merged 2 commits into
apache:masterfrom
casaroli:apps-net-local-send-frame-test-up

Conversation

@casaroli

@casaroli casaroli commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Tests for apache/nuttx#21767 (send_iov) and apache/nuttx#21768 (the other cases): datagrams of local sockets as one frame, a signal during a send. Two commits:

  • testing/nettest: Test sends of local sockets that wait for space. 5 cases in cmocka_net_local_dgram: poll_full, poll_fullwait (a non-blocking send to a full bound socket fails with EAGAIN and leaves no part of a datagram; a blocking send ends when the receiver reads), send_intr, pair_intr, stream_send_intr (a signal ends a send() that waits for space in a full bound datagram socket, a full datagram socket pair and a full stream socket, with EINTR; the send waits in a second thread, which gets the signal).
  • testing/nettest: Test datagrams in many parts and whole datagrams. 3 cases: pair_iov, send_iov (sendmsg() of one datagram in 12 parts, two of them empty, on a datagram socket pair and to a bound socket), pair_whole (a reader with O_NONBLOCK reads a full datagram socket pair with no pause while a send waits for space in another thread: it must get each datagram whole, never the start of a datagram without the rest).

Impact

New tests only, in the existing CONFIG_TESTING_NET_LOCAL_DGRAM. No defconfig enables TESTING_NET_TEST, so no CI build changes. No documentation change.

Testing

qemu-armv8a (arm64, HVF, 1 CPU), make, each case alone (cmocka_net_local_dgram <dir> <case>). knsh: kernel build; nsh: flat build. Options as in #4003.

Configuration nuttx #21614 (5eb6d40e7f8) with apache/nuttx#21768 (it contains #21767)
knsh, cmocka_net_local_dgram 87 of 91 PASS; pair_intr, stream_send_intr, send_iov, pair_whole FAIL 91 PASS
nsh, cmocka_net_local_dgram the same 91 PASS

poll_full, poll_fullwait and send_intr pass on #21614 too: master sends a datagram to a bound socket as one atomic frame since 6b50d0c8de4. pair_iov passes on #21614 too.

On Linux 7.0 (arm64 container, host libc, the cmocka of apps): the 8 new cases PASS.

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

Not run: CMake builds, sim, other arches.

@xiaoxiang781216

Copy link
Copy Markdown
Contributor

@casaroli please fix the conflict

Add cases to cmocka_net_local_dgram:

- poll_full, poll_fullwait: a non-blocking send to a full bound socket
  fails with EAGAIN and leaves no part of a datagram; a blocking send
  ends when the receiver reads.
- send_intr, pair_intr, stream_send_intr: a signal ends a send() that
  waits for space in a full bound datagram socket, a full datagram socket
  pair and a full stream socket, with EINTR.  The send waits in a second
  thread, which gets the signal: in a flat build the handler runs on the
  stack of that thread, which has no cmocka frames.

All the new cases pass on Linux.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
Add cases to cmocka_net_local_dgram:

- pair_iov, send_iov: sendmsg() of one datagram in 12 parts, two of them
  empty, on a datagram socket pair and to a bound socket.
- pair_whole: a reader with O_NONBLOCK reads a full datagram socket pair
  with no pause, while a send waits for space in another thread.  The
  reader must get each datagram whole, never the start of a datagram
  without the rest.

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

Copy link
Copy Markdown
Contributor Author

Done.

@github-actions github-actions Bot added Size: M and removed Size: XL labels Nov 14, 2026
@casaroli
casaroli marked this pull request as ready for review November 16, 2026 15:28
@acassis
acassis merged commit 2b300c2 into apache:master Nov 17, 2026
127 of 162 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.

4 participants