[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <6b4f73d1ec3d11920c5beed8eec7289c74eb66b2.1583170249.git.petrm@mellanox.com>
Date: Mon, 2 Mar 2020 19:56:03 +0200
From: Petr Machata <me@...chata.org>
To: netdev@...r.kernel.org
Cc: Ido Schimmel <idosch@...lanox.com>,
Petr Machata <petrm@...lanox.com>,
David Miller <davem@...emloft.net>,
Amit Cohen <amitc@...lanox.com>
Subject: [PATCH net-next 2/4] selftests: forwarding: Convert until_counter_is() to take expression
From: Petr Machata <petrm@...lanox.com>
until_counter_is() currently takes as an argument a number and the
condition holds when the current counter value is >= that number. Make the
function more generic by taking a partial expression instead of just the
number.
Convert the two existing users.
Signed-off-by: Petr Machata <petrm@...lanox.com>
Reviewed-by: Amit Cohen <amitc@...lanox.com>
---
tools/testing/selftests/drivers/net/mlxsw/sch_red_core.sh | 6 +++---
tools/testing/selftests/net/forwarding/lib.sh | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/drivers/net/mlxsw/sch_red_core.sh b/tools/testing/selftests/drivers/net/mlxsw/sch_red_core.sh
index ebf7752f6d93..8f833678ac4d 100644
--- a/tools/testing/selftests/drivers/net/mlxsw/sch_red_core.sh
+++ b/tools/testing/selftests/drivers/net/mlxsw/sch_red_core.sh
@@ -351,7 +351,7 @@ build_backlog()
local i=0
while :; do
- local cur=$(busywait 1100 until_counter_is $((cur + 1)) \
+ local cur=$(busywait 1100 until_counter_is "> $cur" \
get_qdisc_backlog $vlan)
local diff=$((size - cur))
local pkts=$(((diff + 7999) / 8000))
@@ -481,14 +481,14 @@ do_mc_backlog_test()
start_tcp_traffic $h1.$vlan $(ipaddr 1 $vlan) $(ipaddr 3 $vlan) bc
start_tcp_traffic $h2.$vlan $(ipaddr 2 $vlan) $(ipaddr 3 $vlan) bc
- qbl=$(busywait 5000 until_counter_is 500000 \
+ qbl=$(busywait 5000 until_counter_is ">= 500000" \
get_qdisc_backlog $vlan)
check_err $? "Could not build MC backlog"
# Verify that we actually see the backlog on BUM TC. Do a busywait as
# well, performance blips might cause false fail.
local ebl
- ebl=$(busywait 5000 until_counter_is 500000 \
+ ebl=$(busywait 5000 until_counter_is ">= 500000" \
get_mc_transmit_queue $vlan)
check_err $? "MC backlog reported by qdisc not visible in ethtool"
diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index de57e8887a7c..7ecce65d08f9 100644
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -277,11 +277,11 @@ wait_for_offload()
until_counter_is()
{
- local value=$1; shift
+ local expr=$1; shift
local current=$("$@")
echo $((current))
- ((current >= value))
+ ((current $expr))
}
busywait_for_counter()
@@ -290,7 +290,7 @@ busywait_for_counter()
local delta=$1; shift
local base=$("$@")
- busywait "$timeout" until_counter_is $((base + delta)) "$@"
+ busywait "$timeout" until_counter_is ">= $((base + delta))" "$@"
}
setup_wait_dev()
--
2.20.1
Powered by blists - more mailing lists