netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Machata <petrm@nvidia.com>
To: Daniel Zahka <daniel.zahka@gmail.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	Shuah Khan <shuah@kernel.org>,
	Willem de Bruijn <willemb@google.com>,
	Breno Leitao <leitao@debian.org>, Petr Machata <petrm@nvidia.com>,
	Yuyang Huang <yuyanghuang@google.com>,
	Xiao Liang <shaw.leon@gmail.com>,
	Carolina Jubran <cjubran@nvidia.com>,
	Donald Hunter <donald.hunter@gmail.com>, <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next 2/9] selftests: net: add skip all feature to ksft_run()
Date: Thu, 25 Sep 2025 18:09:33 +0200	[thread overview]
Message-ID: <87jz1mwksz.fsf@nvidia.com> (raw)
In-Reply-To: <20250924194959.2845473-3-daniel.zahka@gmail.com>


Daniel Zahka <daniel.zahka@gmail.com> writes:

> When there is an entire test suite where each test case depends upon
> some feature, e.g., psp, it is easier to state the least common
> denominator of dpendencies up front, rather than doing:
>
> cfg.require_psp()
>
> at the start of each test.
>
> Signed-off-by: Daniel Zahka <daniel.zahka@gmail.com>
> ---
>  tools/testing/selftests/net/lib/py/ksft.py | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/net/lib/py/ksft.py b/tools/testing/selftests/net/lib/py/ksft.py
> index 8e35ed12ed9e..375020d3edf2 100644
> --- a/tools/testing/selftests/net/lib/py/ksft.py
> +++ b/tools/testing/selftests/net/lib/py/ksft.py
> @@ -210,7 +210,7 @@ def _ksft_intr(signum, frame):
>          ksft_pr(f"Ignoring SIGTERM (cnt: {term_cnt}), already exiting...")
>  
>  
> -def ksft_run(cases=None, globs=None, case_pfx=None, args=()):
> +def ksft_run(cases=None, globs=None, case_pfx=None, args=(), skip_all=None):
>      cases = cases or []
>  
>      if globs and case_pfx:
> @@ -241,6 +241,8 @@ def ksft_run(cases=None, globs=None, case_pfx=None, args=()):
>          cnt_key = ""
>  
>          try:
> +            if skip_all:
> +                raise KsftSkipEx()
>              case(*args)
>          except KsftSkipEx as e:
>              comment = "SKIP " + str(e)

Personally I'm not very fond of this. Calling a run helper just to have
it skip all tests... eh, wouldn't it make more sense to just not call
the function at all then? If all tests have PSP as prereq, just have the
test say so and bail out early?

Topic-specific tests are pretty common, so it's not nonsense to have a
facility that supports that. But this API just seems wrong to me. Run
these tests, except don't run them, just show they are all skipped.

  reply	other threads:[~2025-09-25 16:38 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-24 19:49 [PATCH net-next 0/9] psp: add a kselftest suite and netdevsim implementation Daniel Zahka
2025-09-24 19:49 ` [PATCH net-next 1/9] netdevsim: a basic test PSP implementation Daniel Zahka
2025-09-25  0:12   ` Jakub Kicinski
2025-09-25  6:48   ` kernel test robot
2025-09-26 15:30   ` Simon Horman
2025-09-26 15:35   ` Simon Horman
2025-09-24 19:49 ` [PATCH net-next 2/9] selftests: net: add skip all feature to ksft_run() Daniel Zahka
2025-09-25 16:09   ` Petr Machata [this message]
2025-09-25 17:04     ` Daniel Zahka
2025-09-26  2:18     ` Jakub Kicinski
2025-09-24 19:49 ` [PATCH net-next 3/9] selftests: drv-net: base device access API test Daniel Zahka
2025-09-25  0:13   ` Jakub Kicinski
2025-09-24 19:49 ` [PATCH net-next 4/9] selftests: drv-net: add PSP responder Daniel Zahka
2025-09-24 19:49 ` [PATCH net-next 5/9] selftests: drv-net: psp: add basic data transfer and key rotation tests Daniel Zahka
2025-09-26  9:15   ` Petr Machata
2025-09-24 19:49 ` [PATCH net-next 6/9] selftests: drv-net: psp: add association tests Daniel Zahka
2025-09-24 19:49 ` [PATCH net-next 7/9] selftests: drv-net: psp: add connection breaking tests Daniel Zahka
2025-09-24 19:49 ` [PATCH net-next 8/9] selftests: drv-net: psp: add test for auto-adjusting TCP MSS Daniel Zahka
2025-09-24 19:49 ` [PATCH net-next 9/9] selftests: drv-net: psp: add tests for destroying devices Daniel Zahka

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=87jz1mwksz.fsf@nvidia.com \
    --to=petrm@nvidia.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=cjubran@nvidia.com \
    --cc=daniel.zahka@gmail.com \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=leitao@debian.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shaw.leon@gmail.com \
    --cc=shuah@kernel.org \
    --cc=willemb@google.com \
    --cc=yuyanghuang@google.com \
    /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;
as well as URLs for NNTP newsgroup(s).