selftests: net: Unify code of busywait() and slowwait()
authorPetr Machata <petrm@nvidia.com>
Fri, 12 Apr 2024 17:03:04 +0000 (19:03 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 16 Apr 2024 10:14:41 +0000 (12:14 +0200)
commita4022a332f437ae5b10921d66058ce98a2db2c20
tree46aefecf4b056fb06d87edb0479d11e92f9fe8c6
parent62d6d91db98a04defffd4ecfe168dd6ca80ef7d1
selftests: net: Unify code of busywait() and slowwait()

Bodies of busywait() and slowwait() functions are almost identical. Extract
the common code into a helper, loopy_wait, and convert busywait() and
slowwait() into trivial wrappers.

Moreover, the fact that slowwait() uses seconds for units is really not
intuitive, and the comment does not help much. Instead make the unit part
of the name of the argument to further clarify what units are expected.

Cc: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Benjamin Poirier <bpoirier@nvidia.com>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
tools/testing/selftests/net/forwarding/lib.sh
tools/testing/selftests/net/lib.sh