selftests: bonding: Check initial state
authorBenjamin Poirier <bpoirier@nvidia.com>
Wed, 31 Jan 2024 14:08:45 +0000 (09:08 -0500)
committerJakub Kicinski <kuba@kernel.org>
Thu, 1 Feb 2024 16:36:24 +0000 (08:36 -0800)
commit8cc063ae1b3dbe416ce62a15d49af4c2314b45fe
tree804565c7174fe64763ce964c7d84ff6b81f5a963
parent7b6fb3050d8f5e2b6858eef344e47ac1f5442827
selftests: bonding: Check initial state

The purpose of the test_LAG_cleanup() function is to check that some
hardware addresses are removed from underlying devices after they have been
unenslaved. The test function simply checks that those addresses are not
present at the end. However, if the addresses were never added to begin
with due to some error in device setup, the test function currently passes.
This is a false positive since in that situation the test did not actually
exercise the intended functionality.

Add a check that the expected addresses are indeed present after device
setup. This makes the test function more robust.

I noticed this problem when running the team/dev_addr_lists.sh test on a
system without support for dummy and ipv6:

tools/testing/selftests/drivers/net/team# ./dev_addr_lists.sh
Error: Unknown device type.
Error: Unknown device type.
This program is not intended to be run as root.
RTNETLINK answers: Operation not supported
TEST: team cleanup mode lacp                                        [ OK ]

Fixes: bbb774d921e2 ("net: Add tests for bonding and team address list management")
Signed-off-by: Benjamin Poirier <bpoirier@nvidia.com>
Link: https://lore.kernel.org/r/20240131140848.360618-3-bpoirier@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/drivers/net/bonding/lag_lib.sh