casaroli opened a new pull request, #3964:
URL: https://github.com/apache/nuttx-apps/pull/3964

   ## Summary
   
   No test in nuttx-apps covers `connect()` and `poll()` of Unix domain 
datagram sockets. This PR adds the cmocka test `cmocka_net_local_dgram` to 
`testing/nettest/local` (`CONFIG_TESTING_NET_LOCAL_DGRAM`), next to 
`cmocka_net_local`.
   
   The 20 cases: `connect()` to a bound socket; `getpeername()`; `send()`, 
`write()` and `sendto()` with a NULL address go to the peer; `poll(POLLIN)` 
with no datagram, after a send and while a thread sends after 200 ms; no 
`POLLHUP` when a datagram is too large; `poll(POLLOUT)`; `select()`; 
`recv(MSG_DONTWAIT)` and `O_NONBLOCK` on an empty socket (`EAGAIN`); a 
connected socket takes datagrams from its peer only; `connect(AF_UNSPEC)` 
removes the peer; a second `connect()` changes it; `ENOENT` for a missing name; 
`ECONNREFUSED` for a regular file and after the receiver is closed; an abstract 
name.
   
   Each case makes its own sockets in its setup, so a failed case does not 
change the next one. A watchdog (`alarm()`, 10 s) stops the program when a case 
does not end. The optional argument is a writable directory for the socket 
names (default `P_tmpdir`).
   
   depends-on: apache/nuttx/pull/21416
   
   ## Impact
   
   New test only, `default n`. It depends on `NET_LOCAL && NET_LOCAL_DGRAM`, 
`!DISABLE_PTHREAD` and `!DISABLE_POSIX_TIMERS`. No defconfig enables it, so no 
CI build changes. No change to the other nettest programs. The nettest page in 
Documentation/applications/testing describes the programs in general; no change.
   
   ## Testing
   
   QEMU qemu-armv8a with HVF, 1 CPU, with `NET`, `NET_LOCAL`, 
`NET_LOCAL_STREAM`, `NET_LOCAL_DGRAM`, `PIPES`, `NETDEV_LATEINIT`, 
`NET_SOCKOPTS`, the cmocka options and `CONFIG_TESTING_NET_LOCAL_DGRAM=y`. knsh 
runs the test as an ELF in `/system/bin` (names in `/system`), nsh (flat) as a 
builtin (names in `/tmp`):
   
   | | nuttx master 6569424cfa6 | apache/nuttx#21416 |
   |---|---|---|
   | `cmocka_net_local_dgram` on knsh (kernel) | 2 PASS (`dontwait`, 
`nonblock`), 6 FAIL, 12 setup errors: `connect()` fails with `ENOSYS` | 20/20 
PASS |
   | `cmocka_net_local_dgram` on nsh (flat) | 2 PASS (`dontwait`, `nonblock`), 
6 FAIL, 12 setup errors: `connect()` fails with `ENOSYS` | 20/20 PASS |
   | ostest on knsh and nsh | status 0 | status 0 |
   
   mps2-an500:knsh (protected build, Cortex-M7, QEMU TCG, names in a tmpfs on 
`/tmp`) on apache/nuttx#21416: 20/20 PASS, ostest status 0.
   
   Builds with `CONFIG_TESTING_NET_LOCAL_DGRAM=y` and `EXTRAFLAGS="-Wno-cpp 
-Werror"` on apache/nuttx#21416, each OK, no warning in the test: 
qemu-armv8a:nsh (make and CMake), rv-virt:nsh64, mps2-an500:knsh (protected). 
qemu-armv8a:nsh with `CONFIG_NET_LOCAL_DGRAM` off: the option is off and 
nothing of the test is built. On master the test also builds and runs; only the 
cases fail.
   
   `tools/checkpatch.sh -c -u -m -g` passes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to