Skip to content

testing/nettest: Test getsockname() of a CAN_RAW socket with a short buffer. - #4176

Draft
casaroli wants to merge 1 commit into
apache:masterfrom
casaroli:net-sockname-short-other-up
Draft

casaroli wants to merge 1 commit into
apache:masterfrom
casaroli:net-sockname-short-other-up

Conversation

@casaroli

Copy link
Copy Markdown
Contributor

depends-on: apache/nuttx#22470

Summary

New case test_can_name_short in cmocka_net_can. getsockname() of a bound CAN_RAW socket writes its address into a buffer of 2 bytes. The call must succeed, the buffer gets the first 2 bytes of the address, the bytes after it do not change, and *addrlen gives the length of the whole address, as on Linux.

Impact

Test only. The case fails with EINVAL until apache/nuttx#22470 merges.

Testing

qemu-armv8a:nsh (flat) with CAN and loopback, CI image, QEMU TCG: the case FAILED (EINVAL) on nuttx master, PASSED with apache/nuttx#22470; the other cases of cmocka_net_can pass on both. Builds with -Werror: qemu-armv8a:nsh, qemu-armv8a:knsh and rv-virt:knetnsh64 (kernel, make import), rv-virt:netnsh64.

…buffer.

Add test_can_name_short to cmocka_net_can.  getsockname() of a bound
CAN_RAW socket writes its address into a buffer of 2 bytes.  The call
must succeed, the buffer gets the first 2 bytes of the address, the
bytes after it do not change, and *addrlen gives the length of the whole
address.

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.

1 participant