Re: [PATCH] lib/atomic64_test.c: convert to use KUnit

From: Michael Ellerman
Date: Thu May 12 2022 - 23:06:23 EST


Daniel Latypov <dlatypov@xxxxxxxxxx> writes:
> The test currently is a bunch of checks (implemented using BUG_ON())
> that can be built into the kernel or as a module.
>
> Convert it to a KUnit test, which can also run in both modes.
> From a user's perspective, this change adds a CONFIG_KUNIT=y dep and
> changes the output format of the test [1]. The test itself is the same.
...

I don't know why I got Cc'ed on this :), but I gave it a quick test anyway.

Seems to work fine on a Power9.
I also flipped some of the conditionals to make sure failure is detected
correctly.

Tested-by: Michael Ellerman <mpe@xxxxxxxxxxxxxx> (powerpc)


> Meta:
> 1. this patch applies on top of the kunit branch,
> https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/?h=kunit
>
> 2. checkpatch complains about aligning with parens, but it wants me to
> indent the `#ifdef CONFIG_X86_64` which seems inappropriate in context.
>
> 3. this file doesn't seem to have a clear maintainer, so I assume this
> conversion is fine to go through the kunit branch.

I think you want to at least Cc the atomic folks:

ATOMIC INFRASTRUCTURE
M: Will Deacon <will@xxxxxxxxxx>
M: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
R: Boqun Feng <boqun.feng@xxxxxxxxx>
R: Mark Rutland <mark.rutland@xxxxxxx>
L: linux-kernel@xxxxxxxxxxxxxxx
S: Maintained


cheers