code wiki / (root) / nx_edge_daemon_test.nx

nx_edge_daemon_test.nx source

↩ module page · 40 lines · 1549 B

1// nx_edge_daemon_test.nx -- compile + link smoke for the operator- 2// runnable HTTPS daemon. Verifies the daemon's full composition 3// type-checks + links to a runnable RISC-V binary. 4// 5// Cannot test actual socket I/O in qemu-rv64 (no real network), 6// but proves the daemon's composition is type-system-valid + every 7// brick exists. Operator runs the daemon for real on the Synology. 8// 9// We also exercise nx_edge_handle_connection's INTERNAL composition 10// (TLS handshake portion) against in-memory buffers via a sibling 11// helper, bypassing the socket I/O calls. This proves the handshake 12// + serve_static integration works end-to-end. 13// 14// expect_exit: 0 15// license_tier: ORIGINAL 16 17import "nx_syscalls.nx" 18import "nx_edge_daemon.nx" 19 20func main() -> i64 { 21 // Verify symbol presence by referencing each entry point as a 22 // function-pointer value. If any is missing, link fails. 23 let p1: i64 = nx_edge_daemon_run as i64 24 let p2: i64 = nx_edge_handle_connection as i64 25 if p1 == 0 { return 10 } 26 if p2 == 0 { return 11 } 27 28 // Sealed verdict enum range checks (compile-time constants in 29 // valid range). 30 if NX_EDGE_OK != 0 { return 20 } 31 if NX_EDGE_ERR_CERT_LOAD != 1 { return 21 } 32 if NX_EDGE_ERR_PRIV_LOAD != 2 { return 22 } 33 if NX_EDGE_ERR_HTML_LOAD != 3 { return 23 } 34 if NX_EDGE_ERR_LISTEN != 4 { return 24 } 35 if NX_EDGE_ERR_ACCEPT != 5 { return 25 } 36 if NX_EDGE_ERR_HANDSHAKE != 6 { return 26 } 37 if NX_EDGE_ERR_SERVE != 7 { return 27 } 38 39 return 0 40}