summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/net/forwarding/lib.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/testing/selftests/net/forwarding/lib.sh')
-rw-r--r--tools/testing/selftests/net/forwarding/lib.sh29
1 files changed, 18 insertions, 11 deletions
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
OpenPOWER on IntegriCloud