Commit 198979be authored by David Ahern's avatar David Ahern Committed by David S. Miller

selftests: forwarding: Only check tc version for tc tests

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: default avatarDavid Ahern <dsahern@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5f6f845b
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
NUM_NETIFS=4 NUM_NETIFS=4
CHECK_TC="yes"
source lib.sh source lib.sh
h1_create() h1_create()
......
...@@ -19,26 +19,33 @@ fi ...@@ -19,26 +19,33 @@ fi
############################################################################## ##############################################################################
# Sanity checks # 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 if [[ "$(id -u)" -ne 0 ]]; then
echo "SKIP: need root privileges" echo "SKIP: need root privileges"
exit 0 exit 0
fi fi
tc -j &> /dev/null if [[ "$CHECK_TC" = "yes" ]]; then
if [[ $? -ne 0 ]]; then check_tc_version
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
fi fi
if [[ ! -x "$(command -v jq)" ]]; then if [[ ! -x "$(command -v jq)" ]]; then
echo "SKIP: jq not installed" echo "SKIP: jq not installed"
exit 0 exit 1
fi fi
if [[ ! -x "$(command -v $MZ)" ]]; then if [[ ! -x "$(command -v $MZ)" ]]; then
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
NUM_NETIFS=4 NUM_NETIFS=4
source lib.sh
source tc_common.sh source tc_common.sh
source lib.sh
tcflags="skip_hw" tcflags="skip_hw"
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
NUM_NETIFS=2 NUM_NETIFS=2
source lib.sh
source tc_common.sh source tc_common.sh
source lib.sh
tcflags="skip_hw" tcflags="skip_hw"
......
#!/bin/bash #!/bin/bash
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
CHECK_TC="yes"
tc_check_packets() tc_check_packets()
{ {
local id=$1 local id=$1
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
NUM_NETIFS=2 NUM_NETIFS=2
source lib.sh
source tc_common.sh source tc_common.sh
source lib.sh
tcflags="skip_hw" tcflags="skip_hw"
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
NUM_NETIFS=4 NUM_NETIFS=4
source lib.sh
source tc_common.sh source tc_common.sh
source lib.sh
tcflags="skip_hw" tcflags="skip_hw"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment