#!/usr/bin/env atf-sh . $(atf_get_srcdir)/test_env.sh init_tests \ setup_interfaces_usage \ setup_interfaces_none \ setup_interfaces_interactive_dhcp \ setup_interfaces_interactive_none \ setup_interfaces_interactive_vlan \ setup_interfaces_interactive_vlan_ng \ setup_interfaces_interactive_vlan0_ng \ setup_interfaces_interactive_br0 \ setup_interfaces_interactive_bond0 \ setup_interfaces_interactive_wlan0_psk \ setup_interfaces_interactive_wlan0_open \ setup_interfaces_auto \ setup_interfaces_auto_none \ setup_interfaces_auto_restart setup_interfaces_usage_body() { test_usage setup-interfaces } create_fake_ifaces() { local n=1 for i; do mkdir -p sys/class/net/$i echo $n > sys/class/net/$i/ifindex echo down >sys/class/net/$i/operstate n=$((n+1)) done } setup_interfaces_none_body() { init_env create_fake_ifaces lo eth0 atf_check -s exit:0 \ setup-interfaces none if [ -f etc/network/interfaces ]; then atf_fail "etc/network/interfaces should not be created" fi } setup_interfaces_interactive_dhcp_body() { init_env create_fake_ifaces lo eth0 ( # Which one do you want to initialize? (or '?' or 'done') [eth0] echo eth0 # Ip address for eth0? (or 'dhcp', 'none', '?') [dhcp] echo dhcp # Do you want to do any manual network configuration? (y/n) [n] echo n )>answers atf_check -s exit:0 \ -o match:"Available interfaces are: eth0" \ setup-interfaces answers atf_check -s exit:0 \ -o match:"Available interfaces are: eth0" \ setup-interfaces answers atf_check -s exit:0 \ -o match:"apk add.*vlan" \ setup-interfaces answers atf_check -s exit:0 \ -o not-match:"apk add.*vlan" \ setup-interfaces answers atf_check -s exit:0 \ -o match:"Available raw devices are: eth0" \ -o not-match:"apk add.*vlan" \ setup-interfaces answers atf_check -s exit:0 \ -o match:"Available bridge ports are: eth0" \ -o match:"apk add.*bridge" \ setup-interfaces answers atf_check -s exit:0 \ -o match:"Available interfaces are: eth0" \ -o match:"apk add.*bonding" \ setup-interfaces answers atf_check -s exit:0 \ -o match:"Available interfaces are: eth0 wlan2" \ -o match:"Lynx2C0CEA_5G" \ -o match:"Get-B3ED64" \ -o not-match:"x00" \ -o match:"Type the \"Telenor0366rar\" network Pre-Shared Key" \ -o match:"Ip address for wlan2" \ setup-interfaces answers atf_check -s exit:0 \ -o match:"Available interfaces are: eth0 wlan0" \ -o match:"Telenor0366rar" \ -o match:"Get-B3ED64" \ -o not-match:"x00" \ -o not-match:"Type the \"Lynx2C0CEA_5g\" network Pre-Shared Key" \ -o match:"Ip address for wlan0" \ setup-interfaces