On Wed, Aug 12, 2026 at 05:51:21PM +0900, Eliot Courtney wrote:
> Since commit c652dc44192d ("rust: kunit: allow `cfg` on `test`s"),
> we no longer need this workaround.
> 
> Reviewed-by: Alice Ryhl <[email protected]>
> Signed-off-by: Eliot Courtney <[email protected]>

Reviewed-by: Yury Norov <[email protected]>

> ---
>  rust/kernel/bitmap.rs | 25 +++++++++++--------------
>  1 file changed, 11 insertions(+), 14 deletions(-)
> 
> diff --git a/rust/kernel/bitmap.rs b/rust/kernel/bitmap.rs
> index b27e0ec80d64..a43bfe0ec3dc 100644
> --- a/rust/kernel/bitmap.rs
> +++ b/rust/kernel/bitmap.rs
> @@ -572,24 +572,21 @@ fn bitmap_set_clear_find() -> Result<(), AllocError> {
>      }
>  
>      #[test]
> +    #[cfg(not(CONFIG_RUST_BITMAP_HARDENED))]
>      fn owned_bitmap_out_of_bounds() -> Result<(), AllocError> {
> -        // TODO: Kunit #[test]s do not support `cfg` yet,
> -        // so we add it here in the body.
> -        #[cfg(not(CONFIG_RUST_BITMAP_HARDENED))]
> -        {
> -            let mut b = BitmapVec::new(128, GFP_KERNEL)?;
> -            b.set_bit(2048);
> -            b.set_bit_atomic(2048);
> -            b.clear_bit(2048);
> -            b.clear_bit_atomic(2048);
> -            assert_eq!(None, b.next_bit(2048));
> -            assert_eq!(None, b.next_zero_bit(2048));
> -            assert_eq!(None, b.last_bit());
> -        }
> +        let mut b = BitmapVec::new(128, GFP_KERNEL)?;
> +
> +        b.set_bit(2048);
> +        b.set_bit_atomic(2048);
> +        b.clear_bit(2048);
> +        b.clear_bit_atomic(2048);
> +        assert_eq!(None, b.next_bit(2048));
> +        assert_eq!(None, b.next_zero_bit(2048));
> +        assert_eq!(None, b.last_bit());
>          Ok(())
>      }
>  
> -    // TODO: uncomment once kunit supports [should_panic] and `cfg`.
> +    // TODO: uncomment once kunit supports `#[should_panic]`.
>      // #[cfg(CONFIG_RUST_BITMAP_HARDENED)]
>      // #[test]
>      // #[should_panic]
> 
> -- 
> 2.55.0

Reply via email to