[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240418120628.381fd081@kernel.org>
Date: Thu, 18 Apr 2024 12:06:28 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Willem de Bruijn <willemdebruijn.kernel@...il.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
pabeni@...hat.com, shuah@...nel.org, petrm@...dia.com,
linux-kselftest@...r.kernel.org
Subject: Re: [PATCH net-next v3 7/8] selftests: net: support matching cases
by name prefix
On Thu, 18 Apr 2024 10:26:19 -0400 Willem de Bruijn wrote:
> > -def ksft_run(cases, args=()):
> > +def ksft_run(cases=None, globs=None, case_pfx=None, args=()):
> > + cases = cases or []
> > +
> > + if globs and case_pfx:
> > + for key, value in globs.items():
> > + stats_with_pfx = bool([pfx for pfx in case_pfx if key.startswith(pfx)])
>
> stats -> starts
>
> for the reader, just spell out prefix instead of pfx?
>
> perhaps less pythonic, but just
>
> if key.startswith(prefix) and callable(value):
> cases.append(value)
like this?
diff --git a/tools/testing/selftests/net/lib/py/ksft.py b/tools/testing/selftests/net/lib/py/ksft.py
index fe4025dc5a16..8018bf98a9d2 100644
--- a/tools/testing/selftests/net/lib/py/ksft.py
+++ b/tools/testing/selftests/net/lib/py/ksft.py
@@ -86,9 +86,12 @@ KSFT_RESULT_ALL = True
if globs and case_pfx:
for key, value in globs.items():
- stats_with_pfx = bool([pfx for pfx in case_pfx if key.startswith(pfx)])
- if callable(value) and stats_with_pfx:
- cases.append(value)
+ if not callable(value):
+ continue
+ for prefix in case_pfx:
+ if key.startswith(prefix):
+ cases.append(value)
+ break
totals = {"pass": 0, "fail": 0, "skip": 0, "xfail": 0}
Powered by blists - more mailing lists