lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6621760535c64_f818029464@willemb.c.googlers.com.notmuch>
Date: Thu, 18 Apr 2024 15:35:33 -0400
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Jakub Kicinski <kuba@...nel.org>, 
 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

Jakub Kicinski wrote:
> 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

Yes. I would not have brought this up if it wasn't for the typo as
well. Python developers perhaps find this less pythonic, but I do find
it easier to follow.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ