Skip to content

testing/nettest: Add a test of radio sockets with no device - #4016

Merged
acassis merged 1 commit into
apache:masterfrom
casaroli:apps-bt-recvmsg-test-up
Nov 11, 2026
Merged

acassis merged 1 commit into
apache:masterfrom
casaroli:apps-bt-recvmsg-test-up

Conversation

@casaroli

@casaroli casaroli commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

New cmocka group cmocka_net_radio in testing/nettest. It calls recvfrom() three times on each of these sockets: a Bluetooth L2CAP socket that is not bound, a Bluetooth HCI socket bound to a device index that no device has, and an IEEE 802.15.4 socket that is not bound. No radio device matches these sockets, so each call must fail with ENODEV, and close() must work after them.

Before apache/nuttx#21650, the first call unlocked a socket lock that it did not take. With CONFIG_DEBUG_ASSERTIONS, the program then fails an assertion in nxrmutex_unlock().

Impact

New test only. TESTING_NET_RADIO is on by default when NET_BLUETOOTH or NET_IEEE802154 is set, as the other nettest groups. Make and CMake.

Testing

CONFIG_DEBUG_ASSERTIONS=y, CONFIG_TESTING_NET_TEST=y, Linux host.

cmocka_net_radio calls recvfrom() three times on each of these sockets:
a Bluetooth L2CAP socket that is not bound, a Bluetooth HCI socket bound
to a device index that no device has, and an IEEE 802.15.4 socket that
is not bound.  No radio device matches these sockets, so each call must
fail with ENODEV, and close() must work after them.

Before the kernel fix, the first call unlocked a socket lock that it did
not take.  With CONFIG_DEBUG_ASSERTIONS, the program then fails an
assertion in nxrmutex_unlock().

The test is on by default when NET_BLUETOOTH or NET_IEEE802154 is set,
as the other nettest groups.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
@xiaoxiang781216
xiaoxiang781216 marked this pull request as ready for review November 11, 2026 01:44
@github-actions

Copy link
Copy Markdown

🔗 Cross-repo PR dependencies

The read-only Build run reported the following dependent PR(s) and fetched head SHA(s):

CI run: https://github.com/apache/nuttx-apps/actions/runs/42941183391

@acassis
acassis merged commit eb2dd99 into apache:master Nov 11, 2026
70 of 88 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