Skip to content

Commit 3047957

Browse files
liuhangbinkuba-moo
authored andcommitted
selftests: rtnetlink: fix addrlft test flakiness on power-saving systems
Jakub reported that the rtnetlink test for the preferred lifetime of an address has become quite flaky. The issue started appearing around the 6.16 merge window in May, and the test fails with: FAIL: preferred_lft addresses remaining The flakiness might be related to power-saving behavior, as address expiration is handled by a "power-efficient" workqueue. To address this, use slowwait to check more frequently whether the address still exists. This reduces the likelihood of the system entering a low-power state during the test, improving reliability. Reported-by: Jakub Kicinski <[email protected]> Signed-off-by: Hangbin Liu <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent c3886cc commit 3047957

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

tools/testing/selftests/net/rtnetlink.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,16 +291,26 @@ kci_test_route_get()
291291
end_test "PASS: route get"
292292
}
293293

294+
check_addr_not_exist()
295+
{
296+
dev=$1
297+
addr=$2
298+
if ip addr show dev $dev | grep -q $addr; then
299+
return 1
300+
else
301+
return 0
302+
fi
303+
}
304+
294305
kci_test_addrlft()
295306
{
296307
for i in $(seq 10 100) ;do
297308
lft=$(((RANDOM%3) + 1))
298309
run_cmd ip addr add 10.23.11.$i/32 dev "$devdummy" preferred_lft $lft valid_lft $((lft+1))
299310
done
300311

301-
sleep 5
302-
run_cmd_grep_fail "10.23.11." ip addr show dev "$devdummy"
303-
if [ $? -eq 0 ]; then
312+
slowwait 5 check_addr_not_exist "$devdummy" "10.23.11."
313+
if [ $? -eq 1 ]; then
304314
check_err 1
305315
end_test "FAIL: preferred_lft addresses remaining"
306316
return

0 commit comments

Comments
 (0)