198979be6c
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>
26 lines
468 B
Bash
26 lines
468 B
Bash
#!/bin/bash
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
CHECK_TC="yes"
|
|
|
|
tc_check_packets()
|
|
{
|
|
local id=$1
|
|
local handle=$2
|
|
local count=$3
|
|
local ret
|
|
|
|
output="$(tc -j -s filter show $id)"
|
|
# workaround the jq bug which causes jq to return 0 in case input is ""
|
|
ret=$?
|
|
if [[ $ret -ne 0 ]]; then
|
|
return $ret
|
|
fi
|
|
echo $output | \
|
|
jq -e ".[] \
|
|
| select(.options.handle == $handle) \
|
|
| select(.options.actions[0].stats.packets == $count)" \
|
|
&> /dev/null
|
|
return $?
|
|
}
|