Skip to contentSkip to conversation

selftests: net: More small fixes

PATCH Applied Benjamin Poirier 3 participants 9 messages Jan 31, 2024 – Feb 1, 2024

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

cover selftests: net: More small fixes

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
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/5 selftests: team: Add missing config options

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")
---
 tools/testing/selftests/drivers/net/team/config | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/selftests/drivers/net/team/config +3 -1
index 265b6882cc21..b5e3a3aad4bf 100644
@@ -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
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/5 selftests: bonding: Check initial state

In reply to Benjamin Poirier

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")
---
 .../testing/selftests/drivers/net/bonding/lag_lib.sh  | 11 +++++++++++
 1 file changed, 11 insertions(+)
tools/testing/selftests/drivers/net/bonding/lag_lib.sh +11 -0
index 2a268b17b61f..dbdd736a41d3 100644
@@ -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"
 
Signature · 1 line
2.43.0
#3 lore raw

PATCH 3/5 selftests: net: Remove executable bits from library scripts

In reply to Benjamin Poirier

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")
---
 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
tools/testing/selftests/net/net_helper.sh +0 -0
old mode 100755
new mode 100644
tools/testing/selftests/net/setup_loopback.sh +0 -0
old mode 100755
new mode 100644
Signature · 1 line
2.43.0
#4 lore raw

PATCH 4/5 selftests: net: List helper scripts in TEST_FILES Makefile variable

In reply to Benjamin Poirier

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")
---
 tools/testing/selftests/net/Makefile | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
tools/testing/selftests/net/Makefile +2 -3
index 48c6f93b8149..211753756bde 100644
@@ -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
 
Signature · 1 line
2.43.0
#5 lore raw

PATCH 5/5 selftests: forwarding: List helper scripts in TEST_FILES Makefile variable

In reply to Benjamin Poirier

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")
---
 tools/testing/selftests/net/forwarding/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/forwarding/Makefile +1 -1
index 452693514be4..4de92632f483 100644
@@ -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 \
Signature · 1 line
2.43.0
#6 lore raw
In reply to Benjamin Poirier
This series was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:

Hello:

This series was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:

Quoted 12 lines · 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

Quoted 1 line

[...]

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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
maintainer Reviewed-by on the v1 series
#7 lore raw
In reply to Benjamin Poirier
Quoted 3 lines · 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")

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

:(

#8 lore raw
In reply to Benjamin Poirier
This series was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 12 lines · 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

Quoted 1 line

[...]

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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html