[PATCH v8 07/10] lib: add basic KUnit test for lib/math

Andy Shevchenko andriy.shevchenko at linux.intel.com
Fri May 17 20:14:27 UTC 2024


On Fri, May 17, 2024 at 11:06:07PM +0530, Devarsh Thakkar wrote:
> From: Daniel Latypov <dlatypov at google.com>
> 
> 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

...

> [devarsht: Rebase to 6.9 and change license to GPL]

I'm not sure that you may change license. It needs the author's confirmation.

> ---
> Changes since v6:
> * Rebase to linux-next, change license to GPL as suggested by checkpatch.

Note, checkpatch.pl is not false positives free. Be careful
with what it suggests.

> +#include <kunit/test.h>
> +#include <linux/gcd.h>

> +#include <linux/kernel.h>

Do you know why this header is included?

> +#include <linux/lcm.h>

+ math.h // obviously
+ module.h

> +#include <linux/reciprocal_div.h>

+ types.h

...

Other than above, LGTM.

-- 
With Best Regards,
Andy Shevchenko




More information about the dri-devel mailing list