[PATCH 0/3] rust: add Kconfig.test

Yury Norov posted 3 patches 2 months ago
Documentation/rust/testing.rst       |  5 ++-
init/Kconfig                         |  2 +
rust/kernel/Kconfig.test             | 76 ++++++++++++++++++++++++++++
rust/kernel/alloc/allocator.rs       |  1 +
rust/kernel/alloc/kvec.rs            |  1 +
rust/kernel/bitmap.rs                |  5 +--
rust/kernel/kunit.rs                 |  1 +
rust/kernel/str.rs                   |  1 +
rust/kernel/sync/atomic/predefine.rs |  5 +--
9 files changed, 79 insertions(+), 7 deletions(-)
create mode 100644 rust/kernel/Kconfig.test
[PATCH 0/3] rust: add Kconfig.test
Posted by Yury Norov 2 months ago
There are 6 individual Rust KUnit tests. All the tests are compiled
unconditionally now, which adds ~200 kB to the kernel image on my
x86_64 buld. As Rust matures, this bloating will inevitably grow.

Add Kconfig.test, which provides a RUST_KUNIT_TESTS menu, and all
individual tests under it.

Yury Norov (3):
  rust: tests: drop 'use crate' in bitmap and atomic KUnit tests
  rust: testing: add Kconfig for KUnit test
  Documentation: rust: testing: add Kconfig guidance

 Documentation/rust/testing.rst       |  5 ++-
 init/Kconfig                         |  2 +
 rust/kernel/Kconfig.test             | 76 ++++++++++++++++++++++++++++
 rust/kernel/alloc/allocator.rs       |  1 +
 rust/kernel/alloc/kvec.rs            |  1 +
 rust/kernel/bitmap.rs                |  5 +--
 rust/kernel/kunit.rs                 |  1 +
 rust/kernel/str.rs                   |  1 +
 rust/kernel/sync/atomic/predefine.rs |  5 +--
 9 files changed, 79 insertions(+), 7 deletions(-)
 create mode 100644 rust/kernel/Kconfig.test

-- 
2.51.0
Re: [PATCH 0/3] rust: add Kconfig.test
Posted by Miguel Ojeda 1 week ago
On Fri, Apr 17, 2026 at 5:15 AM Yury Norov <ynorov@nvidia.com> wrote:
>
> There are 6 individual Rust KUnit tests. All the tests are compiled
> unconditionally now, which adds ~200 kB to the kernel image on my
> x86_64 buld. As Rust matures, this bloating will inevitably grow.
>
> Add Kconfig.test, which provides a RUST_KUNIT_TESTS menu, and all
> individual tests under it.

Applied to `rust-next` -- thanks everyone!

    [ Fixed capitalization. Used singular for "API" for consistency.
      Reworded to clarify these are suites and that there exists
      the doctests one (which is the biggest at the moment by
      far). - Miguel ]

    [ Fixed the paragraph by moving the new sentence above. Added gate
      in the other example as well. Applied proper formatting. Reworded
      slightly. - Miguel ]

Cheers,
Miguel
Re: [PATCH 0/3] rust: add Kconfig.test
Posted by Gary Guo 1 month, 4 weeks ago
On Fri Apr 17, 2026 at 4:15 AM BST, Yury Norov wrote:
> There are 6 individual Rust KUnit tests. All the tests are compiled
> unconditionally now, which adds ~200 kB to the kernel image on my
> x86_64 buld. As Rust matures, this bloating will inevitably grow.
>
> Add Kconfig.test, which provides a RUST_KUNIT_TESTS menu, and all
> individual tests under it.
>
> Yury Norov (3):
>   rust: tests: drop 'use crate' in bitmap and atomic KUnit tests
>   rust: testing: add Kconfig for KUnit test
>   Documentation: rust: testing: add Kconfig guidance

Acked-by: Gary Guo <gary@garyguo.net>

>
>  Documentation/rust/testing.rst       |  5 ++-
>  init/Kconfig                         |  2 +
>  rust/kernel/Kconfig.test             | 76 ++++++++++++++++++++++++++++
>  rust/kernel/alloc/allocator.rs       |  1 +
>  rust/kernel/alloc/kvec.rs            |  1 +
>  rust/kernel/bitmap.rs                |  5 +--
>  rust/kernel/kunit.rs                 |  1 +
>  rust/kernel/str.rs                   |  1 +
>  rust/kernel/sync/atomic/predefine.rs |  5 +--
>  9 files changed, 79 insertions(+), 7 deletions(-)
>  create mode 100644 rust/kernel/Kconfig.test