ifupdown-ng/tests/linux/dhcp_test

55 lines
1.6 KiB
Text
Raw Normal View History

2020-07-26 10:00:56 +00:00
#!/usr/bin/env atf-sh
. $(atf_get_srcdir)/../test_env.sh
EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/dhcp"
2020-09-03 22:11:41 +00:00
tests_init udhcpc_up \
dhcpcd_up \
dhcpcd_down \
dhclient_up \
udhcpc_opts_up \
2020-09-11 08:43:32 +00:00
udhcpc_opts_up_subshell \
hostname_subshell
2020-07-26 10:00:56 +00:00
udhcpc_up_body() {
export IFACE=eth0 PHASE=up MOCK=echo IF_DHCP_PROGRAM=udhcpc
atf_check -s exit:0 -o match:'/sbin/udhcpc -b -R -p /var/run/udhcpc.eth0.pid -i eth0' \
${EXECUTOR}
}
dhcpcd_up_body() {
export IFACE=eth0 PHASE=up MOCK=echo IF_DHCP_PROGRAM=dhcpcd
atf_check -s exit:0 -o match:'/sbin/dhcpcd eth0' \
${EXECUTOR}
}
dhcpcd_down_body() {
export IFACE=eth0 PHASE=down MOCK=echo IF_DHCP_PROGRAM=dhcpcd
atf_check -s exit:0 -o match:'/sbin/dhcpcd -k eth0' \
${EXECUTOR}
}
dhclient_up_body() {
export IFACE=eth0 PHASE=up MOCK=echo IF_DHCP_PROGRAM=dhclient
atf_check -s exit:0 -o match:'/usr/sbin/dhclient -pf /var/run/dhclient.eth0.pid eth0' \
${EXECUTOR}
}
2020-09-03 22:11:41 +00:00
udhcpc_opts_up_body() {
export IFACE=eth0 PHASE=up MOCK=echo IF_DHCP_PROGRAM=udhcpc IF_UDHCPC_OPTS="-O search"
atf_check -s exit:0 -o match:'/sbin/udhcpc -b -R -p /var/run/udhcpc.eth0.pid -i eth0 -O search' \
${EXECUTOR}
}
udhcpc_opts_up_subshell_body() {
export IFACE=eth0 PHASE=up MOCK=echo IF_DHCP_PROGRAM=udhcpc IF_UDHCPC_OPTS="-O search -x hostname:\$(echo test)"
atf_check -s exit:0 -o match:'/sbin/udhcpc -b -R -p /var/run/udhcpc.eth0.pid -i eth0 -O search -x hostname:test' \
${EXECUTOR}
}
2020-09-11 08:43:32 +00:00
hostname_subshell_body() {
export IFACE=eth0 PHASE=up MOCK=echo IF_DHCP_PROGRAM=udhcpc IF_DHCP_HOSTNAME="\$(echo test)"
2020-09-11 08:43:32 +00:00
atf_check -s exit:0 -o match:'/sbin/udhcpc -b -R -p /var/run/udhcpc.eth0.pid -i eth0 -x hostname:test' \
${EXECUTOR}
}