Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/sbin/ifconfig Skip interfaces that are already UP befo...



details:   https://anonhg.NetBSD.org/src/rev/9375d7cb4b9e
branches:  trunk
changeset: 936229:9375d7cb4b9e
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Jul 22 05:47:24 2020 +0000

description:
Skip interfaces that are already UP before the test starts. We can
not change state of the test host this way, it breaks e.g. test systems
with the root filesystem on NFS.

diffstat:

 tests/sbin/ifconfig/t_repeated_updown.sh |  14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diffs (29 lines):

diff -r 016f58b1587a -r 9375d7cb4b9e tests/sbin/ifconfig/t_repeated_updown.sh
--- a/tests/sbin/ifconfig/t_repeated_updown.sh  Wed Jul 22 01:24:39 2020 +0000
+++ b/tests/sbin/ifconfig/t_repeated_updown.sh  Wed Jul 22 05:47:24 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_repeated_updown.sh,v 1.3 2020/06/27 04:15:17 jruoho Exp $
+# $NetBSD: t_repeated_updown.sh,v 1.4 2020/07/22 05:47:24 martin Exp $
 #
 # Copyright (c) 2020 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -42,14 +42,12 @@
 
        for i in $(ifconfig -l); do
 
-               state="up"
-               ifconfig -s $i
+               # skip all interfaces that are already marked UP
+               ifconfig $i | fgrep -q UP >/dev/null && continue
 
-               if [ $? -eq 1 ]; then
-                       state="down"
-                       ifconfig $i up
-                       echo "Initialized $i up"
-               fi
+               state="down"
+               ifconfig $i up
+               echo "Initialized $i up"
 
                while [ $n -gt 0 ]; do
                        ifconfig $i down



Home | Main Index | Thread Index | Old Index