summaryrefslogtreecommitdiffstats
path: root/net/kea/test.sh
blob: 3c96f987f6b96f0b961030105874435d3a6cb0d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/sh

set -e

# kea's `-t` validator requires the control-socket parent dir (mirrors kea.init).
mkdir -p -m 0750 /var/run/kea

case "$1" in
kea-dhcp4)
	# Validate the shipped DHCPv4 config; the QEMU mips netlink path
	# aborts after parsing succeeds, so tolerate that exact signature.
	if ! out=$(kea-dhcp4 -t /etc/kea/kea-dhcp4.conf 2>&1); then
		case "$out" in
		*"Failed to parse RTATTR in netlink message"*) ;;
		*) printf '%s\n' "$out" >&2; exit 1 ;;
		esac
	fi
	;;

kea-dhcp6)
	# Same as kea-dhcp4 but for the DHCPv6 server config / parser;
	# same QEMU netlink caveat applies.
	if ! out=$(kea-dhcp6 -t /etc/kea/kea-dhcp6.conf 2>&1); then
		case "$out" in
		*"Failed to parse RTATTR in netlink message"*) ;;
		*) printf '%s\n' "$out" >&2; exit 1 ;;
		esac
	fi
	;;

kea-dhcp-ddns)
	# Validate the shipped DDNS config; exercises the D2 parser
	# and its TSIG / DNS-update library closure.
	kea-dhcp-ddns -t /etc/kea/kea-dhcp-ddns.conf
	;;

kea-ctrl)
	# Exercise the ctrl-agent config parser + keactrl wrapper; the
	# config requires an auth-password file so satisfy it with a stub.
	echo test >/etc/kea/kea-api-password
	kea-ctrl-agent -t /etc/kea/kea-ctrl-agent.conf
	rm -f /etc/kea/kea-api-password
	keactrl -v >/dev/null
	;;

kea-admin)
	# kea-admin sources admin-utils.sh before usage(); --help proves
	# both the script and helper are packaged. -h is reserved in 3.0.x.
	kea-admin --help >/dev/null
	;;

kea-shell)
	# Python wrapper that imports kea_conn / kea_connector3; --help
	# exercises the interpreter, path rewrite and module imports.
	kea-shell --help >/dev/null
	;;

kea-lfc)
	# Exercise kea-lfc's argv parser and its libkea-util / libstdc++
	# runtime closure.
	kea-lfc -h >/dev/null
	;;

kea-perfdhcp)
	# Exercise perfdhcp's argv parser; loads the libkea-dhcp / asio
	# runtime closure used by every kea binary.
	perfdhcp -h >/dev/null
	;;

kea-dhcp4-helper)
	# Pure shell script under /usr/lib/kea/importers/; confirm it
	# was packaged and is executable.
	test -x /usr/lib/kea/importers/dhcp4.sh
	;;

kea-hook-ha)
	# Hook is a .so loaded by kea-dhcp{4,6}; confirm it was packaged.
	# Generic ELF / SONAME checks cover its dynamic linkage.
	test -f /usr/lib/kea/hooks/libdhcp_ha.so
	;;

kea-hook-lease-cmds)
	# Same shape as kea-hook-ha.
	test -f /usr/lib/kea/hooks/libdhcp_lease_cmds.so
	;;

kea-uci)
	# UCI integration: config defaults + init script. Confirm both
	# were packaged at the expected paths.
	test -f /etc/config/kea
	test -x /etc/init.d/kea
	;;

kea-libs)
	# Pure shared-library subpackage; the generic ELF / SONAME /
	# linked-libraries checks already cover it.
	;;

*)
	echo "test.sh: unknown subpackage '$1' — refusing to silently pass" >&2
	echo "test.sh: update net/kea/test.sh to cover this subpackage" >&2
	exit 1
	;;
esac