Re: [PATCH v6] lib: add basic KUnit test for lib/math

From: Daniel Latypov
Date: Thu May 16 2024 - 11:17:18 EST


On Thu, May 16, 2024 at 3:19 AM Devarsh Thakkar <devarsht@xxxxxx> wrote:
>
> Hi Daniel, Andy,
>
> On 16/04/21 23:34, Daniel Latypov wrote:
> > Add basic test coverage for files that don't require any config options:
> > * part of math.h (what seem to be the most commonly used macros)
> > * gcd.c
> > * lcm.c
> > * int_sqrt.c
> > * reciprocal_div.c
> > (Ignored int_pow.c since it's a simple textbook algorithm.)
> >
> > These tests aren't particularly interesting, but they
> > * provide short and simple examples of parameterized tests
> > * provide a place to add tests for any new files in this dir
> > * are written so adding new test cases to cover edge cases should be easy
> > * looking at code coverage, we hit all the branches in the .c files
> >
> > Signed-off-by: Daniel Latypov <dlatypov@xxxxxxxxxx>
> > Reviewed-by: David Gow <davidgow@xxxxxxxxxx>
>
> Just checking if something else was pending on this patch-set for this not
> getting merged?
>
> I needed this patch-set for adding tests for new macros I am adding in math.h
> as suggested in this thread [1], so wanted to pull this in my series and add
> changes on top of that for new macros.
>
> Kindly let me know your thoughts on this.

This patch just fell through the cracks for me.
I had (wrongly) inferred that Andy might have had some lingering
reservations about this patch (that it was too contrived, might not be
useful to have tests for stuff like abs(), etc.).

Feel free to pull this into your series.

Looking over the code itself, I think this still looks valid and
stylistically correct with regard to KUnit.
I haven't gone and validated that it still compiles and runs just yet, though.
But if you do run into any problems, let me know and I can help send
you a fixed version.

Thanks for picking this up,
Daniel