194 lines
		
	
	
	
		
			5.9 KiB
		
	
	
	
		
			Text
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			194 lines
		
	
	
	
		
			5.9 KiB
		
	
	
	
		
			Text
		
	
	
		
			Executable file
		
	
	
	
	
#!/usr/bin/env atf-sh
 | 
						|
 | 
						|
. $(atf_get_srcdir)/test_env.sh
 | 
						|
 | 
						|
tests_init \
 | 
						|
	noargs \
 | 
						|
	lo_always_auto \
 | 
						|
	dual_stack \
 | 
						|
	static_ipv4 \
 | 
						|
	static_ipv4_netmask \
 | 
						|
	static_ipv6 \
 | 
						|
	static_ipv6_netmask \
 | 
						|
	inet_dhcp \
 | 
						|
	use_dhcp \
 | 
						|
	alias_eth0_home \
 | 
						|
	alias_eth0_work \
 | 
						|
	bonded_bridge \
 | 
						|
	learned_dependency \
 | 
						|
	learned_dependency_2 \
 | 
						|
	learned_executor \
 | 
						|
	implicit_vlan \
 | 
						|
	deferred_teardown_1 \
 | 
						|
	deferred_teardown_2 \
 | 
						|
	deferred_teardown_3 \
 | 
						|
	teardown_dep_ordering \
 | 
						|
	regress_opt_f \
 | 
						|
	dependency_loop_breaking
 | 
						|
 | 
						|
noargs_body() {
 | 
						|
	atf_check -s exit:1 -e ignore ifdown -S/dev/null
 | 
						|
}
 | 
						|
 | 
						|
lo_always_auto_body() {
 | 
						|
	atf_check -s exit:0 -e ignore -o match:'executors/link' \
 | 
						|
		ifdown -f -S/dev/null -E $EXECUTORS -i/dev/null -n -a
 | 
						|
}
 | 
						|
 | 
						|
dual_stack_body() {
 | 
						|
	atf_check -s exit:0 -e ignore \
 | 
						|
		-o match:'executors/link' \
 | 
						|
		-o match:'executors/static' \
 | 
						|
		ifdown -f -S/dev/null -E $EXECUTORS -i $FIXTURES/static-eth0.interfaces -n -a
 | 
						|
}
 | 
						|
 | 
						|
static_ipv4_body() {
 | 
						|
	atf_check -s exit:0 -e ignore \
 | 
						|
		-o match:'executors/link' \
 | 
						|
		-o match:'executors/static' \
 | 
						|
		ifdown -f -S/dev/null -E $EXECUTORS -i $FIXTURES/static-eth0-v4.interfaces -n -a
 | 
						|
}
 | 
						|
 | 
						|
static_ipv4_netmask_body() {
 | 
						|
	atf_check -s exit:0 -e ignore \
 | 
						|
		-o match:'executors/link' \
 | 
						|
		-o match:'executors/static' \
 | 
						|
		ifdown -f -S/dev/null -E $EXECUTORS -i $FIXTURES/static-eth0-v4-netmask.interfaces -n -a
 | 
						|
}
 | 
						|
 | 
						|
static_ipv6_body() {
 | 
						|
	atf_check -s exit:0 -e ignore \
 | 
						|
		-o match:'executors/link' \
 | 
						|
		-o match:'executors/static' \
 | 
						|
		ifdown -f -S/dev/null -E $EXECUTORS -i $FIXTURES/static-eth0-v6.interfaces -n -a
 | 
						|
}
 | 
						|
 | 
						|
static_ipv6_netmask_body() {
 | 
						|
	atf_check -s exit:0 -e ignore \
 | 
						|
		-o match:'executors/link' \
 | 
						|
		-o match:'executors/static' \
 | 
						|
		ifdown -f -S/dev/null -E $EXECUTORS -i $FIXTURES/static-eth0-v6-netmask.interfaces -n -a
 | 
						|
}
 | 
						|
 | 
						|
inet_dhcp_body() {
 | 
						|
	atf_check -s exit:0 -e ignore \
 | 
						|
		-o match:'executors/link' \
 | 
						|
		-o match:'executors/dhcp' \
 | 
						|
		ifdown -f -S/dev/null -E $EXECUTORS -i $FIXTURES/dhcp-eth0.interfaces -n -a
 | 
						|
}
 | 
						|
 | 
						|
use_dhcp_body() {
 | 
						|
	atf_check -s exit:0 -e ignore \
 | 
						|
		-o match:'executors/link' \
 | 
						|
		-o match:'executors/dhcp' \
 | 
						|
		ifdown -f -S/dev/null -E $EXECUTORS -i $FIXTURES/use-dhcp-eth0.interfaces -n -a
 | 
						|
}
 | 
						|
 | 
						|
alias_eth0_home_body() {
 | 
						|
	atf_check -s exit:0 -e ignore \
 | 
						|
		-o match:'executors/link' \
 | 
						|
		-o match:'executors/dhcp' \
 | 
						|
		ifdown -S $FIXTURES/alias-home.ifstate \
 | 
						|
			-E $EXECUTORS -i $FIXTURES/alias-home-work.interfaces -n wlan0
 | 
						|
}
 | 
						|
 | 
						|
alias_eth0_work_body() {
 | 
						|
	atf_check -s exit:0 -e ignore \
 | 
						|
		-o match:'executors/link' \
 | 
						|
		-o match:'executors/static' \
 | 
						|
		ifdown -S $FIXTURES/alias-work.ifstate \
 | 
						|
			-E $EXECUTORS -i $FIXTURES/alias-home-work.interfaces -n wlan0
 | 
						|
}
 | 
						|
 | 
						|
bonded_bridge_body() {
 | 
						|
	atf_check -s exit:0 -e ignore \
 | 
						|
		-o match:'executors/link' \
 | 
						|
		-o match:'executors/bond' \
 | 
						|
		-o match:'executors/bridge' \
 | 
						|
		-o match:'executors/static' \
 | 
						|
		ifdown -S $FIXTURES/bonded-bridge.ifstate \
 | 
						|
			-E $EXECUTORS -i $FIXTURES/bonded-bridge.interfaces -n br0
 | 
						|
}
 | 
						|
 | 
						|
learned_dependency_body() {
 | 
						|
	atf_check -s exit:0 -o ignore \
 | 
						|
		-e match:"eth0" \
 | 
						|
		-e match:"eth1" \
 | 
						|
		-e match:"eth2" \
 | 
						|
		-e match:"eth3" \
 | 
						|
		-e match:"eth4" \
 | 
						|
		ifdown -n -S $FIXTURES/mock-dependency-generator.ifstate \
 | 
						|
			-E $EXECUTORS \
 | 
						|
			-i $FIXTURES/mock-dependency-generator.interfaces br0
 | 
						|
}
 | 
						|
 | 
						|
learned_dependency_2_body() {
 | 
						|
	atf_check -s exit:0 -o ignore \
 | 
						|
		-e match:"bond0" \
 | 
						|
		-e match:"eth0" \
 | 
						|
		-e match:"eth1" \
 | 
						|
		ifdown -n -S $FIXTURES/mock-dependency-generator-2.ifstate \
 | 
						|
			-E $EXECUTORS \
 | 
						|
			-i $FIXTURES/mock-dependency-generator-2.interfaces br0
 | 
						|
}
 | 
						|
 | 
						|
learned_executor_body() {
 | 
						|
	atf_check -s exit:0 -o ignore \
 | 
						|
		-e match:"attempting to run mock executor" \
 | 
						|
		ifdown -n -S $FIXTURES/mock-dependency-generator-2.ifstate \
 | 
						|
			-E $EXECUTORS \
 | 
						|
			-i $FIXTURES/mock-dependency-generator-2.interfaces br0
 | 
						|
}
 | 
						|
 | 
						|
implicit_vlan_body() {
 | 
						|
	atf_check -s exit:0 -o ignore \
 | 
						|
		-e match:"attempting to run vlan executor" \
 | 
						|
		-e match:"attempting to run link executor" \
 | 
						|
		ifdown -n -S $FIXTURES/vlan.ifstate -E $EXECUTORS -i $FIXTURES/vlan.interfaces eth0.8
 | 
						|
}
 | 
						|
 | 
						|
deferred_teardown_1_body() {
 | 
						|
	atf_check -s exit:0 -o ignore \
 | 
						|
		-e match:"skipping dependent interface eth0 \\(of bond0\\) -- transient dependencies still exist" \
 | 
						|
		-e match:"changing state of dependent interface eth1 \\(of bond0\\) to down" \
 | 
						|
		ifdown -n -S $FIXTURES/deferred-teardown-1.ifstate -E $EXECUTORS \
 | 
						|
			-i $FIXTURES/deferred-teardown-1.interfaces br0
 | 
						|
}
 | 
						|
 | 
						|
deferred_teardown_2_body() {
 | 
						|
	atf_check -s exit:0 -o ignore \
 | 
						|
		-e match:"skipping dependent interface eth0 \\(of tun0\\) -- transient dependencies still exist" \
 | 
						|
		-e match:"skipping dependent interface eth0 \\(of tun1\\) -- transient dependencies still exist" \
 | 
						|
		-e match:"skipping dependent interface eth0 \\(of tun2\\) -- transient dependencies still exist" \
 | 
						|
		ifdown -n -S $FIXTURES/deferred-teardown-2.ifstate -E $EXECUTORS \
 | 
						|
			-i $FIXTURES/deferred-teardown-2.interfaces tun0 tun1 tun2
 | 
						|
}
 | 
						|
 | 
						|
deferred_teardown_3_body() {
 | 
						|
	atf_check -s exit:0 -o ignore \
 | 
						|
		-e match:"skipping dependent interface eth0 \\(of tun0\\) -- transient dependencies still exist" \
 | 
						|
		-e match:"skipping dependent interface eth0 \\(of tun1\\) -- transient dependencies still exist" \
 | 
						|
		-e match:"skipping dependent interface eth0 \\(of tun2\\) -- transient dependencies still exist" \
 | 
						|
		-e match:"changing state of dependent interface eth0 \\(of tun3\\) to down" \
 | 
						|
		ifdown -n -S $FIXTURES/deferred-teardown-2.ifstate -E $EXECUTORS \
 | 
						|
			-i $FIXTURES/deferred-teardown-2.interfaces tun0 tun1 tun2 tun3
 | 
						|
}
 | 
						|
 | 
						|
teardown_dep_ordering_body() {
 | 
						|
	atf_check -s exit:0 -o ignore \
 | 
						|
		-e match:"skipping auto interface bat" \
 | 
						|
		-e match:"skipping auto interface dummy" \
 | 
						|
		ifdown -n -i $FIXTURES/teardown-dep-ordering.interfaces \
 | 
						|
			-S $FIXTURES/teardown-dep-ordering.ifstate -E $EXECUTORS -a
 | 
						|
}
 | 
						|
 | 
						|
regress_opt_f_body() {
 | 
						|
	atf_check -s exit:0 -o ignore -e ignore \
 | 
						|
		ifdown -n -S $FIXTURES/vlan.ifstate -E $EXECUTORS -i $FIXTURES/vlan.interfaces -f eth0.8
 | 
						|
}
 | 
						|
 | 
						|
dependency_loop_breaking_body() {
 | 
						|
	atf_check -s exit:0 -o ignore \
 | 
						|
		-e match:"ifdown: skipping auto interface a \\(already deconfigured\\), use --force to force deconfiguration" \
 | 
						|
		ifdown -n -i $FIXTURES/dependency-loop.interfaces -E $EXECUTORS -a
 | 
						|
}
 |