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

   depends-on: apache/nuttx/pull/21656
   
   ## Summary
   
   No test in nuttx-apps checks `inet_pton()`. This PR adds 
`testing/libc/inetpton`. It converts the text forms of RFC 4291 section 2.2 
with `inet_pton(AF_INET6)` and compares the bytes: the full form, `"::"` at the 
start, in the middle and at the end, and the IPv4 dotted-decimal form at the 
end (`"::ffff:127.0.0.1"`, `"::1.2.3.4"`, `"1:2:3:4:5:6:1.2.3.4"`, 
`"64:ff9b::192.0.2.33"`). It also checks that `inet_pton()` returns 0 for 
strings that are not IPv6 addresses: a wrong field count, two `"::"`, a single 
`':'` at the start or the end, a field of five digits, and a wrong IPv4 part.
   
   The program prints PASS or FAIL for each of the 48 cases and returns the 
number of errors.
   
   ## Impact
   
   Test only. The new option `TESTING_INETPTON` is off by default, as the other 
tests in testing/libc, and depends on `NET_IPv6 || LIBC_IPv6_ADDRCONV`. No 
defconfig sets it, so CI does not build or run it.
   
   ## Testing
   
   Host check: the test passes 48 of 48 against glibc 2.43 (Fedora) and the 
macOS libc.
   
   `inetpton`, nuttx master 80a052ff9cc vs master + apache/nuttx#21656, apps 
master ee3d67104 + this PR, `CONFIG_LIBC_IPv6_ADDRCONV=y`, 
`EXTRAFLAGS="-Wno-cpp -Werror"`:
   
   | Configuration | nuttx master | with apache/nuttx#21656 | ostest |
   |---|---|---|---|
   | qemu-armv8a:knsh (kernel, arm64, QEMU HVF), make | 19 errors | 0 errors | 
status 0 (both) |
   | qemu-armv8a:nsh (flat, arm64, QEMU HVF), make | 19 errors | 0 errors | 
status 0 (both) |
   | qemu-armv8a:nsh (flat), CMake | not run | 0 errors | status 0 |
   | mps2-an500:nsh (flat, Cortex-M7, 32-bit, QEMU TCG), make | 19 errors | 0 
errors | not used (stops at perf_gettime.c:132 in both, QEMU has no DWT) |
   
   On master 19 cases fail: the 6 addresses with an IPv4 part return 0, and 13 
strings that are not addresses return 1 (for example `"1:2:3"`, `"1::2::3"`, 
`":::"`). The builds have no warnings. `tools/checkpatch.sh -c -u -m -g 
origin/master..HEAD` passes.
   
   Not run: a protected build, SMP, other architectures.
   


-- 
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