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: <87h6g7f1p7.fsf@nvidia.com>
Date: Fri, 12 Apr 2024 09:45:40 +0200
From: Petr Machata <petrm@...dia.com>
To: Jakub Kicinski <kuba@...nel.org>
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 3/6] selftests: net: print report check
 location in python tests


Jakub Kicinski <kuba@...nel.org> writes:

> Developing Python tests is a bit annoying because when test fails
> we only print the fail message and no info about which exact check
> led to it. Print the location (the first line of this example is new):
>
>   # At /root/ksft-net-drv/./net/nl_netdev.py line 38:
>   # Check failed 0 != 10
>   not ok 3 nl_netdev.page_pool_check
>
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>

Reviewed-by: Petr Machata <petrm@...dia.com>

> +def _fail(*args):
> +    global KSFT_RESULT
> +    KSFT_RESULT = False
> +
> +    frame = inspect.stack()[2]
> +    ksft_pr("At " + frame.filename + " line " + str(frame.lineno) + ":")
> +    ksft_pr(" ".join([str(a) for a in args]))

I think this could have just been ksft_pr(*args) like before, but
whatever.

> +
>  def ksft_eq(a, b, comment=""):
>      global KSFT_RESULT
>      if a != b:
> -        KSFT_RESULT = False
> -        ksft_pr("Check failed", a, "!=", b, comment)
> +        _fail("Check failed", a, "!=", b, comment)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ