Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: net: fib_nexthops: Wait before checking reported idle time

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>

authored by

Petr Machata and committed by
David S. Miller
b69c9946 d59bdda8

+1
+1
tools/testing/selftests/net/fib_nexthops.sh
··· 2078 2078 "id 101 index 0 nhid 2 id 101 index 1 nhid 2 id 101 index 2 nhid 1 id 101 index 3 nhid 1" 2079 2079 log_test $? 0 "Dump all nexthop buckets in a group" 2080 2080 2081 + sleep 0.1 2081 2082 (( $($IP -j nexthop bucket list id 101 | 2082 2083 jq '[.[] | select(.bucket.idle_time > 0 and 2083 2084 .bucket.idle_time < 2)] | length') == 4 ))