aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2018-03-01 16:49:30 -0500
committerDavid S. Miller <davem@davemloft.net>2018-03-01 21:19:02 -0500
commit198979be6c16aa62025d5a47680f2c7849b7e64c (patch)
treeac773524647c2cbd5c5c8fbb0b1d827308c35063
parent5f6f845b608a3fa13e5da0584eea5803710cf708 (diff)
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: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rwxr-xr-xtools/testing/selftests/net/forwarding/bridge_vlan_aware.sh1
-rw-r--r--tools/testing/selftests/net/forwarding/lib.sh29
-rwxr-xr-xtools/testing/selftests/net/forwarding/tc_actions.sh2
-rwxr-xr-xtools/testing/selftests/net/forwarding/tc_chains.sh2
-rw-r--r--tools/testing/selftests/net/forwarding/tc_common.sh2
-rwxr-xr-xtools/testing/selftests/net/forwarding/tc_flower.sh2
-rwxr-xr-xtools/testing/selftests/net/forwarding/tc_shblocks.sh2
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 @@
2# SPDX-License-Identifier: GPL-2.0 2# SPDX-License-Identifier: GPL-2.0
3 3
4NUM_NETIFS=4 4NUM_NETIFS=4
5CHECK_TC="yes"
5source lib.sh 6source lib.sh
6 7
7h1_create() 8h1_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
19############################################################################## 19##############################################################################
20# Sanity checks 20# Sanity checks
21 21
22check_tc_version()
23{
24 tc -j &> /dev/null
25 if [[ $? -ne 0 ]]; then
26 echo "SKIP: iproute2 too old; tc is missing JSON support"
27 exit 1
28 fi
29
30 tc filter help 2>&1 | grep block &> /dev/null
31 if [[ $? -ne 0 ]]; then
32 echo "SKIP: iproute2 too old; tc is missing shared block support"
33 exit 1
34 fi
35}
36
22if [[ "$(id -u)" -ne 0 ]]; then 37if [[ "$(id -u)" -ne 0 ]]; then
23 echo "SKIP: need root privileges" 38 echo "SKIP: need root privileges"
24 exit 0 39 exit 0
25fi 40fi
26 41
27tc -j &> /dev/null 42if [[ "$CHECK_TC" = "yes" ]]; then
28if [[ $? -ne 0 ]]; then 43 check_tc_version
29 echo "SKIP: iproute2 too old, missing JSON support"
30 exit 0
31fi
32
33tc filter help 2>&1 | grep block &> /dev/null
34if [[ $? -ne 0 ]]; then
35 echo "SKIP: iproute2 too old, missing shared block support"
36 exit 0
37fi 44fi
38 45
39if [[ ! -x "$(command -v jq)" ]]; then 46if [[ ! -x "$(command -v jq)" ]]; then
40 echo "SKIP: jq not installed" 47 echo "SKIP: jq not installed"
41 exit 0 48 exit 1
42fi 49fi
43 50
44if [[ ! -x "$(command -v $MZ)" ]]; then 51if [[ ! -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 @@
2# SPDX-License-Identifier: GPL-2.0 2# SPDX-License-Identifier: GPL-2.0
3 3
4NUM_NETIFS=4 4NUM_NETIFS=4
5source lib.sh
6source tc_common.sh 5source tc_common.sh
6source lib.sh
7 7
8tcflags="skip_hw" 8tcflags="skip_hw"
9 9
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 @@
2# SPDX-License-Identifier: GPL-2.0 2# SPDX-License-Identifier: GPL-2.0
3 3
4NUM_NETIFS=2 4NUM_NETIFS=2
5source lib.sh
6source tc_common.sh 5source tc_common.sh
6source lib.sh
7 7
8tcflags="skip_hw" 8tcflags="skip_hw"
9 9
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 @@
1#!/bin/bash 1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0 2# SPDX-License-Identifier: GPL-2.0
3 3
4CHECK_TC="yes"
5
4tc_check_packets() 6tc_check_packets()
5{ 7{
6 local id=$1 8 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 @@
2# SPDX-License-Identifier: GPL-2.0 2# SPDX-License-Identifier: GPL-2.0
3 3
4NUM_NETIFS=2 4NUM_NETIFS=2
5source lib.sh
6source tc_common.sh 5source tc_common.sh
6source lib.sh
7 7
8tcflags="skip_hw" 8tcflags="skip_hw"
9 9
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 @@
2# SPDX-License-Identifier: GPL-2.0 2# SPDX-License-Identifier: GPL-2.0
3 3
4NUM_NETIFS=4 4NUM_NETIFS=4
5source lib.sh
6source tc_common.sh 5source tc_common.sh
6source lib.sh
7 7
8tcflags="skip_hw" 8tcflags="skip_hw"
9 9