# 79-libnftnl.test -- libnftnl 1.2.6, the low-level nftables Netlink library. # # libnftnl ships no program of its own, so the only coverage that means anything is # upstream's own tests/ tree -- the same 32 programs ptest-runner drives. Each one # builds an nftables netlink message from a struct, parses the buffer back into a # second struct, and compares it field by field, printing OK only when every field # survived the round trip. They open no socket and read no /proc, so none of this # needs nftables kernel support; what is under test is the serialisation and parsing # code, which is the whole of what the library does. . "$BST_LIB" P=/usr/lib/libnftnl/ptest/tests if [ ! -d "$P" ]; then bst_skip libnftnl/present "libnftnl-ptest not installed on this image" exit 0 fi # The library, not only its tests. This arm is static-only and builds no shared # object, so the archive in -staticdev IS the shipped artifact -- a run where the # tests pass but nothing installable was produced would otherwise read green. check libnftnl/staticlib test -f /usr/lib/libnftnl.a check libnftnl/header test -f /usr/include/libnftnl/table.h # A count assertion, deliberately. `make -k runtest-TESTS` over an empty tests/ exits # 0 having asserted nothing, and the loop below would then emit no cases at all -- a # suite that reads as a pass because it never ran. 32 is upstream's check_PROGRAMS at # SRCREV 83dd4dc, measured against a native x86_64 control of the same tree. n=$(ls "$P"/nft-*-test 2>/dev/null | wc -l) check_eq libnftnl/program-count 32 "$(printf '%s' "$n" | tr -d ' \t')" for t in "$P"/nft-*-test; do [ -x "$t" ] || continue b=${t##*/} c=${b#nft-} c=${c%-test} check_out "libnftnl/$c" "OK" "$t" done