. "$BST_LIB" # BST-TIMEOUT: 600 # one exec of a 49 MB static binary plus 139 CUnit cases # libcoap 4.3.4 (SRCREV 5fd2f89e, meta-networking recipes-devtools/libcoap) -- a # C implementation of the Constrained Application Protocol (RFC 7252), ported # here as a static library plus its own upstream CUnit suite, which OpenEmbedded # packages as a ptest. # # THE ORACLE IS A NATIVE x86_64 CONTROL of the identical SRCREV, built with the # identical configure options and driven through the identical run-ptest. It # reported 167 tests / 1238 asserts / 0 failures across 16 CUnit suites. Every # expectation below was read off that run; where the target differs, the case # says why and names the issue that holds it. # # THIS IS A LIBRARY-ONLY PORT: ${PN} and libcoap-bin are both absent from the # image, for two different reasons, and neither is an oversight. # ${PN} is empty because the distro is static-only, so no libcoap-3.so is built # and FILES:${PN} matches nothing -- the same shape as nanopb-runtime, # libexecinfo and lockdev. # libcoap-bin is DISABLED at configure (--disable-examples). coap-client, # coap-server and coap-rd each need a CoAP peer; there is no route off lo on a # browser machine, and standing one up locally would mean backgrounding # coap-server, i.e. fork(), which traps with SIGILL and leaks a coroutine park # slot on this arm (brintos/hardwarejs#17). The bbappend carries the link-cost # measurement that made the decision. # # WHY THIS PORT DOES NOT USE epoll. meta-networking configures libcoap # --with-epoll, and libcoap's configure decides epoll is available by PROBING FOR # TWO HEADERS (sys/epoll.h, sys/timerfd.h). Both exist in this glibc, but the # wasm32 syscall table has no epoll entry and the whole family is ENOSYS # (brintos/linux#53), so a --with-epoll libcoap fails inside coap_new_context() # and nothing works. The port configures --without-epoll; poll [7], select [23] # and pselect6 [270] are all wired, so the select()-based I/O loop is fully # supported. ptestdir=/usr/lib/libcoap/ptest # --------------------------------------------------------------- packaging --- # `test` is an ash builtin and forks nothing; on an arm where every exec is a # fresh wasm module instantiation, the presence half of this file is free. check_rc libcoap/lib-static 0 test -f /usr/lib/libcoap-3.a check_rc libcoap/header 0 test -f /usr/include/coap3/coap.h check_rc libcoap/header-net 0 test -f /usr/include/coap3/coap_net.h check_rc libcoap/pkgconfig 0 test -f /usr/lib/pkgconfig/libcoap-3.pc check_rc libcoap/ptest-runptest 0 test -x "$ptestdir/run-ptest" check_rc libcoap/ptest-driver 0 test -x "$ptestdir/testdriver" # No libcoap-3.so on a distro that configures --disable-shared image-wide; one # appearing here would mean the static-only rule had silently stopped holding. if [ -e /usr/lib/libcoap-3.so ] || [ -e /usr/lib/libcoap-3.so.3 ]; then bst_notok libcoap/static-only "a shared libcoap shipped on a --disable-shared distro" else bst_ok libcoap/static-only fi # The DTLS-flavoured archive is what testdriver links, and its presence # distinguishes a build that kept OpenSSL from one that silently fell back to # --disable-dtls. libcoap-3.a is a symlink to it; both are asserted. check_rc libcoap/lib-dtls 0 test -f /usr/lib/libcoap-3-openssl.a # ------------------------------------------ upstream's own suite, the gate --- # What the ticket closes on: libcoap's own CUnit suite, run on target under # ptest-runner (BRINTOS-395 put the harness on the image). # # -t is set high deliberately: relative timers do not fire on this arm # (brintos/linux#48), so ptest-runner's own timeout bounds nothing and a tight # value would be an assertion about nothing. # # The run-ptest this drives is THIS PORT'S, not meta-networking's. Upstream's is # `if testdriver; then echo PASS`, and testdriver returns CUnit's CU_ErrorCode, # which stays CUE_SUCCESS through any number of failed cases -- measured on the # native control, where one injected CU_FAIL still produced "PASS: libcoap" and # exit 0. Ours reads the Run Summary and emits one PASS:/FAIL: line per case. if [ ! -x /usr/bin/ptest-runner ]; then bst_notok libcoap/ptest-cases "no ptest-runner on the image -- the acceptance gate cannot run" bst_notok libcoap/ptest-complete "no ptest-runner on the image" bst_skip libcoap/ptest-ipv6-suites "no ptest-runner on the image" exit 0 fi out=$(/usr/bin/ptest-runner -t 20000 libcoap 2>&1) npass=$(printf '%s\n' "$out" | grep -c '^PASS: ') nfail=$(printf '%s\n' "$out" | grep -c '^FAIL: ') # ---- what DOES run here, and is the port's positive evidence ----------------- # 139 cases across 12 CUnit suites: the URI parser, both byte-value codecs, all # five option suites, both PDU suites, the error-response generator and the first # eight sendqueue cases. That is upstream's own coverage of libcoap's parsing and # encoding core, running on this arm. 130 is a FLOOR, not a pin -- pinning 139 # exactly would go false the day upstream adds a case. if [ "$npass" -ge 130 ]; then bst_ok libcoap/ptest-cases else bst_notok libcoap/ptest-cases "only $npass cases passed; expected >= 130 (native control: 167)" fi # Name the load-bearing suites individually, so a whole CUnit suite disappearing # is visible as itself rather than as a slightly smaller total. for s in uri-parser option-parser option-encoder pdu-parser pdu-encoder \ byte-value-decoder byte-value-encoder error-response-generator; do if printf '%s\n' "$out" | grep -q "^PASS: libcoap\.${s}\."; then bst_ok "libcoap/suite-$s" else bst_notok "libcoap/suite-$s" "no passing case from CUnit suite '$s'" fi done # ---- what CANNOT run here, and why ------------------------------------------ # BRINTOS-WORKAROUND: brintos/linux#54 remove -- this kernel is built # `# CONFIG_IPV6 is not set`, so socket(AF_INET6, ...) is EAFNOSUPPORT (measured # directly with a package-free probe: AF_INET and AF_UNIX succeed, both AF_INET6 # forms fail with errno 97). Every libcoap suite that creates a session hardcodes # AF_INET6 / in6addr_loopback with NO COAP_IPV6_SUPPORT guard -- `grep # COAP_IPV6_SUPPORT tests/*.c` matches nothing -- so building the library # --disable-ipv6-support would not avoid it either. A skip, not a red: the port is # not broken, the kernel simply has no IPv6 for these cases to use. When #54 # closes, this becomes a verdict. bst_skip libcoap/ptest-ipv6-suites \ "session suite init fails and sendqueue9/10 with it: socket(AF_INET6) EAFNOSUPPORT, kernel has CONFIG_IPV6 unset (brintos/linux#54)" # BRINTOS-WORKAROUND: brintos/linux#54 remove -- and the same cause takes the rest # of the run with it. After the failed session creation, upstream's suite setup # carries on with a NULL session (t_wkc_tests_create calls # coap_new_client_session() and never checks the result), and the driver dies with # `Illegal instruction`, exit 132 -- so .well-known/core, TLS and the RFC 8613 # OSCORE suites never execute. This one IS a red: a crash is a crash, and it is # what a fix for #54 has to make go away. The truncation is detected from the # inside too -- the shipped run-ptest fails the missing Run Summary block rather # than reporting a clean green over a partial run. if [ "$nfail" -eq 0 ] && printf '%s\n' "$out" | grep -q '^PASS: libcoap\.RFC8613'; then bst_ok libcoap/ptest-complete else bst_notok libcoap/ptest-complete \ "run truncated after sendqueue (exit 132, Illegal instruction); wellknown/TLS/OSCORE unreached -- brintos/linux#54, pass=$npass fail=$nfail" fi