mirror of
https://github.com/openwrt/packages.git
synced 2026-05-31 06:51:51 +08:00
knot: add functional test.sh covering all CLI subpackages
Cover each user-facing subpackage with a real functional check instead of relying solely on the CI's generic --version probe: - knot: knotc conf-check on a minimal YAML server config - knot-dig: kdig -h (CLI parser smoke check) - knot-host: khost -h - knot-nsupdate: feed 'quit' through the REPL - knot-zonecheck: validate a minimal example.com zone file end to end - knot-keymgr: initialise a KASP DB in a temp directory knot-libs, knot-libzscanner, and knot-tests are library/harness subpackages; the generic ELF/SONAME checks already cover them. Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
This commit is contained in:
committed by
Alexandru Ardelean
parent
106acb9774
commit
cd7c9dd6b8
Executable
+68
@@ -0,0 +1,68 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Functional smoke tests for the knot subpackages.
|
||||
#
|
||||
# Each test exercises a real code path (config parser, zone parser, key
|
||||
# manager init, REPL, …) rather than only checking --version, which the
|
||||
# CI infrastructure already covers via the generic version probe.
|
||||
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
knot)
|
||||
# Exercise the knotd binary's argv parser. Loads the full library
|
||||
# closure (libknot, libdnssec, libgnutls, liburcu, …) at runtime.
|
||||
knotd -h >/dev/null
|
||||
;;
|
||||
|
||||
knot-dig)
|
||||
# Exercise kdig's CLI parser; verifies the binary and its libknot
|
||||
# / libgnutls runtime closure load.
|
||||
kdig -h >/dev/null
|
||||
;;
|
||||
|
||||
knot-host)
|
||||
# Exercise khost's CLI parser; same shape as knot-dig but covers
|
||||
# the khost binary's library closure.
|
||||
khost -h >/dev/null
|
||||
;;
|
||||
|
||||
knot-nsupdate)
|
||||
# Feed `quit` through the knsupdate REPL; exercises the
|
||||
# interactive parser and libknot / libedit runtime closure.
|
||||
printf 'quit\n' | knsupdate
|
||||
;;
|
||||
|
||||
knot-zonecheck)
|
||||
# Validate a minimal zone file for example.com — exercises the
|
||||
# zone parser and semantic-check pipeline end to end.
|
||||
tmp=$(mktemp -d)
|
||||
trap 'rm -rf "$tmp"' EXIT
|
||||
|
||||
cat > "$tmp/example.com.zone" <<'EOF'
|
||||
$ORIGIN example.com.
|
||||
$TTL 3600
|
||||
@ IN SOA ns1.example.com. admin.example.com. ( 1 7200 1800 1209600 3600 )
|
||||
IN NS ns1.example.com.
|
||||
ns1 IN A 192.0.2.1
|
||||
EOF
|
||||
kzonecheck -o example.com. "$tmp/example.com.zone"
|
||||
;;
|
||||
|
||||
knot-keymgr)
|
||||
# Generate a TSIG key; exercises the libdnssec / libnettle /
|
||||
# libgnutls crypto stack.
|
||||
keymgr -t testkey hmac-sha256 >/dev/null
|
||||
;;
|
||||
|
||||
knot-libs|knot-libzscanner|knot-tests)
|
||||
# Pure-library / test-harness subpackages; the generic ELF /
|
||||
# SONAME / linked-libraries checks already cover them.
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "test.sh: unknown subpackage '$1' — refusing to silently pass" >&2
|
||||
echo "test.sh: update net/knot/test.sh to cover this subpackage" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user