From: dsahern@kernel.org
To: netdev@vger.kernel.org
Cc: Thomas.Winter@alliedtelesis.co.nz, idosch@mellanox.com,
sharpd@cumulusnetworks.com, roopa@cumulusnetworks.com,
David Ahern <dsahern@gmail.com>
Subject: [PATCH net-next 4/7] selftests: fib_tests: Add command line options
Date: Mon, 21 May 2018 10:26:55 -0700 [thread overview]
Message-ID: <20180521172658.7389-5-dsahern@kernel.org> (raw)
In-Reply-To: <20180521172658.7389-1-dsahern@kernel.org>
From: David Ahern <dsahern@gmail.com>
Add command line options for controlling pause on fail, controlling
specific tests to run and verbose mode rather than relying on environment
variables.
Signed-off-by: David Ahern <dsahern@gmail.com>
---
tools/testing/selftests/net/fib_tests.sh | 53 ++++++++++++++++++++++++--------
1 file changed, 40 insertions(+), 13 deletions(-)
diff --git a/tools/testing/selftests/net/fib_tests.sh b/tools/testing/selftests/net/fib_tests.sh
index 7e2291161e15..8c99f0689efc 100755
--- a/tools/testing/selftests/net/fib_tests.sh
+++ b/tools/testing/selftests/net/fib_tests.sh
@@ -6,8 +6,9 @@
ret=0
-VERBOSE=${VERBOSE:=0}
-PAUSE_ON_FAIL=${PAUSE_ON_FAIL:=no}
+TESTS="unregister down carrier nexthop"
+VERBOSE=0
+PAUSE_ON_FAIL=no
IP="ip -netns testns"
log_test()
@@ -565,20 +566,36 @@ fib_nexthop_test()
}
################################################################################
-#
+# usage
-fib_test()
+usage()
{
- if [ -n "$TEST" ]; then
- eval $TEST
- else
- fib_unreg_test
- fib_down_test
- fib_carrier_test
- fib_nexthop_test
- fi
+ cat <<EOF
+usage: ${0##*/} OPTS
+
+ -t <test> Test(s) to run (default: all)
+ (options: $TESTS)
+ -p Pause on fail
+ -v verbose mode (show commands and output)
+EOF
}
+################################################################################
+# main
+
+while getopts :t:pPhv o
+do
+ case $o in
+ t) TESTS=$OPTARG;;
+ p) PAUSE_ON_FAIL=yes;;
+ v) VERBOSE=$(($VERBOSE + 1));;
+ h) usage; exit 0;;
+ *) usage; exit 1;;
+ esac
+done
+
+PEER_CMD="ip netns exec ${PEER_NS}"
+
if [ "$(id -u)" -ne 0 ];then
echo "SKIP: Need root privileges"
exit 0
@@ -598,7 +615,17 @@ fi
# start clean
cleanup &> /dev/null
-fib_test
+for t in $TESTS
+do
+ case $t in
+ fib_unreg_test|unregister) fib_unreg_test;;
+ fib_down_test|down) fib_down_test;;
+ fib_carrier_test|carrier) fib_carrier_test;;
+ fib_nexthop_test|nexthop) fib_nexthop_test;;
+
+ help) echo "Test names: $TESTS"; exit 0;;
+ esac
+done
if [ "$TESTS" != "none" ]; then
printf "\nTests passed: %3d\n" ${nsuccess}
--
2.11.0
next prev parent reply other threads:[~2018-05-21 17:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-21 17:26 [PATCH net-next 0/7] net/ipv6: Fix route append and replace use cases dsahern
2018-05-21 17:26 ` [PATCH net-next 1/7] mlxsw: spectrum_router: Add support for route append dsahern
2018-05-21 17:26 ` [PATCH net-next 2/7] net/ipv6: Simplify route replace and appending into multipath route dsahern
2018-05-21 17:26 ` [PATCH net-next 3/7] selftests: fib_tests: Add success-fail counts dsahern
2018-05-21 17:26 ` dsahern [this message]
2018-05-21 17:26 ` [PATCH net-next 5/7] selftests: fib_tests: Add option to pause after each test dsahern
2018-05-21 17:26 ` [PATCH net-next 6/7] selftests: fib_tests: Add ipv6 route add append replace tests dsahern
2018-05-21 17:26 ` [PATCH net-next 7/7] selftests: fib_tests: Add ipv4 " dsahern
2018-05-22 18:46 ` [PATCH net-next 0/7] net/ipv6: Fix route append and replace use cases David Miller
2018-05-22 20:44 ` David Ahern
2018-05-29 21:16 ` Thomas Winter
2018-07-02 21:23 ` David Ahern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180521172658.7389-5-dsahern@kernel.org \
--to=dsahern@kernel.org \
--cc=Thomas.Winter@alliedtelesis.co.nz \
--cc=dsahern@gmail.com \
--cc=idosch@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=roopa@cumulusnetworks.com \
--cc=sharpd@cumulusnetworks.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).