diff options
author | Petr Machata <petrm@mellanox.com> | 2020-03-02 19:56:03 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-03-03 17:03:52 -0800 |
commit | 844f0556546900a658b241e5aea7b8dc7cb3ff72 (patch) | |
tree | 4e9f78baefdcddff2a72d8ea522f86f0143fe87a /tools/testing/selftests/net/forwarding/lib.sh | |
parent | 84ea1f8541721c1852bc95f4d50a603c661eabc6 (diff) |
selftests: forwarding: Convert until_counter_is() to take expression
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@mellanox.com>
Reviewed-by: Amit Cohen <amitc@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing/selftests/net/forwarding/lib.sh')
-rw-r--r-- | tools/testing/selftests/net/forwarding/lib.sh | 6 |
1 files changed, 3 insertions, 3 deletions
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() |