From: David Ahern <dsahern@gmail.com>
To: netdev@vger.kernel.org
Cc: linux-kselftest@vger.kernel.org, idosch@mellanox.com,
jiri@mellanox.com, David Ahern <dsahern@gmail.com>
Subject: [PATCH v2 net-next 1/4] selftests: forwarding: Only check tc version for tc tests
Date: Thu, 1 Mar 2018 13:49:30 -0800 [thread overview]
Message-ID: <20180301214933.20199-2-dsahern@gmail.com> (raw)
In-Reply-To: <20180301214933.20199-1-dsahern@gmail.com>
Capabilities of tc command are irrelevant for router tests:
$ ./router.sh
SKIP: iproute2 too old, missing shared block support
Add a CHECK_TC flag and only check tc capabilities if set. Add flag to
tc_common.sh and have it sourced before lib.sh
Also, if the command lacks some feature the test should exit non-0.
Signed-off-by: David Ahern <dsahern@gmail.com>
---
.../selftests/net/forwarding/bridge_vlan_aware.sh | 1 +
tools/testing/selftests/net/forwarding/lib.sh | 29 ++++++++++++++--------
.../testing/selftests/net/forwarding/tc_actions.sh | 2 +-
.../testing/selftests/net/forwarding/tc_chains.sh | 2 +-
.../testing/selftests/net/forwarding/tc_common.sh | 2 ++
.../testing/selftests/net/forwarding/tc_flower.sh | 2 +-
.../selftests/net/forwarding/tc_shblocks.sh | 2 +-
7 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh b/tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh
index 651998e70557..75d922438bc9 100755
--- a/tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh
+++ b/tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh
@@ -2,6 +2,7 @@
# SPDX-License-Identifier: GPL-2.0
NUM_NETIFS=4
+CHECK_TC="yes"
source lib.sh
h1_create()
diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index 23866a685f77..d0af52109360 100644
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -19,26 +19,33 @@ fi
##############################################################################
# Sanity checks
+check_tc_version()
+{
+ tc -j &> /dev/null
+ if [[ $? -ne 0 ]]; then
+ echo "SKIP: iproute2 too old; tc is missing JSON support"
+ exit 1
+ fi
+
+ tc filter help 2>&1 | grep block &> /dev/null
+ if [[ $? -ne 0 ]]; then
+ echo "SKIP: iproute2 too old; tc is missing shared block support"
+ exit 1
+ fi
+}
+
if [[ "$(id -u)" -ne 0 ]]; then
echo "SKIP: need root privileges"
exit 0
fi
-tc -j &> /dev/null
-if [[ $? -ne 0 ]]; then
- echo "SKIP: iproute2 too old, missing JSON support"
- exit 0
-fi
-
-tc filter help 2>&1 | grep block &> /dev/null
-if [[ $? -ne 0 ]]; then
- echo "SKIP: iproute2 too old, missing shared block support"
- exit 0
+if [[ "$CHECK_TC" = "yes" ]]; then
+ check_tc_version
fi
if [[ ! -x "$(command -v jq)" ]]; then
echo "SKIP: jq not installed"
- exit 0
+ exit 1
fi
if [[ ! -x "$(command -v $MZ)" ]]; then
diff --git a/tools/testing/selftests/net/forwarding/tc_actions.sh b/tools/testing/selftests/net/forwarding/tc_actions.sh
index 84234317a25d..8ab5cf0a960b 100755
--- a/tools/testing/selftests/net/forwarding/tc_actions.sh
+++ b/tools/testing/selftests/net/forwarding/tc_actions.sh
@@ -2,8 +2,8 @@
# SPDX-License-Identifier: GPL-2.0
NUM_NETIFS=4
-source lib.sh
source tc_common.sh
+source lib.sh
tcflags="skip_hw"
diff --git a/tools/testing/selftests/net/forwarding/tc_chains.sh b/tools/testing/selftests/net/forwarding/tc_chains.sh
index 94c114ad8b44..2fd15226974b 100755
--- a/tools/testing/selftests/net/forwarding/tc_chains.sh
+++ b/tools/testing/selftests/net/forwarding/tc_chains.sh
@@ -2,8 +2,8 @@
# SPDX-License-Identifier: GPL-2.0
NUM_NETIFS=2
-source lib.sh
source tc_common.sh
+source lib.sh
tcflags="skip_hw"
diff --git a/tools/testing/selftests/net/forwarding/tc_common.sh b/tools/testing/selftests/net/forwarding/tc_common.sh
index acd0b520241c..9d3b64a2a264 100644
--- a/tools/testing/selftests/net/forwarding/tc_common.sh
+++ b/tools/testing/selftests/net/forwarding/tc_common.sh
@@ -1,6 +1,8 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
+CHECK_TC="yes"
+
tc_check_packets()
{
local id=$1
diff --git a/tools/testing/selftests/net/forwarding/tc_flower.sh b/tools/testing/selftests/net/forwarding/tc_flower.sh
index 026a4ea4b2fb..032b882adfc0 100755
--- a/tools/testing/selftests/net/forwarding/tc_flower.sh
+++ b/tools/testing/selftests/net/forwarding/tc_flower.sh
@@ -2,8 +2,8 @@
# SPDX-License-Identifier: GPL-2.0
NUM_NETIFS=2
-source lib.sh
source tc_common.sh
+source lib.sh
tcflags="skip_hw"
diff --git a/tools/testing/selftests/net/forwarding/tc_shblocks.sh b/tools/testing/selftests/net/forwarding/tc_shblocks.sh
index cfc8a2ace388..077b98048ef4 100755
--- a/tools/testing/selftests/net/forwarding/tc_shblocks.sh
+++ b/tools/testing/selftests/net/forwarding/tc_shblocks.sh
@@ -2,8 +2,8 @@
# SPDX-License-Identifier: GPL-2.0
NUM_NETIFS=4
-source lib.sh
source tc_common.sh
+source lib.sh
tcflags="skip_hw"
--
2.11.0
next prev parent reply other threads:[~2018-03-01 21:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-01 21:49 [PATCH v2 net-next 0/4] selftests: forwarding: misc bug fixes and enhancements David Ahern
2018-03-01 21:49 ` David Ahern [this message]
2018-03-01 21:49 ` [PATCH v2 net-next 2/4] selftests: forwarding: Handle 0 for packet difference in multipath tests David Ahern
2018-03-01 21:49 ` [PATCH v2 net-next 3/4] selftests: forwarding: Use PING6 instead of ping for ipv6 multipath test David Ahern
2018-03-01 21:49 ` [PATCH v2 net-next 4/4] selftests: forwarding: Add description to the multipath tests David Ahern
2018-03-02 2:19 ` [PATCH v2 net-next 0/4] selftests: forwarding: misc bug fixes and enhancements David Miller
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=20180301214933.20199-2-dsahern@gmail.com \
--to=dsahern@gmail.com \
--cc=idosch@mellanox.com \
--cc=jiri@mellanox.com \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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).