[PATCH net-next] netconsole: selftests: Move netconsole selftests to separate target

Andre Carvalho posted 1 patch 1 week, 6 days ago
There is a newer version of this series
MAINTAINERS                                           |  2 +-
tools/testing/selftests/Makefile                      |  1 +
tools/testing/selftests/drivers/net/Makefile          |  7 -------
.../testing/selftests/drivers/net/netconsole/Makefile | 19 +++++++++++++++++++
tools/testing/selftests/drivers/net/netconsole/config |  6 ++++++
.../drivers/net/{ => netconsole}/netcons_basic.sh     |  2 +-
.../drivers/net/{ => netconsole}/netcons_cmdline.sh   |  2 +-
.../net/{ => netconsole}/netcons_fragmented_msg.sh    |  2 +-
.../drivers/net/{ => netconsole}/netcons_overflow.sh  |  2 +-
.../drivers/net/{ => netconsole}/netcons_resume.sh    |  2 +-
.../drivers/net/{ => netconsole}/netcons_sysdata.sh   |  2 +-
.../drivers/net/{ => netconsole}/netcons_torture.sh   |  2 +-
12 files changed, 34 insertions(+), 15 deletions(-)
[PATCH net-next] netconsole: selftests: Move netconsole selftests to separate target
Posted by Andre Carvalho 1 week, 6 days ago
This patch moves netconsole selftests from drivers/net to its own target
in drivers/net/netconsole.

This change helps saving some resources from CI since tests in
drivers/net automatically run against real hardware which are not used
by netconsole tests as they rely solely on netdevsim.

lib_netcons.sh is kept under drivers/net/lib since it is also used by
bonding selftests. Finally, drivers/net config remains unchanged as
netpoll_basic.py requires netconsole (and does leverage real HW testing).

Signed-off-by: Andre Carvalho <asantostc@gmail.com>
---
This was initially discussed in [1] when Jakub pointed out new tests
were failing on HW runs. I'm not sure if the CI is going to
automatically run these or if some changes are required on NIPA in order
to do so.

Link: https://lore.kernel.org/netdev/20260120172057.6600eefe@kernel.org/ [1]
---
 MAINTAINERS                                           |  2 +-
 tools/testing/selftests/Makefile                      |  1 +
 tools/testing/selftests/drivers/net/Makefile          |  7 -------
 .../testing/selftests/drivers/net/netconsole/Makefile | 19 +++++++++++++++++++
 tools/testing/selftests/drivers/net/netconsole/config |  6 ++++++
 .../drivers/net/{ => netconsole}/netcons_basic.sh     |  2 +-
 .../drivers/net/{ => netconsole}/netcons_cmdline.sh   |  2 +-
 .../net/{ => netconsole}/netcons_fragmented_msg.sh    |  2 +-
 .../drivers/net/{ => netconsole}/netcons_overflow.sh  |  2 +-
 .../drivers/net/{ => netconsole}/netcons_resume.sh    |  2 +-
 .../drivers/net/{ => netconsole}/netcons_sysdata.sh   |  2 +-
 .../drivers/net/{ => netconsole}/netcons_torture.sh   |  2 +-
 12 files changed, 34 insertions(+), 15 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 92768bceb929..d92927ce87cc 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -18016,7 +18016,7 @@ S:	Maintained
 F:	Documentation/networking/netconsole.rst
 F:	drivers/net/netconsole.c
 F:	tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh
-F:	tools/testing/selftests/drivers/net/netcons\*
+F:	tools/testing/selftests/drivers/net/netconsole/*
 
 NETDEVSIM
 M:	Jakub Kicinski <kuba@kernel.org>
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 56e44a98d6a5..450f13ba4cca 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -22,6 +22,7 @@ TARGETS += drivers/ntsync
 TARGETS += drivers/s390x/uvdevice
 TARGETS += drivers/net
 TARGETS += drivers/net/bonding
+TARGETS += drivers/net/netconsole
 TARGETS += drivers/net/team
 TARGETS += drivers/net/virtio_net
 TARGETS += drivers/platform/x86/intel/ifs
diff --git a/tools/testing/selftests/drivers/net/Makefile b/tools/testing/selftests/drivers/net/Makefile
index 3eba569b3366..8154d6d429d3 100644
--- a/tools/testing/selftests/drivers/net/Makefile
+++ b/tools/testing/selftests/drivers/net/Makefile
@@ -15,13 +15,6 @@ TEST_PROGS := \
 	hds.py \
 	napi_id.py \
 	napi_threaded.py \
-	netcons_basic.sh \
-	netcons_cmdline.sh \
-	netcons_fragmented_msg.sh \
-	netcons_overflow.sh \
-	netcons_resume.sh \
-	netcons_sysdata.sh \
-	netcons_torture.sh \
 	netpoll_basic.py \
 	ping.py \
 	psp.py \
diff --git a/tools/testing/selftests/drivers/net/netconsole/Makefile b/tools/testing/selftests/drivers/net/netconsole/Makefile
new file mode 100644
index 000000000000..b56c70b7e274
--- /dev/null
+++ b/tools/testing/selftests/drivers/net/netconsole/Makefile
@@ -0,0 +1,19 @@
+# SPDX-License-Identifier: GPL-2.0
+
+TEST_INCLUDES := \
+	../../../net/lib.sh \
+	../lib/sh/lib_netcons.sh \
+# end of TEST_INCLUDES
+
+TEST_PROGS := \
+	netcons_basic.sh \
+	netcons_cmdline.sh \
+	netcons_fragmented_msg.sh \
+	netcons_overflow.sh \
+	netcons_resume.sh \
+	netcons_sysdata.sh \
+	netcons_torture.sh \
+# end of TEST_PROGS
+
+include ../../../lib.mk
+
diff --git a/tools/testing/selftests/drivers/net/netconsole/config b/tools/testing/selftests/drivers/net/netconsole/config
new file mode 100644
index 000000000000..a3f6b0fd44ef
--- /dev/null
+++ b/tools/testing/selftests/drivers/net/netconsole/config
@@ -0,0 +1,6 @@
+CONFIG_CONFIGFS_FS=y
+CONFIG_IPV6=y
+CONFIG_NETCONSOLE=m
+CONFIG_NETCONSOLE_DYNAMIC=y
+CONFIG_NETCONSOLE_EXTENDED_LOG=y
+CONFIG_NETDEVSIM=m
diff --git a/tools/testing/selftests/drivers/net/netcons_basic.sh b/tools/testing/selftests/drivers/net/netconsole/netcons_basic.sh
similarity index 98%
rename from tools/testing/selftests/drivers/net/netcons_basic.sh
rename to tools/testing/selftests/drivers/net/netconsole/netcons_basic.sh
index 2022f3061738..59cf10013ecd 100755
--- a/tools/testing/selftests/drivers/net/netcons_basic.sh
+++ b/tools/testing/selftests/drivers/net/netconsole/netcons_basic.sh
@@ -18,7 +18,7 @@ set -euo pipefail
 
 SCRIPTDIR=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")")
 
-source "${SCRIPTDIR}"/lib/sh/lib_netcons.sh
+source "${SCRIPTDIR}"/../lib/sh/lib_netcons.sh
 
 modprobe netdevsim 2> /dev/null || true
 modprobe netconsole 2> /dev/null || true
diff --git a/tools/testing/selftests/drivers/net/netcons_cmdline.sh b/tools/testing/selftests/drivers/net/netconsole/netcons_cmdline.sh
similarity index 97%
rename from tools/testing/selftests/drivers/net/netcons_cmdline.sh
rename to tools/testing/selftests/drivers/net/netconsole/netcons_cmdline.sh
index d1d23dc67f99..96d704b8d9d9 100755
--- a/tools/testing/selftests/drivers/net/netcons_cmdline.sh
+++ b/tools/testing/selftests/drivers/net/netconsole/netcons_cmdline.sh
@@ -12,7 +12,7 @@ set -euo pipefail
 
 SCRIPTDIR=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")")
 
-source "${SCRIPTDIR}"/lib/sh/lib_netcons.sh
+source "${SCRIPTDIR}"/../lib/sh/lib_netcons.sh
 
 check_netconsole_module
 
diff --git a/tools/testing/selftests/drivers/net/netcons_fragmented_msg.sh b/tools/testing/selftests/drivers/net/netconsole/netcons_fragmented_msg.sh
similarity index 98%
rename from tools/testing/selftests/drivers/net/netcons_fragmented_msg.sh
rename to tools/testing/selftests/drivers/net/netconsole/netcons_fragmented_msg.sh
index 4a71e01a230c..0dc7280c3080 100755
--- a/tools/testing/selftests/drivers/net/netcons_fragmented_msg.sh
+++ b/tools/testing/selftests/drivers/net/netconsole/netcons_fragmented_msg.sh
@@ -16,7 +16,7 @@ set -euo pipefail
 
 SCRIPTDIR=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")")
 
-source "${SCRIPTDIR}"/lib/sh/lib_netcons.sh
+source "${SCRIPTDIR}"/../lib/sh/lib_netcons.sh
 
 modprobe netdevsim 2> /dev/null || true
 modprobe netconsole 2> /dev/null || true
diff --git a/tools/testing/selftests/drivers/net/netcons_overflow.sh b/tools/testing/selftests/drivers/net/netconsole/netcons_overflow.sh
similarity index 97%
rename from tools/testing/selftests/drivers/net/netcons_overflow.sh
rename to tools/testing/selftests/drivers/net/netconsole/netcons_overflow.sh
index 06089643b771..a8e43d08c166 100755
--- a/tools/testing/selftests/drivers/net/netcons_overflow.sh
+++ b/tools/testing/selftests/drivers/net/netconsole/netcons_overflow.sh
@@ -13,7 +13,7 @@ set -euo pipefail
 
 SCRIPTDIR=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")")
 
-source "${SCRIPTDIR}"/lib/sh/lib_netcons.sh
+source "${SCRIPTDIR}"/../lib/sh/lib_netcons.sh
 # This is coming from netconsole code. Check for it in drivers/net/netconsole.c
 MAX_USERDATA_ITEMS=256
 
diff --git a/tools/testing/selftests/drivers/net/netcons_resume.sh b/tools/testing/selftests/drivers/net/netconsole/netcons_resume.sh
similarity index 98%
rename from tools/testing/selftests/drivers/net/netcons_resume.sh
rename to tools/testing/selftests/drivers/net/netconsole/netcons_resume.sh
index fc5e5e3ad3d4..cb59cf436dd0 100755
--- a/tools/testing/selftests/drivers/net/netcons_resume.sh
+++ b/tools/testing/selftests/drivers/net/netconsole/netcons_resume.sh
@@ -20,7 +20,7 @@ set -euo pipefail
 
 SCRIPTDIR=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")")
 
-source "${SCRIPTDIR}"/lib/sh/lib_netcons.sh
+source "${SCRIPTDIR}"/../lib/sh/lib_netcons.sh
 
 SAVED_SRCMAC="" # to be populated later
 SAVED_DSTMAC="" # to be populated later
diff --git a/tools/testing/selftests/drivers/net/netcons_sysdata.sh b/tools/testing/selftests/drivers/net/netconsole/netcons_sysdata.sh
similarity index 99%
rename from tools/testing/selftests/drivers/net/netcons_sysdata.sh
rename to tools/testing/selftests/drivers/net/netconsole/netcons_sysdata.sh
index baf69031089e..3fb8c4afe3d2 100755
--- a/tools/testing/selftests/drivers/net/netcons_sysdata.sh
+++ b/tools/testing/selftests/drivers/net/netconsole/netcons_sysdata.sh
@@ -18,7 +18,7 @@ set -euo pipefail
 
 SCRIPTDIR=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")")
 
-source "${SCRIPTDIR}"/lib/sh/lib_netcons.sh
+source "${SCRIPTDIR}"/../lib/sh/lib_netcons.sh
 
 # Enable the sysdata cpu_nr feature
 function set_cpu_nr() {
diff --git a/tools/testing/selftests/drivers/net/netcons_torture.sh b/tools/testing/selftests/drivers/net/netconsole/netcons_torture.sh
similarity index 98%
rename from tools/testing/selftests/drivers/net/netcons_torture.sh
rename to tools/testing/selftests/drivers/net/netconsole/netcons_torture.sh
index 2ce9ee3719d1..33a44adb6f8f 100755
--- a/tools/testing/selftests/drivers/net/netcons_torture.sh
+++ b/tools/testing/selftests/drivers/net/netconsole/netcons_torture.sh
@@ -17,7 +17,7 @@ set -euo pipefail
 
 SCRIPTDIR=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")")
 
-source "${SCRIPTDIR}"/lib/sh/lib_netcons.sh
+source "${SCRIPTDIR}"/../lib/sh/lib_netcons.sh
 
 # Number of times the main loop run
 ITERATIONS=${1:-150}

---
base-commit: b00a7b3a612925faa7362f5c61065e3e5f393fff
change-id: 20260122-netcons-selftest-target-b1dd1af7a25a

Best regards,
-- 
Andre Carvalho <asantostc@gmail.com>
Re: [PATCH net-next] netconsole: selftests: Move netconsole selftests to separate target
Posted by Breno Leitao 1 week, 3 days ago
On Sat, Jan 24, 2026 at 06:51:42PM +0000, Andre Carvalho wrote:
> This patch moves netconsole selftests from drivers/net to its own target
> in drivers/net/netconsole.
> 
> This change helps saving some resources from CI since tests in
> drivers/net automatically run against real hardware which are not used
> by netconsole tests as they rely solely on netdevsim.
> 
> lib_netcons.sh is kept under drivers/net/lib since it is also used by
> bonding selftests. Finally, drivers/net config remains unchanged as
> netpoll_basic.py requires netconsole (and does leverage real HW testing).
> 
> Signed-off-by: Andre Carvalho <asantostc@gmail.com>

Reviewed-by: Breno Leitao <leitao@debian.org>

Thanks for the patch!
--breno
Re: [PATCH net-next] netconsole: selftests: Move netconsole selftests to separate target
Posted by Breno Leitao 1 week, 4 days ago
Hello Andre,

On Sat, Jan 24, 2026 at 06:51:42PM +0000, Andre Carvalho wrote:
> This patch moves netconsole selftests from drivers/net to its own target
> in drivers/net/netconsole.
> 
> This change helps saving some resources from CI since tests in
> drivers/net automatically run against real hardware which are not used
> by netconsole tests as they rely solely on netdevsim.
> 
> lib_netcons.sh is kept under drivers/net/lib since it is also used by
> bonding selftests. Finally, drivers/net config remains unchanged as
> netpoll_basic.py requires netconsole (and does leverage real HW testing).
> 
> Signed-off-by: Andre Carvalho <asantostc@gmail.com>

Thanks for the patch. Looking at NIPA, it seems none of the netconsole
test run?

https://netdev.bots.linux.dev/contest.html?pw-n=0&branch=net-next-2026-01-25--06-00
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 92768bceb929..d92927ce87cc 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -18016,7 +18016,7 @@ S:	Maintained
>  F:	Documentation/networking/netconsole.rst
>  F:	drivers/net/netconsole.c
>  F:	tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh
> -F:	tools/testing/selftests/drivers/net/netcons\*
> +F:	tools/testing/selftests/drivers/net/netconsole/*

I don't think you need * here. The following might be enough.

	F:   tools/testing/selftests/drivers/net/netconsole/

> --- a/tools/testing/selftests/drivers/net/Makefile
> +++ b/tools/testing/selftests/drivers/net/Makefile
> @@ -15,13 +15,6 @@ TEST_PROGS := \
>  	hds.py \
>  	napi_id.py \
>  	napi_threaded.py \
> -	netcons_basic.sh \
> -	netcons_cmdline.sh \
> -	netcons_fragmented_msg.sh \
> -	netcons_overflow.sh \
> -	netcons_resume.sh \
> -	netcons_sysdata.sh \
> -	netcons_torture.sh \
>  	netpoll_basic.py \

That is right, I don't think we want to move netpoll_basic.py, which
is uses netconsole to test netpoll, and we want to run it against real
hardware.

Thanks
--breno
Re: [PATCH net-next] netconsole: selftests: Move netconsole selftests to separate target
Posted by Andre Carvalho 1 week, 3 days ago
On Mon, Jan 26, 2026 at 04:10:18AM -0800, Breno Leitao wrote:
> 
> I don't think you need * here. The following might be enough.
> 
> 	F:   tools/testing/selftests/drivers/net/netconsole/
> 

Ack. I wasn't sure which form was preferable as I saw both being used. Will
send a v2 addressing this.

Thanks for the review!

-- 
Andre Carvalho
Re: [PATCH net-next] netconsole: selftests: Move netconsole selftests to separate target
Posted by Jakub Kicinski 1 week, 3 days ago
On Mon, 26 Jan 2026 04:10:18 -0800 Breno Leitao wrote:
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 92768bceb929..d92927ce87cc 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -18016,7 +18016,7 @@ S:	Maintained
> >  F:	Documentation/networking/netconsole.rst
> >  F:	drivers/net/netconsole.c
> >  F:	tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh
> > -F:	tools/testing/selftests/drivers/net/netcons\*
> > +F:	tools/testing/selftests/drivers/net/netconsole/*  
> 
> I don't think you need * here. The following might be enough.
> 
> 	F:   tools/testing/selftests/drivers/net/netconsole/

FWIW I'm expecting v2 that'll address this nit
Re: [PATCH net-next] netconsole: selftests: Move netconsole selftests to separate target
Posted by Jakub Kicinski 1 week, 4 days ago
On Mon, 26 Jan 2026 04:10:18 -0800 Breno Leitao wrote:
> On Sat, Jan 24, 2026 at 06:51:42PM +0000, Andre Carvalho wrote:
> > This patch moves netconsole selftests from drivers/net to its own target
> > in drivers/net/netconsole.
> > 
> > This change helps saving some resources from CI since tests in
> > drivers/net automatically run against real hardware which are not used
> > by netconsole tests as they rely solely on netdevsim.
> > 
> > lib_netcons.sh is kept under drivers/net/lib since it is also used by
> > bonding selftests. Finally, drivers/net config remains unchanged as
> > netpoll_basic.py requires netconsole (and does leverage real HW testing).
> > 
> > Signed-off-by: Andre Carvalho <asantostc@gmail.com>  
> 
> Thanks for the patch. Looking at NIPA, it seems none of the netconsole
> test run?
> 
> https://netdev.bots.linux.dev/contest.html?pw-n=0&branch=net-next-2026-01-25--06-00

Do you mean after the patch? I'll have to manually add it to some VM
config (presumably the SW drv-net one). I'll do it after patch is
merged. (Remind me if I forget? ;))
Re: [PATCH net-next] netconsole: selftests: Move netconsole selftests to separate target
Posted by Breno Leitao 1 week, 3 days ago
On Mon, Jan 26, 2026 at 04:28:00PM -0800, Jakub Kicinski wrote:
> On Mon, 26 Jan 2026 04:10:18 -0800 Breno Leitao wrote:
> >
> > Thanks for the patch. Looking at NIPA, it seems none of the netconsole
> > test run?
> > 
> > https://netdev.bots.linux.dev/contest.html?pw-n=0&branch=net-next-2026-01-25--06-00
> 
> Do you mean after the patch?

Right. I am looking at the patch entry in patchwork and didn't see the
test run.

https://patchwork.kernel.org/project/netdevbpf/patch/20260124-netcons-selftest-target-v1-1-d3937f44c4c2@gmail.com/

> I'll have to manually add it to some VM config (presumably the SW
> drv-net one).

I didn't know that. I thought it would run automatically, sorry.

> I'll do it after patch is merged. (Remind me if I forget? ;))

Let me know if you want us to do it,
--breno