From 6424b345be8c083e253aefa14a9f06328f949813 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Wed, 25 Jan 2023 15:36:26 +0100 Subject: setup-interfaces: add tests for auto --- setup-interfaces.in | 2 +- tests/setup_interfaces_test | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/setup-interfaces.in b/setup-interfaces.in index 33e9219..a5cc9ed 100644 --- a/setup-interfaces.in +++ b/setup-interfaces.in @@ -550,7 +550,7 @@ prompt_for_interfaces() { auto_setup() { local iface for iface in $(available_ifaces); do - if [ "$(cat "$ROOT"/sys/class/net/$iface/operstate)" = "up" ]; then + if [ "$(cat "$ROOT"/sys/class/net/$iface/operstate 2>/dev/null)" = "up" ]; then break fi done diff --git a/tests/setup_interfaces_test b/tests/setup_interfaces_test index 35dce72..4a611ab 100755 --- a/tests/setup_interfaces_test +++ b/tests/setup_interfaces_test @@ -12,7 +12,10 @@ init_tests \ setup_interfaces_interactive_br0 \ setup_interfaces_interactive_bond0 \ setup_interfaces_interactive_wlan0_psk \ - setup_interfaces_interactive_wlan0_open + setup_interfaces_interactive_wlan0_open \ + setup_interfaces_auto \ + setup_interfaces_auto_none \ + setup_interfaces_auto_restart setup_interfaces_usage_body() { test_usage setup-interfaces @@ -233,3 +236,24 @@ setup_interfaces_interactive_wlan0_open_body() { -o match:"Ip address for wlan0" \ setup-interfaces