[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGS_qxr9RvjKLRyq3Pb1RqYdLAaNdhhRgSN_R2EiU_bj8fnjYg@mail.gmail.com>
Date: Tue, 25 May 2021 15:03:17 -0700
From: Daniel Latypov <dlatypov@...gle.com>
To: Trent Piepho <tpiepho@...il.com>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
andy@...nel.org, Andrew Morton <akpm@...ux-foundation.org>,
Oskar Schirmer <oskar@...ra.com>
Subject: Re: [PATCH v2 2/2] lib/math/rational: Add Kunit test cases
On Tue, May 25, 2021 at 2:09 PM Trent Piepho <tpiepho@...il.com> wrote:
>
> On Tue, May 25, 2021 at 10:34 AM Daniel Latypov <dlatypov@...gle.com> wrote:
> > On Tue, May 25, 2021 at 7:43 AM Trent Piepho <tpiepho@...il.com> wrote:
> > > Adds a number of test cases that cover a range of possible code paths.
> > >
> > > Signed-off-by: Trent Piepho <tpiepho@...il.com>
> >
> > Reviewed-by: Daniel Latypov <dlatypov@...gle.com>
> >
> > Looks really good to me, just two nits.
> >
> > Tangent:
> > I didn't check to see that this covers all the interesting cases, but
> > it seems like it does.
> > If you want, you can try generating a code coverage report to double check.
> > Instructions for doing so can be found in
> > https://lore.kernel.org/linux-kselftest/20210414222256.1280532-1-dlatypov@google.com/
> > I would have done that and included the #s in this email, but my
> > workplace decided to subtly break my workstation in some way and I
> > haven't gotten around to root causing...
>
> I installed a gcc 6.4 toolchain and changed the uml_abort() call to
> exit(), coverage was generated, but still truncated and incorrectly
> near 0%. So what I did was crash after running all the test cases I
> cared about by dividing by zero and then coverage data was produced
> correctly. It's 100% by lines. But I think both possibilities when
> the largest semiconvergent is exactly half the previous convergent
> aren't tested.
Yeah, it's finicky.
Hopefully Brendan's change to cleanly shutdown the kernel at the end
of the tests might make it a bit more robust (still probably requires
gcc-6).
Thanks for running it!
It's nice to know we have 100% (line) coverage.
>
> > > lib/math/rational-test.c | 56 ++++++++++++++++++++++++++++++++++++++++
> >
> > Ah, sorry, I forgot to mention this in the previous email.
> > If you look at kunit/style.rst docs, you'll see the documentation now
> > states a preference for the name of this file to be one of
> > {rational_test.c, rational_kunit.c}
>
> Before I chose a name, I checked every file with kunit tests cases,
> and *-test was the most common naming pattern, including the sample
> case. I would be nice if changing the docs to say something is a
> standard also updated the code to make that reality.
Yeah, it's frustrating...
Andy sent out some changes renaming a lot of the files, but we've not
managed to get everything up to date.
Powered by blists - more mailing lists