Some small fixes for net selftests which follow from these recent commits: dd2d40acdbb2 ("selftests: bonding: Add more missing config options") 49078c1b80b6 ("selftests: forwarding: Remove executable bits from lib.sh")
Benjamin Poirier (5): selftests: team: Add missing config options selftests: bonding: Check initial state selftests: net: Remove executable bits from library scripts selftests: net: List helper scripts in TEST_FILES Makefile variable selftests: forwarding: List helper scripts in TEST_FILES Makefile variable
.../testing/selftests/drivers/net/bonding/lag_lib.sh | 11 +++++++++++ tools/testing/selftests/drivers/net/team/config | 4 +++- tools/testing/selftests/net/Makefile | 5 ++--- tools/testing/selftests/net/forwarding/Makefile | 2 +- tools/testing/selftests/net/net_helper.sh | 0 tools/testing/selftests/net/setup_loopback.sh | 0 6 files changed, 17 insertions(+), 5 deletions(-) mode change 100755 => 100644 tools/testing/selftests/net/net_helper.sh mode change 100755 => 100644 tools/testing/selftests/net/setup_loopback.sh
Similar to commit dd2d40acdbb2 ("selftests: bonding: Add more missing config options"), add more networking-specific config options which are needed for team device tests.
For testing, I used the minimal config generated by virtme-ng and I added the options in the config file. Afterwards, the team device test passed.
Fixes: bbb774d921e2 ("net: Add tests for bonding and team address list management") Reviewed-by: Petr Machata petrm@nvidia.com Signed-off-by: Benjamin Poirier bpoirier@nvidia.com --- tools/testing/selftests/drivers/net/team/config | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/drivers/net/team/config b/tools/testing/selftests/drivers/net/team/config index 265b6882cc21..b5e3a3aad4bf 100644 --- a/tools/testing/selftests/drivers/net/team/config +++ b/tools/testing/selftests/drivers/net/team/config @@ -1,3 +1,5 @@ +CONFIG_DUMMY=y +CONFIG_IPV6=y +CONFIG_MACVLAN=y CONFIG_NET_TEAM=y CONFIG_NET_TEAM_MODE_LOADBALANCE=y -CONFIG_MACVLAN=y
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 --- .../testing/selftests/drivers/net/bonding/lag_lib.sh | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/tools/testing/selftests/drivers/net/bonding/lag_lib.sh b/tools/testing/selftests/drivers/net/bonding/lag_lib.sh index 2a268b17b61f..dbdd736a41d3 100644 --- a/tools/testing/selftests/drivers/net/bonding/lag_lib.sh +++ b/tools/testing/selftests/drivers/net/bonding/lag_lib.sh @@ -48,6 +48,17 @@ test_LAG_cleanup() ip link add mv0 link "$name" up address "$ucaddr" type macvlan # Used to test dev->mc handling ip address add "$addr6" dev "$name" + + # Check that addresses were added as expected + (grep_bridge_fdb "$ucaddr" bridge fdb show dev dummy1 || + grep_bridge_fdb "$ucaddr" bridge fdb show dev dummy2) >/dev/null + check_err $? "macvlan unicast address not found on a slave" + + # mcaddr is added asynchronously by addrconf_dad_work(), use busywait + (busywait 10000 grep_bridge_fdb "$mcaddr" bridge fdb show dev dummy1 || + grep_bridge_fdb "$mcaddr" bridge fdb show dev dummy2) >/dev/null + check_err $? "IPv6 solicited-node multicast mac address not found on a slave" + ip link set dev "$name" down ip link del "$name"
setup_loopback.sh and net_helper.sh are meant to be sourced from other scripts, not executed directly. Therefore, remove the executable bits from those files' permissions.
This change is similar to commit 49078c1b80b6 ("selftests: forwarding: Remove executable bits from lib.sh")
Fixes: 7d1575014a63 ("selftests/net: GRO coalesce test") Fixes: 3bdd9fd29cb0 ("selftests/net: synchronize udpgro tests' tx and rx connection") Suggested-by: Paolo Abeni pabeni@redhat.com Signed-off-by: Benjamin Poirier bpoirier@nvidia.com --- tools/testing/selftests/net/net_helper.sh | 0 tools/testing/selftests/net/setup_loopback.sh | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 tools/testing/selftests/net/net_helper.sh mode change 100755 => 100644 tools/testing/selftests/net/setup_loopback.sh
diff --git a/tools/testing/selftests/net/net_helper.sh b/tools/testing/selftests/net/net_helper.sh old mode 100755 new mode 100644 diff --git a/tools/testing/selftests/net/setup_loopback.sh b/tools/testing/selftests/net/setup_loopback.sh old mode 100755 new mode 100644
Some scripts are not tests themselves; they contain utility functions used by other tests. According to Documentation/dev-tools/kselftest.rst, such files should be listed in TEST_FILES. Move those utility scripts to TEST_FILES.
Fixes: 1751eb42ddb5 ("selftests: net: use TEST_PROGS_EXTENDED") Fixes: 25ae948b4478 ("selftests/net: add lib.sh") Fixes: b99ac1841147 ("kselftests/net: add missed setup_loopback.sh/setup_veth.sh to Makefile") Fixes: f5173fe3e13b ("selftests: net: included needed helper in the install targets") Suggested-by: Petr Machata petrm@nvidia.com Signed-off-by: Benjamin Poirier bpoirier@nvidia.com --- tools/testing/selftests/net/Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile index 48c6f93b8149..211753756bde 100644 --- a/tools/testing/selftests/net/Makefile +++ b/tools/testing/selftests/net/Makefile @@ -53,9 +53,7 @@ TEST_PROGS += bind_bhash.sh TEST_PROGS += ip_local_port_range.sh TEST_PROGS += rps_default_mask.sh TEST_PROGS += big_tcp.sh -TEST_PROGS_EXTENDED := in_netns.sh setup_loopback.sh setup_veth.sh -TEST_PROGS_EXTENDED += toeplitz_client.sh toeplitz.sh lib.sh -TEST_PROGS_EXTENDED += net_helper.sh +TEST_PROGS_EXTENDED := toeplitz_client.sh toeplitz.sh TEST_GEN_FILES = socket nettest TEST_GEN_FILES += psock_fanout psock_tpacket msg_zerocopy reuseport_addr_any TEST_GEN_FILES += tcp_mmap tcp_inq psock_snd txring_overwrite @@ -97,6 +95,7 @@ TEST_PROGS += fq_band_pktlimit.sh TEST_PROGS += vlan_hw_filter.sh
TEST_FILES := settings +TEST_FILES += in_netns.sh lib.sh net_helper.sh setup_loopback.sh setup_veth.sh
include ../lib.mk
Some scripts are not tests themselves; they contain utility functions used by other tests. According to Documentation/dev-tools/kselftest.rst, such files should be listed in TEST_FILES. Currently they are incorrectly listed in TEST_PROGS_EXTENDED so rename the variable.
Fixes: c085dbfb1cfc ("selftests/net/forwarding: define libs as TEST_PROGS_EXTENDED") Suggested-by: Petr Machata petrm@nvidia.com Signed-off-by: Benjamin Poirier bpoirier@nvidia.com --- tools/testing/selftests/net/forwarding/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/forwarding/Makefile b/tools/testing/selftests/net/forwarding/Makefile index 452693514be4..4de92632f483 100644 --- a/tools/testing/selftests/net/forwarding/Makefile +++ b/tools/testing/selftests/net/forwarding/Makefile @@ -112,7 +112,7 @@ TEST_PROGS = bridge_fdb_learning_limit.sh \ vxlan_symmetric_ipv6.sh \ vxlan_symmetric.sh
-TEST_PROGS_EXTENDED := devlink_lib.sh \ +TEST_FILES := devlink_lib.sh \ ethtool_lib.sh \ fib_offload_lib.sh \ forwarding.config.sample \
Hello:
This series was applied to bpf/bpf-next.git (master) by Alexei Starovoitov ast@kernel.org:
On Wed, 31 Jan 2024 09:08:43 -0500 you wrote:
Some small fixes for net selftests which follow from these recent commits: dd2d40acdbb2 ("selftests: bonding: Add more missing config options") 49078c1b80b6 ("selftests: forwarding: Remove executable bits from lib.sh")
Benjamin Poirier (5): selftests: team: Add missing config options selftests: bonding: Check initial state selftests: net: Remove executable bits from library scripts selftests: net: List helper scripts in TEST_FILES Makefile variable selftests: forwarding: List helper scripts in TEST_FILES Makefile variable
[...]
Here is the summary with links: - [net,1/5] selftests: team: Add missing config options (no matching commit) - [net,2/5] selftests: bonding: Check initial state (no matching commit) - [net,3/5] selftests: net: Remove executable bits from library scripts https://git.kernel.org/bpf/bpf-next/c/cd1c194ffe28 - [net,4/5] selftests: net: List helper scripts in TEST_FILES Makefile variable (no matching commit) - [net,5/5] selftests: forwarding: List helper scripts in TEST_FILES Makefile variable (no matching commit)
You are awesome, thank you!
On Wed, 31 Jan 2024 09:08:43 -0500 Benjamin Poirier wrote:
Some small fixes for net selftests which follow from these recent commits: dd2d40acdbb2 ("selftests: bonding: Add more missing config options") 49078c1b80b6 ("selftests: forwarding: Remove executable bits from lib.sh")
Reviewed-by: Jakub Kicinski kuba@kernel.org
Not so great that the team test was passing even tho it lacks so many configs...
TAP version 13 1..1 # timeout set to 45 # 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. [ 17.601119] team0: Mode changed to "loadbalance" # RTNETLINK answers: Operation not supported # TEST: team cleanup mode lacp [ OK ] ok 1 selftests: drivers/net/team: dev_addr_lists.sh
:(
Hello:
This series was applied to netdev/net.git (main) by Jakub Kicinski kuba@kernel.org:
On Wed, 31 Jan 2024 09:08:43 -0500 you wrote:
Some small fixes for net selftests which follow from these recent commits: dd2d40acdbb2 ("selftests: bonding: Add more missing config options") 49078c1b80b6 ("selftests: forwarding: Remove executable bits from lib.sh")
Benjamin Poirier (5): selftests: team: Add missing config options selftests: bonding: Check initial state selftests: net: Remove executable bits from library scripts selftests: net: List helper scripts in TEST_FILES Makefile variable selftests: forwarding: List helper scripts in TEST_FILES Makefile variable
[...]
Here is the summary with links: - [net,1/5] selftests: team: Add missing config options https://git.kernel.org/netdev/net/c/7b6fb3050d8f - [net,2/5] selftests: bonding: Check initial state https://git.kernel.org/netdev/net/c/8cc063ae1b3d - [net,3/5] selftests: net: Remove executable bits from library scripts (no matching commit) - [net,4/5] selftests: net: List helper scripts in TEST_FILES Makefile variable https://git.kernel.org/netdev/net/c/06efafd8608d - [net,5/5] selftests: forwarding: List helper scripts in TEST_FILES Makefile variable https://git.kernel.org/netdev/net/c/96cd5ac4c0e6
You are awesome, thank you!
linux-kselftest-mirror@lists.linaro.org