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>
This commit is contained in:
committed by
David S. Miller
parent
5f6f845b60
commit
198979be6c
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user