Skip to content

Commit

Permalink
selftests: mlxsw: qos_dscp_bridge: Fix
Browse files Browse the repository at this point in the history
There are two problems in this test case:

- When indexing in bash associative array, the subscript is interpreted as
  string, not as a variable name to be expanded.

- The keys stored to t0s and t1s are not DSCP values, but priority +
  base (i.e. the logical DSCP value, not the full bitfield value).

In combination these two bugs conspire to make the test just work,
except it doesn't really test anything and always passes.

Fix the above two problems in obvious manner.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Petr Machata authored and David S. Miller committed Jul 29, 2018
1 parent 720516b commit eef6ab8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/testing/selftests/drivers/net/mlxsw/qos_dscp_bridge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,13 @@ dscp_ping_test()

for key in ${!t0s[@]}; do
local expect
if ((key == dscp_10 || key == dscp_20)); then
if ((key == prio+10 || key == prio+20)); then
expect=10
else
expect=0
fi

local delta=$((t1s[key] - t0s[key]))
local delta=$((t1s[$key] - t0s[$key]))
((expect == delta))
check_err $? "DSCP $key: Expected to capture $expect packets, got $delta."
done
Expand Down

0 comments on commit eef6ab8

Please sign in to comment.