]> Git Repo - linux.git/commitdiff
selftests: forwarding: Only check tc version for tc tests
authorDavid Ahern <[email protected]>
Thu, 1 Mar 2018 21:49:30 +0000 (13:49 -0800)
committerDavid S. Miller <[email protected]>
Fri, 2 Mar 2018 02:19:02 +0000 (21:19 -0500)
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh
tools/testing/selftests/net/forwarding/lib.sh
tools/testing/selftests/net/forwarding/tc_actions.sh
tools/testing/selftests/net/forwarding/tc_chains.sh
tools/testing/selftests/net/forwarding/tc_common.sh
tools/testing/selftests/net/forwarding/tc_flower.sh
tools/testing/selftests/net/forwarding/tc_shblocks.sh

index 651998e7055797aa8f44dd3399a3e7be063c5d26..75d922438bc9768827a2d12a6ac2b1044e1d0f37 100755 (executable)
@@ -2,6 +2,7 @@
 # SPDX-License-Identifier: GPL-2.0
 
 NUM_NETIFS=4
+CHECK_TC="yes"
 source lib.sh
 
 h1_create()
index 23866a685f778c873581698ed85acb3e096461e2..d0af5210936002d66016c4e05ccf12ce760a3251 100644 (file)
@@ -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
index 84234317a25ddb84f778dd806639e678395dcc18..8ab5cf0a960b7fa1dc558a9104e23bcc255e97a4 100755 (executable)
@@ -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"
 
index 94c114ad8b44d0e083089a5241c23dfd22e34a03..2fd15226974b22d11449427d7b1bbf3b9f01d7cc 100755 (executable)
@@ -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"
 
index acd0b520241c703c9bf95a98db17435d0b3693e5..9d3b64a2a26427280ecb46b2c64a08f9752a06b2 100644 (file)
@@ -1,6 +1,8 @@
 #!/bin/bash
 # SPDX-License-Identifier: GPL-2.0
 
+CHECK_TC="yes"
+
 tc_check_packets()
 {
        local id=$1
index 026a4ea4b2fb61523a7b7fcb28a1a99c47c68f90..032b882adfc02a315bf5c99ebc3d02cc28efb1f7 100755 (executable)
@@ -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"
 
index cfc8a2ace38851b6144ac1f153920b12bd481844..077b98048ef4886c5ff0533ca8e3b459a7b346a0 100755 (executable)
@@ -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"
 
This page took 0.062492 seconds and 4 git commands to generate.