netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] selftests: rtnetlink: Fix do_test_address_proto()
@ 2023-03-29 15:24 Petr Machata
  2023-03-30  7:02 ` Ido Schimmel
  2023-03-31  6:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Petr Machata @ 2023-03-29 15:24 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev
  Cc: David Ahern, Ido Schimmel, Petr Machata

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>
---
 tools/testing/selftests/net/rtnetlink.sh | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
index 3b15c686c03f..383ac6fc037d 100755
--- a/tools/testing/selftests/net/rtnetlink.sh
+++ b/tools/testing/selftests/net/rtnetlink.sh
@@ -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"
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] selftests: rtnetlink: Fix do_test_address_proto()
  2023-03-29 15:24 [PATCH net-next] selftests: rtnetlink: Fix do_test_address_proto() Petr Machata
@ 2023-03-30  7:02 ` Ido Schimmel
  2023-03-31  6:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Ido Schimmel @ 2023-03-30  7:02 UTC (permalink / raw)
  To: Petr Machata
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, David Ahern

On Wed, Mar 29, 2023 at 05:24:53PM +0200, Petr Machata wrote:
> 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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] selftests: rtnetlink: Fix do_test_address_proto()
  2023-03-29 15:24 [PATCH net-next] selftests: rtnetlink: Fix do_test_address_proto() Petr Machata
  2023-03-30  7:02 ` Ido Schimmel
@ 2023-03-31  6:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-03-31  6:30 UTC (permalink / raw)
  To: Petr Machata; +Cc: davem, edumazet, kuba, pabeni, netdev, dsahern, idosch

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 29 Mar 2023 17:24:53 +0200 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [net-next] selftests: rtnetlink: Fix do_test_address_proto()
    https://git.kernel.org/netdev/net-next/c/46e9acb7ae2a

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-31  6:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-29 15:24 [PATCH net-next] selftests: rtnetlink: Fix do_test_address_proto() Petr Machata
2023-03-30  7:02 ` Ido Schimmel
2023-03-31  6:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).