diff --git a/tests/linux/Kyuafile b/tests/linux/Kyuafile index 1aa036a..86cdebe 100644 --- a/tests/linux/Kyuafile +++ b/tests/linux/Kyuafile @@ -4,3 +4,4 @@ test_suite('ifupdown-ng') atf_test_program{name='link_test'} atf_test_program{name='ipv6-ra_test'} +atf_test_program{name='dhcp_test'} diff --git a/tests/linux/dhcp_test b/tests/linux/dhcp_test new file mode 100755 index 0000000..3ff884b --- /dev/null +++ b/tests/linux/dhcp_test @@ -0,0 +1,30 @@ +#!/usr/bin/env atf-sh + +. $(atf_get_srcdir)/../test_env.sh +EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/dhcp" + +tests_init udhcpc_up dhcpcd_up dhcpcd_down dhclient_up + +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} +}