Commit 46e9acb7 authored by Petr Machata's avatar Petr Machata Committed by Jakub Kicinski
Browse files

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: 6a414fd7 ("selftests: rtnetlink: Add an address proto test")
Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
Link: https://lore.kernel.org/r/53a579bc883e1bf2fe490d58427cf22c2d1aa21f.1680102695.git.petrm@nvidia.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 3292004c
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -1302,19 +1302,23 @@ do_test_address_proto()

	count=$(address_count)
	check_err $?
	(( count == 3 )) # $addr, $addr2 and $addr3
	(( count >= 3 )) # $addr, $addr2 and $addr3 plus any kernel addresses
	check_err $?

	count=$(address_count proto 0)
	check_err $?
	(( count == 1 )) # just $addr2
	(( count == 1 )) # just $addr3
	check_err $?

	count=$(address_count proto 0x11)
	check_err $?
	(( count == 2 )) # $addr and $addr2
	(( count == 2 )) # $addr and $addr3
	check_err $?

	count=$(address_count proto 0xab)
	check_err $?
	(( count == 1 )) # just $addr2
	(( count == 1 )) # just $addr3
	check_err $?

	ip address del dev "$devdummy" "$addr"
	ip address del dev "$devdummy" "$addr2"