From 0cdb40e1efb302799f1741e9ec396577c08250e6 Mon Sep 17 00:00:00 2001 From: philregier Date: Tue, 4 Dec 2018 13:47:39 -0800 Subject: [PATCH] Possible workaround for changing interface names One could also allow the form DIAG_NETWORK_DEV[$i]="nameA|nameB|nameC" but this would be somewhat messier to implement. What's more important, clean test code or a clean input syntax? --- diags/network.t | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/diags/network.t b/diags/network.t index cf5ac88..92a25d5 100755 --- a/diags/network.t +++ b/diags/network.t @@ -82,6 +82,7 @@ diag_plan $(($numtests)) for i in $(seq 0 $(($numdev - 1))); do dev=${DIAG_NETWORK_DEV[$i]} + altname=${DIAG_NETWORK_ALTNAME[$i]} mtu=${DIAG_NETWORK_MTU[$i]} mode=${DIAG_NETWORK_MODE[$i]} duplex=${DIAG_NETWORK_DUPLEX[$i]} @@ -89,7 +90,12 @@ for i in $(seq 0 $(($numdev - 1))); do if [ -d /sys/class/net/$dev ]; then diag_ok "$dev exists" else - diag_fail "$dev does not exst" + if [ -n "$altname" -a -d /sys/class/net/$altname ]; then + diag_ok "$altname found in place of $dev, proceeding" + dev=$altname + else + diag_fail "$dev does not exist" + fi fi if [ -n "$mtu" ]; then gotmtu="$(getmtu $dev)"