Re: [PATCH 0/7] Rust KUnit `#[test]` support improvements

Miguel Ojeda
2025-05-27T00:11:07Z

On Fri, May 2, 2025 at 11:51 PM Miguel Ojeda <ojeda@kernel.org> wrote:
>
> Improvements that build on top of the very basic `#[test]` support merged in
> v6.15.
>
> They are fairly minimal changes, but they allow us to map `assert*!`s back to
> KUnit, plus to add support for test functions that return `Result`s.
>
> In essence, they get our `#[test]`s essentially on par with the documentation
> tests.
>
> I also took the chance to convert some host `#[test]`s we had to KUnit in order
> to showcase the feature.
>
> Finally, I added documentation that was lacking from the original submission.
>
> I hope this helps.

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

[ Used the `cfg_attr` from the TODO comment and clarified its comment
now that the stabilization is in beta and thus quite likely stable
in Rust 1.88.0. Simplified the `new_body` code by introducing a new
variable. Added `#[allow(clippy::incompatible_msrv)]`. - Miguel ]

[ Used `::kernel` for paths. - Miguel ]

[ Split from the next commit as suggested by Tamir. - Miguel ]

[ Split the `CString` simplification into a new commit. - Miguel ]

Cheers,
Miguel