Re: [PATCH v2] rust: add a sample alloc usage
From: Hui Zhu
Date: Thu Jul 24 2025 - 04:06:58 EST
Hi Danilo and Boqun,
On Thu, Jul 17, 2025 at 09:14:15AM -0700, Boqun Feng wrote:
> On Thu, Jul 17, 2025 at 01:19:05PM +0200, Danilo Krummrich wrote:
> > (Cc: Lorenzo, Vlastimil, Liam, Uladzislau)
> >
> > On Thu Jul 17, 2025 at 11:50 AM CEST, Hui Zhu wrote:
> > > diff --git a/samples/rust/Makefile b/samples/rust/Makefile
> > > index bd2faad63b4f..7c3e68d9ada5 100644
> > > --- a/samples/rust/Makefile
> > > +++ b/samples/rust/Makefile
> > > @@ -10,6 +10,7 @@ obj-$(CONFIG_SAMPLE_RUST_DRIVER_PLATFORM) += rust_driver_platform.o
> > > obj-$(CONFIG_SAMPLE_RUST_DRIVER_FAUX) += rust_driver_faux.o
> > > obj-$(CONFIG_SAMPLE_RUST_DRIVER_AUXILIARY) += rust_driver_auxiliary.o
> > > obj-$(CONFIG_SAMPLE_RUST_CONFIGFS) += rust_configfs.o
> > > +obj-$(CONFIG_SAMPLE_RUST_ALLOC) += rust_alloc.o
> >
> > I think adding an example for large alignment is fine, but let's do this in a
> > doc-test on VBox in rust/kernel/alloc/kbox.rs. I think adding a separate module
>
> I would suggest using #[kunit_tests(..)], which is similar to how
> doc-test run, for it if we only use it for test purposes.
>
> Regards,
> Boqun
>
> > for this is overkill.
> >
> > Note that doc-tests are executed on boot if CONFIG_RUST_KERNEL_DOCTESTS=y.
> >
> [...]
I sent version v3 that move vbox code to allocator as unit tests and add
move kvec::as_slice to doc example.
Best,
Hui