summaryrefslogtreecommitdiff
path: root/rust/kernel
diff options
context:
space:
mode:
authorEliot Courtney <ecourtney@nvidia.com>2026-09-30 11:42:50 +0900
committerMiguel Ojeda <ojeda@kernel.org>2026-10-13 12:33:16 +0200
commit8d26ced7b496f4cb9c5eafbad7ee21adf0fb6673 (patch)
tree6d036f40abdc043012a86bc1a462b2d7d5100afa /rust/kernel
parent1d09c9ee13be740ec0bbf976f14b6f942396cabd (diff)
downloadlinux-8d26ced7b496f4cb9c5eafbad7ee21adf0fb6673.tar.gz
linux-8d26ced7b496f4cb9c5eafbad7ee21adf0fb6673.zip
rust: bitmap: use function-level cfg on kunit test
Since commit c652dc44192d ("rust: kunit: allow `cfg` on `test`s"), we no longer need this workaround. Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Yury Norov <ynorov@nvidia.com> Reviewed-by: Burak Emir <burak.emir@gmail.com> Reviewed-by: Gary Guo <gary@garyguo.net> Signed-off-by: Eliot Courtney <ecourtney@nvidia.com> Link: https://patch.msgid.link/20260930-chid-v9-1-0d6cca376cff@nvidia.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'rust/kernel')
-rw-r--r--rust/kernel/bitmap.rs25
1 files 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 @@ mod tests {
}
#[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]