Re: [PATCH v3 2/5] rust: bitfield: Add KUnit tests for bitfield
From: Yury Norov
Date: Fri May 01 2026 - 13:39:57 EST
On Fri, May 01, 2026 at 03:03:19PM +0900, Alexandre Courbot wrote:
> From: Joel Fernandes <joelagnelf@xxxxxxxxxx>
>
> Add KUNIT tests to make sure the macro is working correctly. The unit
> tests are put behind the new `RUST_KERNEL_BITFIELD_KUNIT_TEST` Kconfig
> option.
>
> Signed-off-by: Joel Fernandes <joelagnelf@xxxxxxxxxx>
> Co-developed-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
> Signed-off-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
> Reviewed-by: Eliot Courtney <ecourtney@xxxxxxxxxx>
> ---
> lib/Kconfig.debug | 12 ++
> rust/kernel/bitfield.rs | 319 ++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 331 insertions(+)
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index 8ff5adcfe1e0..916bf066c016 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -3608,6 +3608,18 @@ config RUST_KERNEL_DOCTESTS
>
> If unsure, say N.
>
> +config RUST_KERNEL_BITFIELD_KUNIT_TEST
Those KUnit tests are all kernel unit tests. Maybe just
RUST_BITFIELD_KUNIT_TEST?
> + bool "KUnit tests for the Rust `bitfield!` macro" if !KUNIT_ALL_TESTS
> + depends on RUST && KUNIT=y
> + default KUNIT_ALL_TESTS
> + help
> + This builds the KUnit tests for the Rust `bitfield!` macro.
> +
> + For more information on KUnit and unit tests in general please refer
> + to the KUnit documentation in Documentation/dev-tools/kunit/.
This sentence travels from config to config, adding no value. Maybe
drop it?
> + If unsure, say N.
> +
Can you build the series on top of my "rust: add Kconfig.test" series,
and add this config to the rust/kernel/Kconfig.test?
It would be better, because the series creates a "Rust KUnit tests"
menu, so all the tests will be in the same place in menuconfig.
Thanks,
Yury