[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9f8487ee-be04-4198-9fae-042facbf0883@kernel.org>
Date: Fri, 14 Nov 2025 19:00:02 +0100
From: Matthieu Baerts <matttbe@...nel.org>
To: Hangbin Liu <liuhangbin@...il.com>, netdev@...r.kernel.org
Cc: Donald Hunter <donald.hunter@...il.com>, Jakub Kicinski
<kuba@...nel.org>, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
Simon Horman <horms@...nel.org>, Jan Stancek <jstancek@...hat.com>,
Asbjørn Sloth Tønnesen <ast@...erby.net>,
Stanislav Fomichev <sdf@...ichev.me>, Ido Schimmel <idosch@...dia.com>,
Guillaume Nault <gnault@...hat.com>, Sabrina Dubroca <sd@...asysnail.net>,
Petr Machata <petrm@...dia.com>
Subject: Re: [PATCHv4 net-next 3/3] tools: ynl: add YNL test framework
Hi Hangbin,
On 14/11/2025 04:46, Hangbin Liu wrote:
> Add a test framework for YAML Netlink (YNL) tools, covering both CLI and
> ethtool functionality. The framework includes:
>
> 1) cli: family listing, netdev, ethtool, rt-* families, and nlctrl
> operations
> 2) ethtool: device info, statistics, ring/coalesce/pause parameters, and
> feature gettings
>
> The current YNL syntax is a bit obscure, and end users may not always know
> how to use it. This test framework provides usage examples and also serves
> as a regression test to catch potential breakages caused by future changes.
Thank you for the new version!
I have two minor comments, up to you to fix that or not.
(...)
> diff --git a/tools/net/ynl/tests/test_ynl_cli.sh b/tools/net/ynl/tests/test_ynl_cli.sh
> new file mode 100755
> index 000000000000..f40eecbb9701
> --- /dev/null
> +++ b/tools/net/ynl/tests/test_ynl_cli.sh
> @@ -0,0 +1,309 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Test YNL CLI functionality
> +
> +# Load KTAP test helpers
> +KSELFTEST_KTAP_HELPERS="$(dirname "$(realpath "$0")")/../../../testing/selftests/kselftest/ktap_helpers.sh"
> +# shellcheck disable=SC1090
nit: maybe you can use this instead?
# shellcheck source=../../../testing/selftests/kselftest/ktap_helpers.sh
(If not, it might be good to always document why something is disabled
by adding a comment on the same line or before.)
(Same for the other test.)
(...)
> +ktap_print_header
> +ktap_set_plan 9
I think you should print the plan after the setup, to avoid this in case
of errors during the setup:
TAP version 13
1..9
1..0 # SKIP (...)
<exit 4>
Note that it might be interesting to add a dedicated variable for the
tests counter that you increment after having declared each test, just
not to forget modifying the plan when a new test is added, e.g.
TESTS_NO=0
(...)
cli_list_families() {
(...)
}
TESTS_NO=$((TESTS_NO + 1))
(...)
# Run all tests
ktap_set_plan "${TESTS_NO}"
cli_list_families
(...)
(Same for the other test.)
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
Powered by blists - more mailing lists