* [PATCH net-next 1/2] net: netconsole: selftests: Change the IP subnet
@ 2024-10-25 16:14 Breno Leitao
2024-10-25 16:14 ` [PATCH net-next 2/2] net: netconsole: selftests: Add userdata validation Breno Leitao
2024-10-25 17:01 ` [PATCH net-next 1/2] net: netconsole: selftests: Change the IP subnet Petr Machata
0 siblings, 2 replies; 7+ messages in thread
From: Breno Leitao @ 2024-10-25 16:14 UTC (permalink / raw)
To: kuba, horms, davem, edumazet, pabeni, matttbe, Andrew Lunn,
Shuah Khan
Cc: thepacketgeek, netdev, linux-kernel, davej, vlad.wing, max,
kernel-team, aehkn, Petr Machata,
open list:KERNEL SELFTEST FRAMEWORK
Use a less populated IP range to run the tests, as suggested by Petr in
Link: https://lore.kernel.org/netdev/87ikvukv3s.fsf@nvidia.com/.
Suggested-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Breno Leitao <leitao@debian.org>
---
tools/testing/selftests/drivers/net/netcons_basic.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/drivers/net/netcons_basic.sh b/tools/testing/selftests/drivers/net/netcons_basic.sh
index 06021b2059b7..4ad1e216c6b0 100755
--- a/tools/testing/selftests/drivers/net/netcons_basic.sh
+++ b/tools/testing/selftests/drivers/net/netcons_basic.sh
@@ -20,9 +20,9 @@ SCRIPTDIR=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")")
# Simple script to test dynamic targets in netconsole
SRCIF="" # to be populated later
-SRCIP=192.168.1.1
+SRCIP=192.168.2.1
DSTIF="" # to be populated later
-DSTIP=192.168.1.2
+DSTIP=192.168.2.2
PORT="6666"
MSG="netconsole selftest"
--
2.43.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 2/2] net: netconsole: selftests: Add userdata validation
2024-10-25 16:14 [PATCH net-next 1/2] net: netconsole: selftests: Change the IP subnet Breno Leitao
@ 2024-10-25 16:14 ` Breno Leitao
2024-10-25 17:01 ` [PATCH net-next 1/2] net: netconsole: selftests: Change the IP subnet Petr Machata
1 sibling, 0 replies; 7+ messages in thread
From: Breno Leitao @ 2024-10-25 16:14 UTC (permalink / raw)
To: kuba, horms, davem, edumazet, pabeni, matttbe, Andrew Lunn,
Shuah Khan
Cc: thepacketgeek, netdev, linux-kernel, davej, vlad.wing, max,
kernel-team, aehkn, open list:KERNEL SELFTEST FRAMEWORK
Extend netcons_basic selftest to verify the userdata functionality by:
1. Creating a test key in the userdata configfs directory
2. Writing a known value to the key
3. Validating the key-value pair appears in the captured network output
This ensures the userdata feature is properly tested during selftests.
Signed-off-by: Breno Leitao <leitao@debian.org>
---
.../selftests/drivers/net/netcons_basic.sh | 29 +++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/tools/testing/selftests/drivers/net/netcons_basic.sh b/tools/testing/selftests/drivers/net/netcons_basic.sh
index 4ad1e216c6b0..d182dcc2a10b 100755
--- a/tools/testing/selftests/drivers/net/netcons_basic.sh
+++ b/tools/testing/selftests/drivers/net/netcons_basic.sh
@@ -26,10 +26,13 @@ DSTIP=192.168.2.2
PORT="6666"
MSG="netconsole selftest"
+USERDATA_KEY="key"
+USERDATA_VALUE="value"
TARGET=$(mktemp -u netcons_XXXXX)
DEFAULT_PRINTK_VALUES=$(cat /proc/sys/kernel/printk)
NETCONS_CONFIGFS="/sys/kernel/config/netconsole"
NETCONS_PATH="${NETCONS_CONFIGFS}"/"${TARGET}"
+KEY_PATH="${NETCONS_PATH}/userdata/${USERDATA_KEY}"
# NAMESPACE will be populated by setup_ns with a random value
NAMESPACE=""
@@ -122,6 +125,8 @@ function cleanup() {
# delete netconsole dynamic reconfiguration
echo 0 > "${NETCONS_PATH}"/enabled
+ # Remove key
+ rmdir "${KEY_PATH}"
# Remove the configfs entry
rmdir "${NETCONS_PATH}"
@@ -136,6 +141,18 @@ function cleanup() {
echo "${DEFAULT_PRINTK_VALUES}" > /proc/sys/kernel/printk
}
+function set_user_data() {
+ if [[ ! -d "${NETCONS_PATH}""/userdata" ]]
+ then
+ echo "Userdata path not available in ${NETCONS_PATH}/userdata"
+ exit "${ksft_skip}"
+ fi
+
+ mkdir -p "${KEY_PATH}"
+ VALUE_PATH="${KEY_PATH}""/value"
+ echo "${USERDATA_VALUE}" > "${VALUE_PATH}"
+}
+
function listen_port_and_save_to() {
local OUTPUT=${1}
# Just wait for 2 seconds
@@ -146,6 +163,10 @@ function listen_port_and_save_to() {
function validate_result() {
local TMPFILENAME="$1"
+ # TMPFILENAME will contain something like:
+ # 6.11.1-0_fbk0_rc13_509_g30d75cea12f7,13,1822,115075213798,-;netconsole selftest: netcons_gtJHM
+ # key=value
+
# Check if the file exists
if [ ! -f "$TMPFILENAME" ]; then
echo "FAIL: File was not generated." >&2
@@ -158,6 +179,12 @@ function validate_result() {
exit "${ksft_fail}"
fi
+ if ! grep -q "${USERDATA_KEY}=${USERDATA_VALUE}" "${TMPFILENAME}"; then
+ echo "FAIL: ${USERDATA_KEY}=${USERDATA_VALUE} not found in ${TMPFILENAME}" >&2
+ cat "${TMPFILENAME}" >&2
+ exit "${ksft_fail}"
+ fi
+
# Delete the file once it is validated, otherwise keep it
# for debugging purposes
rm "${TMPFILENAME}"
@@ -220,6 +247,8 @@ trap cleanup EXIT
set_network
# Create a dynamic target for netconsole
create_dynamic_target
+# Set userdata "key" with the "value" value
+set_user_data
# Listed for netconsole port inside the namespace and destination interface
listen_port_and_save_to "${OUTPUT_FILE}" &
# Wait for socat to start and listen to the port.
--
2.43.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 1/2] net: netconsole: selftests: Change the IP subnet
2024-10-25 16:14 [PATCH net-next 1/2] net: netconsole: selftests: Change the IP subnet Breno Leitao
2024-10-25 16:14 ` [PATCH net-next 2/2] net: netconsole: selftests: Add userdata validation Breno Leitao
@ 2024-10-25 17:01 ` Petr Machata
2024-10-25 17:35 ` Breno Leitao
1 sibling, 1 reply; 7+ messages in thread
From: Petr Machata @ 2024-10-25 17:01 UTC (permalink / raw)
To: Breno Leitao
Cc: kuba, horms, davem, edumazet, pabeni, matttbe, Andrew Lunn,
Shuah Khan, thepacketgeek, netdev, linux-kernel, davej, vlad.wing,
max, kernel-team, aehkn, Petr Machata,
open list:KERNEL SELFTEST FRAMEWORK
Breno Leitao <leitao@debian.org> writes:
> Use a less populated IP range to run the tests, as suggested by Petr in
> Link: https://lore.kernel.org/netdev/87ikvukv3s.fsf@nvidia.com/.
>
> Suggested-by: Petr Machata <petrm@nvidia.com>
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---
> tools/testing/selftests/drivers/net/netcons_basic.sh | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/drivers/net/netcons_basic.sh b/tools/testing/selftests/drivers/net/netcons_basic.sh
> index 06021b2059b7..4ad1e216c6b0 100755
> --- a/tools/testing/selftests/drivers/net/netcons_basic.sh
> +++ b/tools/testing/selftests/drivers/net/netcons_basic.sh
> @@ -20,9 +20,9 @@ SCRIPTDIR=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")")
>
> # Simple script to test dynamic targets in netconsole
> SRCIF="" # to be populated later
> -SRCIP=192.168.1.1
> +SRCIP=192.168.2.1
I mentioned 192.0.2.0/24, which we commonly use in selftests. The range
is meant for examples and documentation, which is not exactly selftests,
but feels like it's not bending the rules too far. And we shouldn't see
the range in the wild.
> DSTIF="" # to be populated later
> -DSTIP=192.168.1.2
> +DSTIP=192.168.2.2
>
> PORT="6666"
> MSG="netconsole selftest"
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 1/2] net: netconsole: selftests: Change the IP subnet
2024-10-25 17:01 ` [PATCH net-next 1/2] net: netconsole: selftests: Change the IP subnet Petr Machata
@ 2024-10-25 17:35 ` Breno Leitao
0 siblings, 0 replies; 7+ messages in thread
From: Breno Leitao @ 2024-10-25 17:35 UTC (permalink / raw)
To: Petr Machata
Cc: kuba, horms, davem, edumazet, pabeni, matttbe, Andrew Lunn,
Shuah Khan, thepacketgeek, netdev, linux-kernel, davej, vlad.wing,
max, kernel-team, aehkn, open list:KERNEL SELFTEST FRAMEWORK
On Fri, Oct 25, 2024 at 07:01:59PM +0200, Petr Machata wrote:
>
> Breno Leitao <leitao@debian.org> writes:
>
> > Use a less populated IP range to run the tests, as suggested by Petr in
> > Link: https://lore.kernel.org/netdev/87ikvukv3s.fsf@nvidia.com/.
> >
> > Suggested-by: Petr Machata <petrm@nvidia.com>
> > Signed-off-by: Breno Leitao <leitao@debian.org>
> > ---
> > tools/testing/selftests/drivers/net/netcons_basic.sh | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/testing/selftests/drivers/net/netcons_basic.sh b/tools/testing/selftests/drivers/net/netcons_basic.sh
> > index 06021b2059b7..4ad1e216c6b0 100755
> > --- a/tools/testing/selftests/drivers/net/netcons_basic.sh
> > +++ b/tools/testing/selftests/drivers/net/netcons_basic.sh
> > @@ -20,9 +20,9 @@ SCRIPTDIR=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")")
> >
> > # Simple script to test dynamic targets in netconsole
> > SRCIF="" # to be populated later
> > -SRCIP=192.168.1.1
> > +SRCIP=192.168.2.1
>
> I mentioned 192.0.2.0/24, which we commonly use in selftests. The range
> is meant for examples and documentation, which is not exactly selftests,
> but feels like it's not bending the rules too far. And we shouldn't see
> the range in the wild.
True, my mistake. I will update it to 192.0.2.1 and 192.0.2.2.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net-next 1/2] net: netconsole: selftests: Change the IP subnet
@ 2024-10-28 15:48 Breno Leitao
2024-10-28 17:57 ` Matthieu Baerts
0 siblings, 1 reply; 7+ messages in thread
From: Breno Leitao @ 2024-10-28 15:48 UTC (permalink / raw)
To: kuba, horms, davem, edumazet, pabeni, matttbe, Andrew Lunn,
Shuah Khan
Cc: thepacketgeek, netdev, linux-kernel, davej, vlad.wing, max,
kernel-team, aehkn, Petr Machata,
open list:KERNEL SELFTEST FRAMEWORK
Use a less populated IP range to run the tests, as suggested by Petr in
Link: https://lore.kernel.org/netdev/87ikvukv3s.fsf@nvidia.com/.
Suggested-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Breno Leitao <leitao@debian.org>
---
tools/testing/selftests/drivers/net/netcons_basic.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/drivers/net/netcons_basic.sh b/tools/testing/selftests/drivers/net/netcons_basic.sh
index 06021b2059b7..4ad1e216c6b0 100755
--- a/tools/testing/selftests/drivers/net/netcons_basic.sh
+++ b/tools/testing/selftests/drivers/net/netcons_basic.sh
@@ -20,9 +20,9 @@ SCRIPTDIR=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")")
# Simple script to test dynamic targets in netconsole
SRCIF="" # to be populated later
-SRCIP=192.168.1.1
+SRCIP=192.168.2.1
DSTIF="" # to be populated later
-DSTIP=192.168.1.2
+DSTIP=192.168.2.2
PORT="6666"
MSG="netconsole selftest"
--
2.43.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 1/2] net: netconsole: selftests: Change the IP subnet
2024-10-28 15:48 Breno Leitao
@ 2024-10-28 17:57 ` Matthieu Baerts
2024-10-29 9:20 ` Breno Leitao
0 siblings, 1 reply; 7+ messages in thread
From: Matthieu Baerts @ 2024-10-28 17:57 UTC (permalink / raw)
To: Breno Leitao, kuba, horms, davem, edumazet, pabeni, Andrew Lunn,
Shuah Khan
Cc: thepacketgeek, netdev, linux-kernel, davej, vlad.wing, max,
kernel-team, aehkn, Petr Machata,
open list:KERNEL SELFTEST FRAMEWORK
Hi Breno,
On 28/10/2024 16:48, Breno Leitao wrote:
> Use a less populated IP range to run the tests, as suggested by Petr in
> Link: https://lore.kernel.org/netdev/87ikvukv3s.fsf@nvidia.com/.
It looks like this is the same version as the one you sent on Friday,
without the modification suggested by Petr:
https://lore.kernel.org/20241025161415.238215-1-leitao@debian.org
I supposed these new patches have been sent by accident, right?
(BTW: it is often better to include a cover letter when there is more
than one patch: some CIs might not take patches sent without it.)
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 1/2] net: netconsole: selftests: Change the IP subnet
2024-10-28 17:57 ` Matthieu Baerts
@ 2024-10-29 9:20 ` Breno Leitao
0 siblings, 0 replies; 7+ messages in thread
From: Breno Leitao @ 2024-10-29 9:20 UTC (permalink / raw)
To: Matthieu Baerts
Cc: kuba, horms, davem, edumazet, pabeni, Andrew Lunn, Shuah Khan,
thepacketgeek, netdev, linux-kernel, davej, vlad.wing, max,
kernel-team, aehkn, Petr Machata,
open list:KERNEL SELFTEST FRAMEWORK
Hello Matthieu,
On Mon, Oct 28, 2024 at 06:57:29PM +0100, Matthieu Baerts wrote:
> Hi Breno,
>
> On 28/10/2024 16:48, Breno Leitao wrote:
> > Use a less populated IP range to run the tests, as suggested by Petr in
> > Link: https://lore.kernel.org/netdev/87ikvukv3s.fsf@nvidia.com/.
>
> It looks like this is the same version as the one you sent on Friday,
> without the modification suggested by Petr:
>
> https://lore.kernel.org/20241025161415.238215-1-leitao@debian.org
>
> I supposed these new patches have been sent by accident, right?
Right. I've resent the v1 instead of the v2. :-|
I've just sent v2 now.
https://lore.kernel.org/all/20241029090030.1793551-1-leitao@debian.org/
Thanks for the heads-up,
--breno
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-10-29 9:20 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-25 16:14 [PATCH net-next 1/2] net: netconsole: selftests: Change the IP subnet Breno Leitao
2024-10-25 16:14 ` [PATCH net-next 2/2] net: netconsole: selftests: Add userdata validation Breno Leitao
2024-10-25 17:01 ` [PATCH net-next 1/2] net: netconsole: selftests: Change the IP subnet Petr Machata
2024-10-25 17:35 ` Breno Leitao
-- strict thread matches above, loose matches on Subject: below --
2024-10-28 15:48 Breno Leitao
2024-10-28 17:57 ` Matthieu Baerts
2024-10-29 9:20 ` Breno Leitao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).