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

selftests: rtnetlink: Fix do_test_address_proto()

This selftest was introduced recently in the commit cited below. It misses
several check_err() invocations to actually verify that the previous
command succeeded. When these are added, the first one fails, because
besides the addresses added by hand, there can be a link-local address
added by the kernel. Adjust the check to expect at least three addresses
instead of exactly three, and add the missing check_err's.

Furthermore, the explanatory comments assume that the address with no
protocol is $addr2, when in fact it is $addr3. Update the comments.

Fixes: 6a414fd77f61 ("selftests: rtnetlink: Add an address proto test")
Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://lore.kernel.org/r/53a579bc883e1bf2fe490d58427cf22c2d1aa21f.1680102695.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Petr Machata and committed by
Jakub Kicinski
46e9acb7 3292004c

+8 -4
+8 -4
tools/testing/selftests/net/rtnetlink.sh
··· 1302 1302 1303 1303 count=$(address_count) 1304 1304 check_err $? 1305 - (( count == 3 )) # $addr, $addr2 and $addr3 1305 + (( count >= 3 )) # $addr, $addr2 and $addr3 plus any kernel addresses 1306 + check_err $? 1306 1307 1307 1308 count=$(address_count proto 0) 1308 1309 check_err $? 1309 - (( count == 1 )) # just $addr2 1310 + (( count == 1 )) # just $addr3 1311 + check_err $? 1310 1312 1311 1313 count=$(address_count proto 0x11) 1312 1314 check_err $? 1313 - (( count == 2 )) # $addr and $addr2 1315 + (( count == 2 )) # $addr and $addr3 1316 + check_err $? 1314 1317 1315 1318 count=$(address_count proto 0xab) 1316 1319 check_err $? 1317 - (( count == 1 )) # just $addr2 1320 + (( count == 1 )) # just $addr3 1321 + check_err $? 1318 1322 1319 1323 ip address del dev "$devdummy" "$addr" 1320 1324 ip address del dev "$devdummy" "$addr2"