2020-07-19 06:05:24 +00:00
|
|
|
#!/usr/bin/env atf-sh
|
|
|
|
|
|
|
|
. $(atf_get_srcdir)/test_env.sh
|
|
|
|
|
|
|
|
tests_init \
|
2020-07-19 06:17:42 +00:00
|
|
|
noargs \
|
2020-07-19 10:50:30 +00:00
|
|
|
loopback_always_configured \
|
|
|
|
static_dual_stack \
|
|
|
|
static_ipv4 \
|
|
|
|
static_ipv6 \
|
2020-07-20 14:29:14 +00:00
|
|
|
dhcp_ipv4 \
|
2020-07-24 11:04:33 +00:00
|
|
|
use_dhcp \
|
2020-07-20 14:29:14 +00:00
|
|
|
state_query_home \
|
|
|
|
state_query_work \
|
2020-07-28 19:48:53 +00:00
|
|
|
state_print \
|
2020-07-29 08:33:00 +00:00
|
|
|
learned_dependency \
|
2020-07-29 08:37:14 +00:00
|
|
|
learned_dependency_2 \
|
|
|
|
learned_executor
|
2020-07-19 06:05:24 +00:00
|
|
|
|
|
|
|
noargs_body() {
|
2020-07-20 14:24:31 +00:00
|
|
|
atf_check -s exit:1 -e ignore ifquery -S/dev/null
|
2020-07-19 06:05:24 +00:00
|
|
|
}
|
2020-07-19 06:17:42 +00:00
|
|
|
|
|
|
|
loopback_always_configured_body() {
|
2020-07-24 11:00:49 +00:00
|
|
|
atf_check -s exit:0 -o match:"use loopback" \
|
2020-07-20 14:24:31 +00:00
|
|
|
ifquery -S/dev/null -i $FIXTURES/static-eth0.interfaces lo
|
2020-07-19 06:17:42 +00:00
|
|
|
}
|
2020-07-19 10:50:30 +00:00
|
|
|
|
|
|
|
static_dual_stack_body() {
|
|
|
|
atf_check -s exit:0 -o match:"address 203.0.113.2/24" \
|
|
|
|
-o match:"address 2001:db8:1000:2::2/64" \
|
|
|
|
-o match:"gateway 203.0.113.1" \
|
|
|
|
-o match:"gateway 2001:db8:1000:2::1" \
|
2020-07-20 14:24:31 +00:00
|
|
|
ifquery -S/dev/null -i $FIXTURES/static-eth0.interfaces eth0
|
2020-07-19 10:50:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static_ipv4_body() {
|
|
|
|
atf_check -s exit:0 -o match:"address 203.0.113.2/24" \
|
|
|
|
-o match:"gateway 203.0.113.1" \
|
2020-07-20 14:24:31 +00:00
|
|
|
ifquery -S/dev/null -i $FIXTURES/static-eth0-v4.interfaces eth0
|
2020-07-19 10:50:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static_ipv6_body() {
|
|
|
|
atf_check -s exit:0 -o match:"address 2001:db8:1000:2::2/64" \
|
|
|
|
-o match:"gateway 2001:db8:1000:2::1" \
|
2020-07-20 14:24:31 +00:00
|
|
|
ifquery -S/dev/null -i $FIXTURES/static-eth0-v6.interfaces eth0
|
2020-07-19 10:50:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dhcp_ipv4_body() {
|
2020-07-24 11:00:49 +00:00
|
|
|
atf_check -s exit:0 -o match:"use dhcp" \
|
2020-07-20 14:24:31 +00:00
|
|
|
ifquery -S/dev/null -i $FIXTURES/dhcp-eth0.interfaces eth0
|
2020-07-19 10:50:30 +00:00
|
|
|
}
|
2020-07-20 14:29:14 +00:00
|
|
|
|
2020-07-24 11:04:33 +00:00
|
|
|
use_dhcp_body() {
|
|
|
|
atf_check -s exit:0 -o match:"use dhcp" \
|
|
|
|
ifquery -S/dev/null -i $FIXTURES/use-dhcp-eth0.interfaces eth0
|
|
|
|
}
|
|
|
|
|
2020-07-20 14:29:14 +00:00
|
|
|
state_query_home_body() {
|
|
|
|
atf_check -s exit:0 -o match:"iface home" \
|
|
|
|
ifquery -S $FIXTURES/alias-home.ifstate -i $FIXTURES/alias-home-work.interfaces wlan0
|
|
|
|
}
|
|
|
|
|
|
|
|
state_query_work_body() {
|
|
|
|
atf_check -s exit:0 -o match:"iface work" \
|
|
|
|
ifquery -S $FIXTURES/alias-work.ifstate -i $FIXTURES/alias-home-work.interfaces wlan0
|
|
|
|
}
|
|
|
|
|
|
|
|
state_print_body() {
|
|
|
|
atf_check -s exit:0 -o match:"wlan0=home" \
|
|
|
|
ifquery -S $FIXTURES/alias-home.ifstate -i $FIXTURES/alias-home-work.interfaces -s
|
|
|
|
atf_check -s exit:0 -o match:"wlan0=work" \
|
|
|
|
ifquery -S $FIXTURES/alias-work.ifstate -i $FIXTURES/alias-home-work.interfaces -s
|
|
|
|
}
|
2020-07-28 19:48:53 +00:00
|
|
|
|
|
|
|
learned_dependency_body() {
|
|
|
|
atf_check -s exit:0 -o match:"requires eth0 eth1 eth2 eth3 eth4" \
|
|
|
|
ifquery -E $EXECUTORS -i $FIXTURES/mock-dependency-generator.interfaces br0
|
|
|
|
}
|
2020-07-29 08:33:00 +00:00
|
|
|
|
|
|
|
learned_dependency_2_body() {
|
|
|
|
atf_check -s exit:0 -o match:"requires bond0" \
|
|
|
|
ifquery -E $EXECUTORS -i $FIXTURES/mock-dependency-generator-2.interfaces br0
|
|
|
|
}
|
2020-07-29 08:37:14 +00:00
|
|
|
|
|
|
|
learned_executor_body() {
|
|
|
|
atf_check -s exit:0 -o match:"use mock" \
|
|
|
|
ifquery -E $EXECUTORS -i $FIXTURES/mock-dependency-generator-2.interfaces br0
|
|
|
|
}
|