selftests: net: unify the Makefile formats
Subsystems (15)
Jakub Kicinski
maintainerPATCH v2 1/1 selftests: net: unify the Makefile formats
We get a significant number of conflicts between net and net-next because of selftests Makefile changes. People tend to append new test cases at the end of the Makefile when there's no clear sort order. Sort all networking selftests Makefiles, use the following format:
VAR_NAME := \ entry1 \ entry2 \ entry3 \ # end of VAR_NAME
Some Makefiles are already pretty close to this.
---
v2:
- fix the mptcp config, not sure what happened there
v1: https://lore.kernel.org/[email protected]
I think we need to apply this during the merge window, otherwise the conflicts will be crazy.
--- tools/testing/selftests/drivers/net/Makefile | 4 +- .../selftests/drivers/net/bonding/Makefile | 21 +- .../selftests/drivers/net/dsa/Makefile | 9 +- .../testing/selftests/drivers/net/hw/Makefile | 8 +- .../selftests/drivers/net/netdevsim/Makefile | 4 +- .../selftests/drivers/net/team/Makefile | 11 +- .../selftests/drivers/net/virtio_net/Makefile | 13 +- tools/testing/selftests/net/Makefile | 313 +++++++++++------- tools/testing/selftests/net/af_unix/Makefile | 10 +- .../testing/selftests/net/forwarding/Makefile | 58 ++-- tools/testing/selftests/net/hsr/Makefile | 6 +- tools/testing/selftests/net/lib/Makefile | 14 +- tools/testing/selftests/net/mptcp/Makefile | 28 +- .../testing/selftests/net/netfilter/Makefile | 89 ++--- tools/testing/selftests/net/ovpn/Makefile | 12 +- .../selftests/net/packetdrill/Makefile | 10 +- tools/testing/selftests/net/rds/Makefile | 10 +- 17 files changed, 380 insertions(+), 240 deletions(-)
tools/testing/selftests/drivers/net/Makefile +2 -2
@@ -10,6 +10,7 @@ TEST_GEN_FILES := \ # end of TEST_GEN_FILES TEST_PROGS := \ + hds.py \ napi_id.py \ napi_threaded.py \ netcons_basic.sh \
@@ -21,9 +22,8 @@ TEST_PROGS := \ ping.py \ psp.py \ queues.py \ - stats.py \ shaper.py \ - hds.py \ + stats.py \ xdp.py \ # end of TEST_PROGS
tools/testing/selftests/drivers/net/bonding/Makefile +12 -9
@@ -4,24 +4,27 @@ TEST_PROGS := \ bond-arp-interval-causes-panic.sh \ bond-break-lacpdu-tx.sh \ + bond-eth-type-change.sh \ bond-lladdr-target.sh \ + bond_ipsec_offload.sh \ + bond_lacp_prio.sh \ + bond_macvlan_ipvlan.sh \ + bond_options.sh \ + bond_passive_lacp.sh \ dev_addr_lists.sh \ mode-1-recovery-updelay.sh \ mode-2-recovery-updelay.sh \ - bond_options.sh \ - bond-eth-type-change.sh \ - bond_macvlan_ipvlan.sh \ - bond_passive_lacp.sh \ - bond_lacp_prio.sh - bond_ipsec_offload.sh +# end of TEST_PROGS TEST_FILES := \ - lag_lib.sh \ bond_topo_2d1c.sh \ - bond_topo_3d1c.sh + bond_topo_3d1c.sh \ + lag_lib.sh \ +# end of TEST_FILES TEST_INCLUDES := \ + ../../../net/lib.sh \ ../../../net/forwarding/lib.sh \ - ../../../net/lib.sh +# end of TEST_INCLUDES include ../../../lib.mk
tools/testing/selftests/drivers/net/dsa/Makefile +6 -3
@@ -9,11 +9,13 @@ TEST_PROGS = bridge_locked_port.sh \ local_termination.sh \ no_forwarding.sh \ tc_actions.sh \ - test_bridge_fdb_stress.sh + test_bridge_fdb_stress.sh \ +# end of TEST_PROGS TEST_FILES := \ + forwarding.config \ run_net_forwarding_test.sh \ - forwarding.config +# end of TEST_FILES TEST_INCLUDES := \ ../../../net/forwarding/bridge_locked_port.sh \
@@ -27,6 +29,7 @@ TEST_INCLUDES := \ ../../../net/forwarding/no_forwarding.sh \ ../../../net/forwarding/tc_actions.sh \ ../../../net/forwarding/tc_common.sh \ - ../../../net/lib.sh + ../../../net/lib.sh \ +# end of TEST_INCLUDES include ../../../lib.mk
tools/testing/selftests/drivers/net/hw/Makefile +6 -2
@@ -32,8 +32,8 @@ TEST_FILES := \ TEST_INCLUDES := \ $(wildcard lib/py/*.py ../lib/py/*.py) \ ../../../net/lib.sh \ - ../../../net/forwarding/lib.sh \ ../../../net/forwarding/ipip_lib.sh \ + ../../../net/forwarding/lib.sh \ ../../../net/forwarding/tc_common.sh \ #
@@ -45,7 +45,11 @@ TEST_GEN_FILES += $(patsubst %.c,%.o,$(wildcard *.bpf.c)) include ../../../lib.mk # YNL build -YNL_GENS := ethtool netdev +YNL_GENS := \ + ethtool \ + netdev \ +# end of YNL_GENS + include ../../../net/ynl.mk include ../../../net/bpf.mk
tools/testing/selftests/drivers/net/netdevsim/Makefile +3 -1
@@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0+ OR MIT -TEST_PROGS = devlink.sh \ +TEST_PROGS := \ + devlink.sh \ devlink_in_netns.sh \ devlink_trap.sh \ ethtool-coalesce.sh \
@@ -17,5 +18,6 @@ TEST_PROGS = devlink.sh \ psample.sh \ tc-mq-visibility.sh \ udp_tunnel_nic.sh \ +# end of TEST_PROGS include ../../../lib.mk
tools/testing/selftests/drivers/net/team/Makefile +8 -3
@@ -1,13 +1,18 @@ # SPDX-License-Identifier: GPL-2.0 # Makefile for net selftests -TEST_PROGS := dev_addr_lists.sh propagation.sh options.sh +TEST_PROGS := \ + dev_addr_lists.sh \ + options.sh \ + propagation.sh \ +# end of TEST_PROGS TEST_INCLUDES := \ ../bonding/lag_lib.sh \ ../../../net/forwarding/lib.sh \ - ../../../net/lib.sh \ ../../../net/in_netns.sh \ - ../../../net/lib/sh/defer.sh + ../../../net/lib.sh \ + ../../../net/lib/sh/defer.sh \ +# end of TEST_INCLUDES include ../../../lib.mk
tools/testing/selftests/drivers/net/virtio_net/Makefile +5 -8
@@ -1,15 +1,12 @@ # SPDX-License-Identifier: GPL-2.0+ OR MIT -TEST_PROGS = basic_features.sh \ - # +TEST_PROGS = basic_features.sh -TEST_FILES = \ - virtio_net_common.sh \ - # +TEST_FILES = virtio_net_common.sh TEST_INCLUDES = \ - ../../../net/forwarding/lib.sh \ - ../../../net/lib.sh \ - # + ../../../net/forwarding/lib.sh \ + ../../../net/lib.sh \ +# end of TEST_INCLUDES include ../../../lib.mk
tools/testing/selftests/net/Makefile +191 -122
329 lines not on this page · raw message
tools/testing/selftests/net/af_unix/Makefile +9 -1
@@ -1,4 +1,12 @@ CFLAGS += $(KHDR_INCLUDES) -Wall -Wflex-array-member-not-at-end -TEST_GEN_PROGS := diag_uid msg_oob scm_inq scm_pidfd scm_rights unix_connect + +TEST_GEN_PROGS := \ + diag_uid \ + msg_oob \ + scm_inq \ + scm_pidfd \ + scm_rights \ + unix_connect \ +# end of TEST_GEN_PROGS include ../../lib.mk
tools/testing/selftests/net/forwarding/Makefile +31 -27
148 lines not on this page · raw message
tools/testing/selftests/net/hsr/Makefile +5 -1
@@ -2,7 +2,11 @@ top_srcdir = ../../../../.. -TEST_PROGS := hsr_ping.sh hsr_redbox.sh +TEST_PROGS := \ + hsr_ping.sh \ + hsr_redbox.sh \ +# end of TEST_PROGS + TEST_FILES += hsr_common.sh include ../../lib.mk
tools/testing/selftests/net/lib/Makefile +9 -5
@@ -5,12 +5,16 @@ CFLAGS += -I../../../../../usr/include/ $(KHDR_INCLUDES) # Additional include paths needed by kselftest.h CFLAGS += -I../../ -TEST_FILES := ../../../../../Documentation/netlink/specs -TEST_FILES += ../../../../net/ynl +TEST_FILES := \ + ../../../../net/ynl \ + ../../../../../Documentation/netlink/specs \ +# end of TEST_FILES -TEST_GEN_FILES += csum -TEST_GEN_FILES += $(patsubst %.c,%.o,$(wildcard *.bpf.c)) -TEST_GEN_FILES += xdp_helper +TEST_GEN_FILES := \ + $(patsubst %.c,%.o,$(wildcard *.bpf.c)) \ + csum \ + xdp_helper \ +# end of TEST_GEN_FILES TEST_INCLUDES := $(wildcard py/*.py sh/*.sh)
tools/testing/selftests/net/mptcp/Makefile +23 -5
@@ -4,13 +4,31 @@ top_srcdir = ../../../../.. CFLAGS += -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include $(KHDR_INCLUDES) -TEST_PROGS := mptcp_connect.sh mptcp_connect_mmap.sh mptcp_connect_sendfile.sh \ - mptcp_connect_checksum.sh pm_netlink.sh mptcp_join.sh diag.sh \ - simult_flows.sh mptcp_sockopt.sh userspace_pm.sh +TEST_PROGS := \ + diag.sh \ + mptcp_connect.sh \ + mptcp_connect_checksum.sh \ + mptcp_connect_mmap.sh \ + mptcp_connect_sendfile.sh \ + mptcp_join.sh \ + mptcp_sockopt.sh \ + pm_netlink.sh \ + simult_flows.sh \ + userspace_pm.sh \ +# end of TEST_PROGS -TEST_GEN_FILES = mptcp_connect pm_nl_ctl mptcp_sockopt mptcp_inq mptcp_diag +TEST_GEN_FILES := \ + mptcp_connect \ + mptcp_diag \ + mptcp_inq \ + mptcp_sockopt \ + pm_nl_ctl \ +# end of TEST_GEN_FILES -TEST_FILES := mptcp_lib.sh settings +TEST_FILES := \ + mptcp_lib.sh \ + settings \ +# end of TEST_FILES TEST_INCLUDES := ../lib.sh $(wildcard ../lib/sh/*.sh)
tools/testing/selftests/net/netfilter/Makefile +49 -40
104 lines not on this page · raw message
tools/testing/selftests/net/ovpn/Makefile +7 -5
@@ -19,13 +19,15 @@ LDLIBS += $(VAR_LDLIBS) TEST_FILES = common.sh -TEST_PROGS = test.sh \ - test-large-mtu.sh \ +TEST_PROGS := \ test-chachapoly.sh \ - test-tcp.sh \ - test-float.sh \ + test-close-socket-tcp.sh \ test-close-socket.sh \ - test-close-socket-tcp.sh + test-float.sh \ + test-large-mtu.sh \ + test-tcp.sh \ + test.sh \ +# end of TEST_PROGS TEST_GEN_FILES := ovpn-cli
tools/testing/selftests/net/packetdrill/Makefile +6 -4
@@ -1,9 +1,11 @@ # SPDX-License-Identifier: GPL-2.0 -TEST_INCLUDES := ksft_runner.sh \ - defaults.sh \ - set_sysctls.py \ - ../../kselftest/ktap_helpers.sh +TEST_INCLUDES := \ + defaults.sh \ + ksft_runner.sh \ + set_sysctls.py \ + ../../kselftest/ktap_helpers.sh \ +# end of TEST_INCLUDES TEST_PROGS := $(wildcard *.pkt)
tools/testing/selftests/net/rds/Makefile +8 -2
@@ -5,8 +5,14 @@ TEST_PROGS := run.sh -TEST_FILES := include.sh test.py +TEST_FILES := \ + include.sh \ + test.py \ +# end of TEST_FILES -EXTRA_CLEAN := /tmp/rds_logs include.sh +EXTRA_CLEAN := \ + include.sh \ + /tmp/rds_logs \ +# end of EXTRA_CLEAN include ../../lib.mk
Signature · 1 line
2.51.0
Quoted 5 lines · Jakub Kicinski
We get a significant number of conflicts between net and net-next because of selftests
Makefilechanges. People tend to append new test cases at the end of theMakefilewhen there's no clear sort order. Sort all networking selftests Makefiles, use the following format:
If we see weird errors in CI, it might be because tests now run in a different order and previously masked missed cleanups are now exposed.
Quoted 7 lines
VAR_NAME := \ entry1 \ entry2 \ entry3 \ # end of VAR_NAME
Quoted 6 lines
Some Makefiles are already pretty close to this.
Signed-off-by Jakub Kicinski <[email protected]>
But there's a missed nit below.
tools/testing/selftests/drivers/net/dsa/Makefile TEST_PROGS = bridge_locked_port.sh \
Quoted 5 lines
tools/testing/selftests/drivers/net/dsa/Makefile +0
-0@@ -9,11 +9,13 @@ TEST_PROGS = bridge_locked_port.sh \
This should have the header converted as well:
TEST_PROGS := \ bridge_locked_port.sh \
Quoted 15 lines
tools/testing/selftests/drivers/net/dsa/Makefile +4
-2local_termination.sh \ no_forwarding.sh \ tc_actions.sh \ - test_bridge_fdb_stress.sh + test_bridge_fdb_stress.sh \ +# end of TEST_PROGS TEST_FILES := \ + forwarding.config \ run_net_forwarding_test.sh \ - forwarding.config +# end of TEST_FILES TEST_INCLUDES := \ ../../../net/forwarding/bridge_locked_port.sh \
Jakub Kicinski
maintainerQuoted 8 lines · On Mon, 6 Oct 2025 11:40:59 +0200 Petr Machata wrote:
Quoted 5 lines
We get a significant number of conflicts between net and net-next because of selftests
Makefilechanges. People tend to append new test cases at the end of theMakefilewhen there's no clear sort order. Sort all networking selftests Makefiles, use the following format:If we see weird errors in CI, it might be because tests now run in a different order and previously masked missed cleanups are now exposed.
Yes, sorry. I enabled the check before merging this so there's probably some transient false positives. Which is fine, the pw checks are for maintainers? :)
Quoted 10 lines
tools/testing/selftests/drivers/net/dsa/Makefile TEST_PROGS = bridge_locked_port.sh \
Quoted 5 lines
tools/testing/selftests/drivers/net/dsa/Makefile +0
-0@@ -9,11 +9,13 @@ TEST_PROGS = bridge_locked_port.sh \This should have the header converted as well:
TEST_PROGS := \ bridge_locked_port.sh \
Ack, let me fix when applying.
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 6 lines · On Fri, 3 Oct 2025 14:01:27 -0700 you wrote:
We get a significant number of conflicts between net and net-next because of selftests
Makefilechanges. People tend to append new test cases at the end of theMakefilewhen there's no clear sort order. Sort all networking selftests Makefiles, use the following format:
Quoted 7 lines
VAR_NAME := \ entry1 \ entry2 \ entry3 \ # end of VAR_NAME[...]
Here is the summary with links:
- [net,v2] selftests: net: unify the Makefile formats
https://git.kernel.org/netdev/net/c/f07f91a36090
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html