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

   depends-on: apache/nuttx/pull/21688
   
   ## Summary
   
   No test in nuttx-apps checks `inet_ntop()`. This PR adds 
`testing/libc/inetntop`. It converts 25 IPv6 addresses with 
`inet_ntop(AF_INET6)` and compares the text with the recommended form of RFC 
5952:
   
   - `::` only for the longest run of two or more 0 fields, the first one on a 
tie (`1::2:0:0:3:4`, `1:0:0:2::3`), and no `::` for one 0 field 
(`1:0:2:3:4:5:6:7`, `2001:db8:0:1:1:1:1:1`).
   - lowercase hexadecimal.
   - the dotted-decimal IPv4 form for an IPv4-mapped address 
(`::ffff:127.0.0.1`, `::ffff:0.0.0.0`) and an IPv4-compatible address 
(`::1.2.3.4`), but not for `::`, `::1`, `::102`, `::fffe:102:304`, 
`1::ffff:102:304` or `64:ff9b::c000:221`.
   
   Each case, and 4 `AF_INET` cases, also checks the size of the buffer: the 
call succeeds with `strlen() + 1` bytes and fails with ENOSPC with `strlen()` 
bytes.
   
   The program prints PASS or FAIL for each case and returns the number of 
errors. It needs IPv4 and IPv6 address conversions (`NET_IPv4`/`NET_IPv6` or 
`LIBC_IPv4_ADDRCONV`/`LIBC_IPv6_ADDRCONV`).
   
   ## Impact
   
   New test only, `default n` like the other tests in testing/libc. No change 
to other code.
   
   ## Testing
   
   The expected texts are the glibc 2.43 results: the same source built on 
fedora x86_64 against glibc passes all 29 cases.
   
   `EXTRAFLAGS="-Wno-cpp -Werror"`, nuttx master 03aea786390 vs the nuttx PR, 
with `LIBC_IPv4_ADDRCONV`, `LIBC_IPv6_ADDRCONV` and `TESTING_INETNTOP`:
   
   | Configuration | nuttx master | nuttx PR |
   |---|---|---|
   | qemu-armv8a:knsh (kernel, arm64, QEMU HVF; the test is an ELF program in 
/system/bin) | 37 errors | 0 errors |
   | qemu-armv8a:nsh (flat, arm64, QEMU HVF) | 37 errors | 0 errors |
   | qemu-armv8a:nsh, CMake | not run | 0 errors |
   
   On master the 37 errors are 28 ENOSPC with a buffer that fits and 9 wrong 
texts. ostest: status 0 in all runs. No warnings. `tools/checkpatch.sh -c -u -m 
-g origin/master..HEAD` 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