| 1 |
#!/usr/bin/env atf-sh |
| 2 |
|
| 3 |
. $(atf_get_srcdir)/test_env.sh |
| 4 |
|
| 5 |
tests_init \ |
| 6 |
noargs \ |
| 7 |
lo_always_auto \ |
| 8 |
dual_stack \ |
| 9 |
static_ipv4 \ |
| 10 |
static_ipv4_netmask \ |
| 11 |
static_ipv6 \ |
| 12 |
static_ipv6_netmask \ |
| 13 |
inet_dhcp \ |
| 14 |
use_dhcp \ |
| 15 |
alias_eth0_home \ |
| 16 |
alias_eth0_work \ |
| 17 |
bonded_bridge \ |
| 18 |
learned_dependency \ |
| 19 |
learned_dependency_2 \ |
| 20 |
learned_executor \ |
| 21 |
implicit_vlan \ |
| 22 |
deferred_teardown_1 \ |
| 23 |
deferred_teardown_2 \ |
| 24 |
deferred_teardown_3 \ |
| 25 |
teardown_dep_ordering \ |
| 26 |
regress_opt_f \ |
| 27 |
dependency_loop_breaking |
| 28 |
|
| 29 |
noargs_body() { |
| 30 |
atf_check -s exit:1 -e ignore ifdown -S/dev/null |
| 31 |
} |
| 32 |
|
| 33 |
lo_always_auto_body() { |
| 34 |
atf_check -s exit:0 -e ignore -o match:'executors/link' \ |
| 35 |
ifdown -f -S/dev/null -E $EXECUTORS -i/dev/null -n -a |
| 36 |
} |
| 37 |
|
| 38 |
dual_stack_body() { |
| 39 |
atf_check -s exit:0 -e ignore \ |
| 40 |
-o match:'executors/link' \ |
| 41 |
-o match:'executors/static' \ |
| 42 |
ifdown -f -S/dev/null -E $EXECUTORS -i $FIXTURES/static-eth0.interfaces -n -a |
| 43 |
} |
| 44 |
|
| 45 |
static_ipv4_body() { |
| 46 |
atf_check -s exit:0 -e ignore \ |
| 47 |
-o match:'executors/link' \ |
| 48 |
-o match:'executors/static' \ |
| 49 |
ifdown -f -S/dev/null -E $EXECUTORS -i $FIXTURES/static-eth0-v4.interfaces -n -a |
| 50 |
} |
| 51 |
|
| 52 |
static_ipv4_netmask_body() { |
| 53 |
atf_check -s exit:0 -e ignore \ |
| 54 |
-o match:'executors/link' \ |
| 55 |
-o match:'executors/static' \ |
| 56 |
ifdown -f -S/dev/null -E $EXECUTORS -i $FIXTURES/static-eth0-v4-netmask.interfaces -n -a |
| 57 |
} |
| 58 |
|
| 59 |
static_ipv6_body() { |
| 60 |
atf_check -s exit:0 -e ignore \ |
| 61 |
-o match:'executors/link' \ |
| 62 |
-o match:'executors/static' \ |
| 63 |
ifdown -f -S/dev/null -E $EXECUTORS -i $FIXTURES/static-eth0-v6.interfaces -n -a |
| 64 |
} |
| 65 |
|
| 66 |
static_ipv6_netmask_body() { |
| 67 |
atf_check -s exit:0 -e ignore \ |
| 68 |
-o match:'executors/link' \ |
| 69 |
-o match:'executors/static' \ |
| 70 |
ifdown -f -S/dev/null -E $EXECUTORS -i $FIXTURES/static-eth0-v6-netmask.interfaces -n -a |
| 71 |
} |
| 72 |
|
| 73 |
inet_dhcp_body() { |
| 74 |
atf_check -s exit:0 -e ignore \ |
| 75 |
-o match:'executors/link' \ |
| 76 |
-o match:'executors/dhcp' \ |
| 77 |
ifdown -f -S/dev/null -E $EXECUTORS -i $FIXTURES/dhcp-eth0.interfaces -n -a |
| 78 |
} |
| 79 |
|
| 80 |
use_dhcp_body() { |
| 81 |
atf_check -s exit:0 -e ignore \ |
| 82 |
-o match:'executors/link' \ |
| 83 |
-o match:'executors/dhcp' \ |
| 84 |
ifdown -f -S/dev/null -E $EXECUTORS -i $FIXTURES/use-dhcp-eth0.interfaces -n -a |
| 85 |
} |
| 86 |
|
| 87 |
alias_eth0_home_body() { |
| 88 |
atf_check -s exit:0 -e ignore \ |
| 89 |
-o match:'executors/link' \ |
| 90 |
-o match:'executors/dhcp' \ |
| 91 |
ifdown -S $FIXTURES/alias-home.ifstate \ |
| 92 |
-E $EXECUTORS -i $FIXTURES/alias-home-work.interfaces -n wlan0 |
| 93 |
} |
| 94 |
|
| 95 |
alias_eth0_work_body() { |
| 96 |
atf_check -s exit:0 -e ignore \ |
| 97 |
-o match:'executors/link' \ |
| 98 |
-o match:'executors/static' \ |
| 99 |
ifdown -S $FIXTURES/alias-work.ifstate \ |
| 100 |
-E $EXECUTORS -i $FIXTURES/alias-home-work.interfaces -n wlan0 |
| 101 |
} |
| 102 |
|
| 103 |
bonded_bridge_body() { |
| 104 |
atf_check -s exit:0 -e ignore \ |
| 105 |
-o match:'executors/link' \ |
| 106 |
-o match:'executors/bond' \ |
| 107 |
-o match:'executors/bridge' \ |
| 108 |
-o match:'executors/static' \ |
| 109 |
ifdown -S $FIXTURES/bonded-bridge.ifstate \ |
| 110 |
-E $EXECUTORS -i $FIXTURES/bonded-bridge.interfaces -n br0 |
| 111 |
} |
| 112 |
|
| 113 |
learned_dependency_body() { |
| 114 |
atf_check -s exit:0 -o ignore \ |
| 115 |
-e match:"eth0" \ |
| 116 |
-e match:"eth1" \ |
| 117 |
-e match:"eth2" \ |
| 118 |
-e match:"eth3" \ |
| 119 |
-e match:"eth4" \ |
| 120 |
ifdown -n -S $FIXTURES/mock-dependency-generator.ifstate \ |
| 121 |
-E $EXECUTORS \ |
| 122 |
-i $FIXTURES/mock-dependency-generator.interfaces br0 |
| 123 |
} |
| 124 |
|
| 125 |
learned_dependency_2_body() { |
| 126 |
atf_check -s exit:0 -o ignore \ |
| 127 |
-e match:"bond0" \ |
| 128 |
-e match:"eth0" \ |
| 129 |
-e match:"eth1" \ |
| 130 |
ifdown -n -S $FIXTURES/mock-dependency-generator-2.ifstate \ |
| 131 |
-E $EXECUTORS \ |
| 132 |
-i $FIXTURES/mock-dependency-generator-2.interfaces br0 |
| 133 |
} |
| 134 |
|
| 135 |
learned_executor_body() { |
| 136 |
atf_check -s exit:0 -o ignore \ |
| 137 |
-e match:"attempting to run mock executor" \ |
| 138 |
ifdown -n -S $FIXTURES/mock-dependency-generator-2.ifstate \ |
| 139 |
-E $EXECUTORS \ |
| 140 |
-i $FIXTURES/mock-dependency-generator-2.interfaces br0 |
| 141 |
} |
| 142 |
|
| 143 |
implicit_vlan_body() { |
| 144 |
atf_check -s exit:0 -o ignore \ |
| 145 |
-e match:"attempting to run vlan executor" \ |
| 146 |
-e match:"attempting to run link executor" \ |
| 147 |
ifdown -n -S $FIXTURES/vlan.ifstate -E $EXECUTORS -i $FIXTURES/vlan.interfaces eth0.8 |
| 148 |
} |
| 149 |
|
| 150 |
deferred_teardown_1_body() { |
| 151 |
atf_check -s exit:0 -o ignore \ |
| 152 |
-e match:"skipping dependent interface eth0 \\(of bond0\\) -- transient dependencies still exist" \ |
| 153 |
-e match:"changing state of dependent interface eth1 \\(of bond0\\) to down" \ |
| 154 |
ifdown -n -S $FIXTURES/deferred-teardown-1.ifstate -E $EXECUTORS \ |
| 155 |
-i $FIXTURES/deferred-teardown-1.interfaces br0 |
| 156 |
} |
| 157 |
|
| 158 |
deferred_teardown_2_body() { |
| 159 |
atf_check -s exit:0 -o ignore \ |
| 160 |
-e match:"skipping dependent interface eth0 \\(of tun0\\) -- transient dependencies still exist" \ |
| 161 |
-e match:"skipping dependent interface eth0 \\(of tun1\\) -- transient dependencies still exist" \ |
| 162 |
-e match:"skipping dependent interface eth0 \\(of tun2\\) -- transient dependencies still exist" \ |
| 163 |
ifdown -n -S $FIXTURES/deferred-teardown-2.ifstate -E $EXECUTORS \ |
| 164 |
-i $FIXTURES/deferred-teardown-2.interfaces tun0 tun1 tun2 |
| 165 |
} |
| 166 |
|
| 167 |
deferred_teardown_3_body() { |
| 168 |
atf_check -s exit:0 -o ignore \ |
| 169 |
-e match:"skipping dependent interface eth0 \\(of tun0\\) -- transient dependencies still exist" \ |
| 170 |
-e match:"skipping dependent interface eth0 \\(of tun1\\) -- transient dependencies still exist" \ |
| 171 |
-e match:"skipping dependent interface eth0 \\(of tun2\\) -- transient dependencies still exist" \ |
| 172 |
-e match:"changing state of dependent interface eth0 \\(of tun3\\) to down" \ |
| 173 |
ifdown -n -S $FIXTURES/deferred-teardown-2.ifstate -E $EXECUTORS \ |
| 174 |
-i $FIXTURES/deferred-teardown-2.interfaces tun0 tun1 tun2 tun3 |
| 175 |
} |
| 176 |
|
| 177 |
teardown_dep_ordering_body() { |
| 178 |
atf_check -s exit:0 -o ignore \ |
| 179 |
-e match:"skipping auto interface bat" \ |
| 180 |
-e match:"skipping auto interface dummy" \ |
| 181 |
ifdown -n -i $FIXTURES/teardown-dep-ordering.interfaces \ |
| 182 |
-S $FIXTURES/teardown-dep-ordering.ifstate -E $EXECUTORS -a |
| 183 |
} |
| 184 |
|
| 185 |
regress_opt_f_body() { |
| 186 |
atf_check -s exit:0 -o ignore -e ignore \ |
| 187 |
ifdown -n -S $FIXTURES/vlan.ifstate -E $EXECUTORS -i $FIXTURES/vlan.interfaces -f eth0.8 |
| 188 |
} |
| 189 |
|
| 190 |
dependency_loop_breaking_body() { |
| 191 |
atf_check -s exit:0 -o ignore \ |
| 192 |
-e match:"ifdown: skipping auto interface a \\(already deconfigured\\), use --force to force deconfiguration" \ |
| 193 |
ifdown -n -i $FIXTURES/dependency-loop.interfaces -E $EXECUTORS -a |
| 194 |
} |