Skip to contentSkip to conversation

rust: alloc: remove `allocator_test`

PATCH Applied Miguel Ojeda 2 participants 2 messages Aug 16, 2025 – Aug 25, 2025

Subsystems (2)
lore
Share & tools
lore

Miguel Ojeda

author maintainer
#0 lore raw

PATCH 1/1 rust: alloc: remove `allocator_test`

Given we do not have tests that rely on it anymore, remove allocator_test, which simplifies the complexity of the build.

In particular, it avoids potential issues with rusttest, such as the one fixed at [1], where a public function was added to Kmalloc and used elsewhere, but it was not added to Cmalloc; or trivial issues like a missing import [2] due to not many people testing that target.

The only downside is that we cannot use it in the macros' crate examples anymore, but we did not feel a need for that so far, and anyway we could support that by running those within the kernel too, which we may do regardless.

---
This one goes on top of:

    https://lore.kernel.org/rust-for-linux/[email protected]/
 rust/kernel/alloc.rs                |   7 --
 rust/kernel/alloc/allocator_test.rs | 113 ----------------------------
 2 files changed, 120 deletions(-)
 delete mode 100644 rust/kernel/alloc/allocator_test.rs
rust/kernel/alloc.rs +0 -7
index 335ae3271fa8..6a3d45a5eb24 100644
@@ -2,18 +2,11 @@
 
 //! Implementation of the kernel's memory allocation infrastructure.
 
-#[cfg(not(testlib))]
 pub mod allocator;
 pub mod kbox;
 pub mod kvec;
 pub mod layout;
 
-#[cfg(testlib)]
-pub mod allocator_test;
-
-#[cfg(testlib)]
-pub use self::allocator_test as allocator;
-
 pub use self::kbox::Box;
 pub use self::kbox::KBox;
 pub use self::kbox::KVBox;
rust/kernel/alloc/allocator_test.rs deleted +0 -113

113 lines not on this page · raw message

--
2.50.1

maintainer Applied
#1 lore raw
Quoted 8 lines · Miguel Ojeda

Given we do not have tests that rely on it anymore, remove allocator_test, which simplifies the complexity of the build.

In particular, it avoids potential issues with rusttest, such as the one fixed at [1], where a public function was added to Kmalloc and used elsewhere, but it was not added to Cmalloc; or trivial issues like a missing import [2] due to not many people testing that target.

Quoted 8 lines

The only downside is that we cannot use it in the macros' crate examples anymore, but we did not feel a need for that so far, and anyway we could support that by running those within the kernel too, which we may do regardless.

Applied to alloc-next, thanks!