selftests: fib_tests: Add option to pause after each test
authorDavid Ahern <dsahern@gmail.com>
Mon, 21 May 2018 17:26:56 +0000 (10:26 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 22 May 2018 18:44:19 +0000 (14:44 -0400)
Add option to pause after each test before cleanup is done. Allows
user to do manual inspection or more ad-hoc testing after each test
with the setup in tact.

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/net/fib_tests.sh

index 8c99f0689efc5a290756544b186b6c0d9515e77f..12b64882615140edc4b4c312cfc30c753ccafcb0 100755 (executable)
@@ -9,6 +9,7 @@ ret=0
 TESTS="unregister down carrier nexthop"
 VERBOSE=0
 PAUSE_ON_FAIL=no
+PAUSE=no
 IP="ip -netns testns"
 
 log_test()
@@ -31,6 +32,13 @@ log_test()
                        [ "$a" = "q" ] && exit 1
                fi
        fi
+
+       if [ "${PAUSE}" = "yes" ]; then
+               echo
+               echo "hit enter to continue, 'q' to quit"
+               read a
+               [ "$a" = "q" ] && exit 1
+       fi
 }
 
 setup()
@@ -576,6 +584,7 @@ usage: ${0##*/} OPTS
         -t <test>   Test(s) to run (default: all)
                     (options: $TESTS)
         -p          Pause on fail
+        -P          Pause after each test before cleanup
         -v          verbose mode (show commands and output)
 EOF
 }
@@ -588,6 +597,7 @@ do
        case $o in
                t) TESTS=$OPTARG;;
                p) PAUSE_ON_FAIL=yes;;
+               P) PAUSE=yes;;
                v) VERBOSE=$(($VERBOSE + 1));;
                h) usage; exit 0;;
                *) usage; exit 1;;
@@ -596,6 +606,9 @@ done
 
 PEER_CMD="ip netns exec ${PEER_NS}"
 
+# make sure we don't pause twice
+[ "${PAUSE}" = "yes" ] && PAUSE_ON_FAIL=no
+
 if [ "$(id -u)" -ne 0 ];then
        echo "SKIP: Need root privileges"
        exit 0