[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fd4jjkw6hpkyydg2uk6ys2paa3z3egsmfim3xidjtyyzxeg33n@jjww2sd4xcas>
Date: Mon, 17 Nov 2025 02:35:55 -0800
From: Breno Leitao <leitao@...ian.org>
To: Andre Carvalho <asantostc@...il.com>
Cc: Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Shuah Khan <shuah@...nel.org>,
Simon Horman <horms@...nel.org>, netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org
Subject: Re: [PATCH net-next v4 5/5] selftests: netconsole: validate target
resume
On Sun, Nov 16, 2025 at 05:14:05PM +0000, Andre Carvalho wrote:
> Introduce a new netconsole selftest to validate that netconsole is able
> to resume a deactivated target when the low level interface comes back.
>
> The test setups the network using netdevsim, creates a netconsole target
> and then remove/add netdevsim in order to bring the same interfaces
> back. Afterwards, the test validates that the target works as expected.
>
> Targets are created via cmdline parameters to the module to ensure that
> we are able to resume targets that were bound by mac and interface name.
>
> Signed-off-by: Andre Carvalho <asantostc@...il.com>
> ---
> tools/testing/selftests/drivers/net/Makefile | 1 +
> .../selftests/drivers/net/lib/sh/lib_netcons.sh | 35 ++++++--
> .../selftests/drivers/net/netcons_resume.sh | 97 ++++++++++++++++++++++
> 3 files changed, 128 insertions(+), 5 deletions(-)
>
> diff --git a/tools/testing/selftests/drivers/net/Makefile b/tools/testing/selftests/drivers/net/Makefile
> index 33f4816216ec..7dc9e5b23d5b 100644
> --- a/tools/testing/selftests/drivers/net/Makefile
> +++ b/tools/testing/selftests/drivers/net/Makefile
> @@ -17,6 +17,7 @@ TEST_PROGS := \
> netcons_cmdline.sh \
> netcons_fragmented_msg.sh \
> netcons_overflow.sh \
> + netcons_resume.sh \
> netcons_sysdata.sh \
> netcons_torture.sh \
> netpoll_basic.py \
> diff --git a/tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh b/tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh
> index 87f89fd92f8c..6157db660067 100644
> --- a/tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh
> +++ b/tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh
> @@ -203,19 +203,21 @@ function do_cleanup() {
> function cleanup_netcons() {
> # delete netconsole dynamic reconfiguration
> # do not fail if the target is already disabled
> - if [[ ! -d "${NETCONS_PATH}" ]]
> + local TARGET_PATH=${1:-${NETCONS_PATH}}
> +
> + if [[ ! -d "${TARGET_PATH}" ]]
> then
> # in some cases this is called before netcons path is created
> return
> fi
> - if [[ $(cat "${NETCONS_PATH}"/enabled) != 0 ]]
> + if [[ $(cat "${TARGET_PATH}"/enabled) != 0 ]]
> then
> - echo 0 > "${NETCONS_PATH}"/enabled || true
> + echo 0 > "${TARGET_PATH}"/enabled || true
> fi
> # Remove all the keys that got created during the selftest
> - find "${NETCONS_PATH}/userdata/" -mindepth 1 -type d -delete
> + find "${TARGET_PATH}/userdata/" -mindepth 1 -type d -delete
> # Remove the configfs entry
> - rmdir "${NETCONS_PATH}"
> + rmdir "${TARGET_PATH}"
> }
>
> function cleanup() {
> @@ -377,6 +379,29 @@ function check_netconsole_module() {
> fi
> }
>
> +function wait_target_state() {
> + local TARGET=${1}
> + local STATE=${2}
> + local TARGET_PATH="${NETCONS_CONFIGFS}"/"${TARGET}"
> + local ENABLED=0
> +
> + if [ "${STATE}" == "enabled" ]
> + then
> + local ENABLED=1
ENABLED is already marked as local above. "local" here is unnecessary.
Other than that, and with the "trap" fix, it might be in good shape.
Thanks for this selftest.
--breno
--
pw-bot: cr
Powered by blists - more mailing lists