Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a doctest for AllocLayout::new() #1131

Open
fbq opened this issue Nov 25, 2024 · 4 comments
Open

Add a doctest for AllocLayout::new() #1131

fbq opened this issue Nov 25, 2024 · 4 comments
Labels
easy Expected to be an easy issue to resolve. good first issue Good for newcomers • lib Related to the `rust/` library.

Comments

@fbq
Copy link
Member

fbq commented Nov 25, 2024

As Lina and Janne reported, there was a bug in AllocLayout::new(). Although it's fixed, it would be better to have something unit/doc tests about it like this.


This requires submitting a proper patch to the LKML and the Rust for Linux mailing list. Please recall to test your changes (including generating the documentation if changed, running the Rust doctests if changed, etc.), to use a proper title for the commit, to sign your commit under the Developer's Certificate of Origin and to add a Suggested-by: tag and a Link: tag to this issue. Please see https://rust-for-linux.com/contributing for details.

Please take this issue only if you are new to the kernel development process and you would like to use it as a test to submit your first patch to the kernel. Please do not take it if you do not plan to make other contributions to the kernel.

@fbq fbq added the good first issue Good for newcomers label Nov 25, 2024
@ojeda ojeda added easy Expected to be an easy issue to resolve. • lib Related to the `rust/` library. labels Nov 25, 2024
@LordGoatius
Copy link

Hi, I'm new to the kernel development process and I'd like to claim this.

@ojeda
Copy link
Member

ojeda commented Nov 29, 2024

Of course, please go ahead!

intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Dec 3, 2024
Added a rustdoc example and Kunit test to the `ArrayLayout` struct's
`ArrayLayout::new()` function.

Kunit tests ran using `./tools/testing/kunit/kunit.py run \
--make_options LLVM=1 \
--kconfig_add CONFIG_RUST=y` passed.

Generated documentation looked as expected.

Signed-off-by: Jimmy Ostler <jtostler1@gmail.com>
Suggested-by: Boqun Feng <boqun.feng@gmail.com>
Link: Rust-for-Linux#1131
@LordGoatius
Copy link

Just sent in the patch! The thread should be here.
Thank you for making these opportunities for people who want to contribute but aren't familiar with the process!

@ojeda
Copy link
Member

ojeda commented Dec 3, 2024

You're welcome! It is nice to hear they are useful :)

intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Dec 5, 2024
Add a rustdoc example and Kunit test to the `ArrayLayout` struct's
`ArrayLayout::new()` function.

Add an implementation of `From<LayoutError> for Error` for the
`kernel::alloc::LayoutError`. This is necessary for the new test to
compile.

Change the `From` implementation on `core::alloc::LayoutError` to avoid
collisions with `kernel::alloc::LayoutError`, and modify imports to
explicitly import `kernel::alloc::LayoutError` instead.

Suggested-by: Boqun Feng <boqun.feng@gmail.com>
Link: Rust-for-Linux#1131
Signed-off-by: Jimmy Ostler <jtostler1@gmail.com>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Dec 18, 2024
Add a rustdoc example and Kunit test to the `ArrayLayout` struct's
`ArrayLayout::new()` function.

This patch depends on the first patch in this series in order for the
kunit test to compile.

Suggested-by: Boqun Feng <boqun.feng@gmail.com>
Link: Rust-for-Linux#1131
Signed-off-by: Jimmy Ostler <jtostler1@gmail.com>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Dec 20, 2024
Add a rustdoc example and Kunit test to the `ArrayLayout` struct's
`ArrayLayout::new()` function.

This patch depends on the first patch in this series in order for the
kunit test to compile.

Suggested-by: Boqun Feng <boqun.feng@gmail.com>
Link: Rust-for-Linux#1131
Reviewed-by: Danilo Krummrich <dakr@kernel.org>
Signed-off-by: Jimmy Ostler <jtostler1@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy Expected to be an easy issue to resolve. good first issue Good for newcomers • lib Related to the `rust/` library.
Development

No branches or pull requests

3 participants