nx_tls13_read_record_from_fd_loopback_test.nx
buildroot/runtime/nx_tls13_read_record_from_fd_loopback_test.nx
about
nx_tls13_read_record_from_fd_loopback_test.nx -- REAL happy-
path KAT for nx_tls13_read_record_from_fd over real TCP loopback.
The existing nx_tls13_read_record_from_fd_test.nx preamble
explicitly documents that sys_pipe2 is unreliable in qemu so
the original test only exercises bounds-check + read-failure
paths. That left the primitive's HAPPY PATH (read a real
5-byte TLS record header + body from a real bidirectional
socket) UNVERIFIED.
This file closes that gap using the same fork+child socket
loopback pattern as nx_https_loopback_test (which has been
verified to work in qemu-riscv64-static), exercising ONLY the
record-reader primitive in isolation.
Test shape:
1. parent: socket + bind + listen on loopback port
2. fork
3. child: socket + connect; build a real TLS record bytes
(type=22 handshake, version 0x0303, payload "ABCDE");
sys_write the 10-byte record + close.
4. parent: accept; call nx_tls13_read_record_from_fd(accepted_fd,
out_buf, out_cap); verify
(a) return value == 10 (5 header + 5 payload)
(b) header bytes are correct (0x16 0x03 0x03 0x00 0x05)
(c) payload bytes are "ABCDE"
5. parent waits for child + returns child's exit code OR a
verdict-specific code if anything mismatched
expect_exit: 0
license_tier: ORIGINAL
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_connect.nxnx_tls13.nxnx_tls13_read_record_from_fd.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 38 | const TEST_PORT: i64 = 19453 |
functions
| 40 | func build_addr(out: *u8, port: i64) -> i64 called by 1: main |
| 53 | func child_send_record(addr: *u8) -> i64 |
| 78 | func parent_read_and_verify(lfd: i64) -> i64 |
| 104 | func main() -> i64 |