selftests: net: fib_nexthops: Wait before checking reported idle time
authorPetr Machata <petrm@nvidia.com>
Fri, 24 Sep 2021 10:04:27 +0000 (12:04 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 18:16:11 +0000 (19:16 +0100)
commit72d43bc26938c410f18ba5601aedee2055418058
tree2ef5ac3bc3e30932e27842443ec1b9e8bcbfce0d
parent678e8cd1bf22e1553ebf843e6ddab74083c6e936
selftests: net: fib_nexthops: Wait before checking reported idle time

[ Upstream commit b69c99463d414cc263411462d52f25205657e9af ]

The purpose of this test is to verify that after a short activity passes,
the reported time is reasonable: not zero (which could be reported by
mistake), and not something outrageous (which would be indicative of an
issue in used units).

However, the idle time is reported in units of clock_t, or hundredths of
second. If the initial sequence of commands is very quick, it is possible
that the idle time is reported as just flat-out zero. When this test was
recently enabled in our nightly regression, we started seeing spurious
failures for exactly this reason.

Therefore buffer the delay leading up to the test with a sleep, to make
sure there is no legitimate way of reporting 0.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/net/fib_nexthops.sh