Skip to content

Commit

Permalink
Possible workaround for changing interface names
Browse files Browse the repository at this point in the history
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?
  • Loading branch information
philregier authored Dec 4, 2018
1 parent 41e43d0 commit 0cdb40e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion diags/network.t
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,20 @@ 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]}
speed=${DIAG_NETWORK_SPEED[$i]}
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)"
Expand Down

0 comments on commit 0cdb40e

Please sign in to comment.