netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] selftests: mlxsw: qos_dscp_bridge: Fix
@ 2018-07-27 22:48 Petr Machata
  2018-07-29 20:00 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Petr Machata @ 2018-07-27 22:48 UTC (permalink / raw)
  To: netdev, linux-kselftest; +Cc: jiri, idosch, shuah

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>
---
 tools/testing/selftests/drivers/net/mlxsw/qos_dscp_bridge.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/drivers/net/mlxsw/qos_dscp_bridge.sh b/tools/testing/selftests/drivers/net/mlxsw/qos_dscp_bridge.sh
index 418319f19108..cc527660a022 100755
--- a/tools/testing/selftests/drivers/net/mlxsw/qos_dscp_bridge.sh
+++ b/tools/testing/selftests/drivers/net/mlxsw/qos_dscp_bridge.sh
@@ -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
-- 
2.4.11

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] selftests: mlxsw: qos_dscp_bridge: Fix
  2018-07-27 22:48 [PATCH net-next] selftests: mlxsw: qos_dscp_bridge: Fix Petr Machata
@ 2018-07-29 20:00 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-07-29 20:00 UTC (permalink / raw)
  To: petrm; +Cc: netdev, linux-kselftest, jiri, idosch, shuah

From: Petr Machata <petrm@mellanox.com>
Date: Sat, 28 Jul 2018 00:48:13 +0200

> 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>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-29 21:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-27 22:48 [PATCH net-next] selftests: mlxsw: qos_dscp_bridge: Fix Petr Machata
2018-07-29 20:00 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).