Re: [PATCH v6 1/2] rust: allocator: add KUnit tests for alignment guarantees
From: Miguel Ojeda
Date: Wed Jul 30 2025 - 05:17:33 EST
On Wed, Jul 30, 2025 at 5:37 AM Hui Zhu <hui.zhu@xxxxxxxxx> wrote:
>
> +#[macros::kunit_tests(rust_allocator_kunit)]
Is there any reason for the `_kunit` suffix? If not, then we should
avoid suffixing `_kunit` to every suite name.
I see we already have `rust_kernel_kunit`, but that one is because it
is the KUnit file itself.
There is also `rust_kvec_kunit`, but we should clean that one up.
> + fn test_alignment() -> Result<()> {
`-> Result` since the prelude is available.
> + fn alignment_valid(&self, align: usize) -> bool {
We typically prefix these with `is_`.
I would also call it `is_aligned_to`, to match the upstream Rust one,
which we could perhaps use if it becomes stable.
Cheers,
Miguel