mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hangbin Liu <hangbin.liu@linux.dev>
To: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>, Shuah Khan <shuah@kernel.org>,
	David Ahern <dsahern@kernel.org>,
	Ido Schimmel <idosch@nvidia.com>,
	Andrea Mayer <andrea.mayer@uniroma2.it>
Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org, Hangbin Liu <liuhangbin@kylinos.cn>
Subject: Re: [PATCH net-next v2] selftests: net: move log_test to lib file and remove duplicate code
Date: Fri, 11 Sep 2026 11:31:55 +0800	[thread overview]
Message-ID: <aqN2K7rAm-S6QI86@fedora> (raw)
In-Reply-To: <20260831-self_log_test-v2-1-eda2e8490cf9@kylinos.cn>

On Mon, Aug 31, 2026 at 05:21:28PM +0800, Hangbin Liu wrote:
> From: Hangbin Liu <liuhangbin@kylinos.cn>
> 
> Many test scripts under tools/testing/selftests/net/ each define their own
> log_test() function with near-identical logic for comparing a return
> code against an expected value and printing OK/FAIL. Add a shared
> log_test_expected() to lib.sh and replace each local definition with a
> thin wrapper that delegates to it.
> 
> The function is named log_test_expected() rather than log_test() because
> lib.sh already exports log_test() with a different signature used by
> the forwarding tests.
> 
> Two tests required special handling:
> 
> - icmp_redirect.sh passed a fourth "xfail" argument to log_test(). The
>   underlying issue has been fixed and the argument is always absent now,
>   so it is simply dropped.
> 
> - fib_nexthops.sh checked for ksft_skip (exit code 4) inside log_test(),
>   but no test in the file produces that code. The check is removed,
>   callers that need to report a skip should use log_test_skip() instead.
>   Two callers compared against exit code 2 are left as-is since code 2
>   correctly counts as a failure in the previous log_test().
> 
> Signed-off-by: Hangbin Liu <liuhangbin@kylinos.cn>
> ---
> Changes in v2:
> - Remove skip/xfail checking in lib.sh, as any command can exits with 2 or 4 (sashiko)
> - Remove nskip counter in fib_nexthops.sh
> - Link to v1: https://lore.kernel.org/r/20260813-self_log_test-v1-1-f88b1107842e@kylinos.cn
> ---
>  tools/testing/selftests/net/drop_monitor_tests.sh  | 13 +------
>  tools/testing/selftests/net/fcnal-test.sh          | 29 +-------------
>  tools/testing/selftests/net/fdb_flush.sh           | 35 +----------------
>  tools/testing/selftests/net/fib-onlink-tests.sh    | 18 +--------
>  .../selftests/net/fib_nexthop_multiprefix.sh       | 21 +----------
>  tools/testing/selftests/net/fib_nexthop_nongw.sh   | 21 +----------
>  tools/testing/selftests/net/fib_nexthops.sh        | 44 ++--------------------
>  tools/testing/selftests/net/fib_rule_tests.sh      | 19 +---------
>  tools/testing/selftests/net/fib_tests.sh           | 26 +------------
>  tools/testing/selftests/net/gre_gso.sh             | 26 +------------
>  tools/testing/selftests/net/icmp_redirect.sh       | 28 ++------------
>  tools/testing/selftests/net/l2tp.sh                | 19 +---------
>  tools/testing/selftests/net/lib.sh                 | 31 +++++++++++++++
>  .../selftests/net/ndisc_unsolicited_na_test.sh     | 26 +------------
>  .../selftests/net/srv6_encap_lookup_l3vpn_test.sh  | 19 +---------
>  .../selftests/net/srv6_end_dt46_l3vpn_test.sh      | 19 +---------
>  .../selftests/net/srv6_end_dt4_l3vpn_test.sh       | 19 +---------
>  .../selftests/net/srv6_end_dt6_l3vpn_test.sh       | 19 +---------
>  .../selftests/net/srv6_end_dx4_netfilter_test.sh   | 23 ++---------
>  .../selftests/net/srv6_end_dx6_netfilter_test.sh   | 23 ++---------
>  .../testing/selftests/net/srv6_end_flavors_test.sh | 23 ++---------
>  .../selftests/net/srv6_end_next_csid_l3vpn_test.sh | 19 +---------
>  .../net/srv6_end_x_next_csid_l3vpn_test.sh         | 19 +---------
>  .../selftests/net/srv6_hencap_red_l3vpn_test.sh    | 19 +---------
>  .../selftests/net/srv6_hl2encap_red_l2vpn_test.sh  | 19 +---------
>  .../selftests/net/test_bridge_backup_port.sh       | 32 +---------------
>  .../selftests/net/test_bridge_neigh_suppress.sh    | 33 +---------------
>  tools/testing/selftests/net/test_vxlan_mdb.sh      | 32 +---------------
>  .../selftests/net/test_vxlan_nolocalbypass.sh      | 32 +---------------
>  .../selftests/net/test_vxlan_vnifiltering.sh       | 26 +------------
>  tools/testing/selftests/net/vrf-xfrm-tests.sh      | 19 +---------
>  tools/testing/selftests/net/vrf_route_leaking.sh   | 19 +---------
>  .../testing/selftests/net/vrf_strict_mode_test.sh  | 19 +---------
>  33 files changed, 73 insertions(+), 716 deletions(-)

Hi everyone,

This patch is a bit too long for review, and maybe cause conflicts for
stable backports. I plan to split it into small frags. But there are 2
ways to split it.

1. Split based on the test name. e.g. srv6 part, fib part, test_* part, and
   others.
2. Split based on the changes. e.g. group the tests that using exactly same
   log_test functions into one patch.

Does anyone has any suggestion?

Thanks
Hangbin

  parent reply	other threads:[~2026-09-11  3:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31  9:21 Hangbin Liu
2026-08-31 15:03 ` Jakub Kicinski
2026-09-01  6:26   ` Hangbin Liu
2026-09-11  3:31 ` Hangbin Liu [this message]
2026-09-11 23:08   ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aqN2K7rAm-S6QI86@fedora \
    --to=hangbin.liu@linux.dev \
    --cc=andrea.mayer@uniroma2.it \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=liuhangbin@kylinos.cn \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®