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]
Date:   Tue, 28 Sep 2021 19:12:25 -0700
From:   Daniel Latypov <dlatypov@...gle.com>
To:     David Gow <davidgow@...gle.com>
Cc:     Brendan Higgins <brendanhiggins@...gle.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        KUnit Development <kunit-dev@...glegroups.com>,
        "open list:KERNEL SELFTEST FRAMEWORK" 
        <linux-kselftest@...r.kernel.org>,
        Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH] kunit: tool: misc fixes (unused vars, imports, leaked files)

On Tue, Sep 28, 2021 at 5:34 PM 'David Gow' via KUnit Development
<kunit-dev@...glegroups.com> wrote:
>
> On Wed, Sep 29, 2021 at 6:11 AM Daniel Latypov <dlatypov@...gle.com> wrote:
> >
> > Drop some variables in unit tests that were unused and/or add assertions
> > based on them.
> >
> > For ExitStack, it was imported, but the `es` variable wasn't used so it
> > didn't do anything, and we were leaking the file objects.
> > Refactor it to just use nested `with` statements to properly close them.
> >
> > And drop the direct use of .close() on file objects in the kunit tool
> > unit test, as these can be leaked if test assertions fail.
>
> To clarify for a python novice: this is referring to using "with" so
> that the file isn't leaked if the assertion fails, rather than
> suggesting that leaks are okay for failing tests, right?

Correct.
Ah, I see how it can be misread now.

But on that note, it's probably fine to leak the files as CPython
should close the file object during GC.
And tests failing should make those file objects go out of scope immediately.

>
> > Signed-off-by: Daniel Latypov <dlatypov@...gle.com>
> > ---
>
> These all seem sensible to me. Thanks for cleaning this up!
>
> Reviewed-by: David Gow <davidgow@...gle.com>
>
> -- David
>
> --
> You received this message because you are subscribed to the Google Groups "KUnit Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to kunit-dev+unsubscribe@...glegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/kunit-dev/CABVgOS%3D0K78N%2BKMK3km5TKVDD9L8AMRpNCfvihCqU2h3U-oE-w%40mail.gmail.com.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ