* [PATCH v2] rust: workqueue: Enable execution of doctests
@ 2024-10-16 13:35 Dirk Behme
2024-10-16 15:28 ` Boqun Feng
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Dirk Behme @ 2024-10-16 13:35 UTC (permalink / raw)
To: rust-for-linux
Cc: Alice Ryhl, Boqun Feng, Miguel Ojeda, Trevor Gross, Tejun Heo
Having the Rust doctests enabled these workqueue tests are built but not
executed as the final callers of the print_*() functions are missing.
Add them.
The result is
# rust_doctest_kernel_workqueue_rs_0.location:
rust/kernel/workqueue.rs:35
rust_doctests_kernel: The value is: 42
ok 94 rust_doctest_kernel_workqueue_rs_0
# rust_doctest_kernel_workqueue_rs_3.location:
rust/kernel/workqueue.rs:78
rust_doctests_kernel: The value is: 24
rust_doctests_kernel: The second value is: 42
ok 97 rust_doctest_kernel_workqueue_rs_3
Without this change the "The value ..." outputs are not there meaning
that this test code is not run.
Cc: Alice Ryhl <aliceryhl@google.com>
Cc: Miguel Ojeda <ojeda@kernel.org>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Trevor Gross <tmgross@umich.edu>
Cc: Tejun Heo <tj@kernel.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Dirk Behme <dirk.behme@gmail.com>
---
Changes in v2:
- Drop 'let _ ='
- Drop empty line
- Add additional maintainers into Cc
- Drop newline in commit message
- Add Reviewed-by from v1
rust/kernel/workqueue.rs | 3 +++
1 file changed, 3 insertions(+)
diff --git a/rust/kernel/workqueue.rs b/rust/kernel/workqueue.rs
index 10d2bc62e2cf..3755c8e5e9ea 100644
--- a/rust/kernel/workqueue.rs
+++ b/rust/kernel/workqueue.rs
@@ -69,6 +69,7 @@
//! fn print_later(val: Arc<MyStruct>) {
//! let _ = workqueue::system().enqueue(val);
//! }
+//! # print_later(MyStruct::new(42).unwrap());
//! ```
//!
//! The following example shows how multiple `work_struct` fields can
be used:
@@ -126,6 +127,8 @@
//! fn print_2_later(val: Arc<MyStruct>) {
//! let _ = workqueue::system().enqueue::<Arc<MyStruct>, 2>(val);
//! }
+//! # print_1_later(MyStruct::new(24, 25).unwrap());
+//! # print_2_later(MyStruct::new(41, 42).unwrap());
//! ```
//!
//! C header:
[`include/linux/workqueue.h`](srctree/include/linux/workqueue.h)
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] rust: workqueue: Enable execution of doctests
2024-10-16 13:35 [PATCH v2] rust: workqueue: Enable execution of doctests Dirk Behme
@ 2024-10-16 15:28 ` Boqun Feng
2024-12-17 23:23 ` Miguel Ojeda
2024-12-17 23:52 ` Miguel Ojeda
2 siblings, 0 replies; 5+ messages in thread
From: Boqun Feng @ 2024-10-16 15:28 UTC (permalink / raw)
To: Dirk Behme
Cc: rust-for-linux, Alice Ryhl, Miguel Ojeda, Trevor Gross, Tejun Heo
On Wed, Oct 16, 2024 at 03:35:07PM +0200, Dirk Behme wrote:
> Having the Rust doctests enabled these workqueue tests are built but not
> executed as the final callers of the print_*() functions are missing.
> Add them.
>
> The result is
>
> # rust_doctest_kernel_workqueue_rs_0.location:
> rust/kernel/workqueue.rs:35
> rust_doctests_kernel: The value is: 42
> ok 94 rust_doctest_kernel_workqueue_rs_0
> # rust_doctest_kernel_workqueue_rs_3.location:
> rust/kernel/workqueue.rs:78
> rust_doctests_kernel: The value is: 24
> rust_doctests_kernel: The second value is: 42
> ok 97 rust_doctest_kernel_workqueue_rs_3
>
> Without this change the "The value ..." outputs are not there meaning
> that this test code is not run.
>
> Cc: Alice Ryhl <aliceryhl@google.com>
> Cc: Miguel Ojeda <ojeda@kernel.org>
> Cc: Boqun Feng <boqun.feng@gmail.com>
> Cc: Trevor Gross <tmgross@umich.edu>
> Cc: Tejun Heo <tj@kernel.org>
> Reviewed-by: Alice Ryhl <aliceryhl@google.com>
> Signed-off-by: Dirk Behme <dirk.behme@gmail.com>
Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Regards,
Boqun
> ---
>
> Changes in v2:
> - Drop 'let _ ='
> - Drop empty line
> - Add additional maintainers into Cc
> - Drop newline in commit message
> - Add Reviewed-by from v1
>
> rust/kernel/workqueue.rs | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/rust/kernel/workqueue.rs b/rust/kernel/workqueue.rs
> index 10d2bc62e2cf..3755c8e5e9ea 100644
> --- a/rust/kernel/workqueue.rs
> +++ b/rust/kernel/workqueue.rs
> @@ -69,6 +69,7 @@
> //! fn print_later(val: Arc<MyStruct>) {
> //! let _ = workqueue::system().enqueue(val);
> //! }
> +//! # print_later(MyStruct::new(42).unwrap());
> //! ```
> //!
> //! The following example shows how multiple `work_struct` fields can
> be used:
> @@ -126,6 +127,8 @@
> //! fn print_2_later(val: Arc<MyStruct>) {
> //! let _ = workqueue::system().enqueue::<Arc<MyStruct>, 2>(val);
> //! }
> +//! # print_1_later(MyStruct::new(24, 25).unwrap());
> +//! # print_2_later(MyStruct::new(41, 42).unwrap());
> //! ```
> //!
> //! C header:
> [`include/linux/workqueue.h`](srctree/include/linux/workqueue.h)
> --
> 2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] rust: workqueue: Enable execution of doctests
2024-10-16 13:35 [PATCH v2] rust: workqueue: Enable execution of doctests Dirk Behme
2024-10-16 15:28 ` Boqun Feng
@ 2024-12-17 23:23 ` Miguel Ojeda
2024-12-17 23:31 ` Tejun Heo
2024-12-17 23:52 ` Miguel Ojeda
2 siblings, 1 reply; 5+ messages in thread
From: Miguel Ojeda @ 2024-12-17 23:23 UTC (permalink / raw)
To: Dirk Behme
Cc: rust-for-linux, Alice Ryhl, Boqun Feng, Miguel Ojeda,
Trevor Gross, Tejun Heo
On Wed, Oct 16, 2024 at 3:35 PM Dirk Behme <dirk.behme@gmail.com> wrote:
>
> The result is
>
> # rust_doctest_kernel_workqueue_rs_0.location:
> rust/kernel/workqueue.rs:35
> rust_doctests_kernel: The value is: 42
> ok 94 rust_doctest_kernel_workqueue_rs_0
> # rust_doctest_kernel_workqueue_rs_3.location:
> rust/kernel/workqueue.rs:78
> rust_doctests_kernel: The value is: 24
> rust_doctests_kernel: The second value is: 42
> ok 97 rust_doctest_kernel_workqueue_rs_3
Nit: normally you would indent "code blocks".
> Without this change the "The value ..." outputs are not there meaning
> that this test code is not run.
>
> Cc: Alice Ryhl <aliceryhl@google.com>
> Cc: Miguel Ojeda <ojeda@kernel.org>
> Cc: Boqun Feng <boqun.feng@gmail.com>
> Cc: Trevor Gross <tmgross@umich.edu>
> Cc: Tejun Heo <tj@kernel.org>
Normally you do not need to use the Cc tag for reviewers/maintainers
that are supposed to take the patch.
> Reviewed-by: Alice Ryhl <aliceryhl@google.com>
> Signed-off-by: Dirk Behme <dirk.behme@gmail.com>
This looks fine to me -- Tejun, are you picking it up? If so, please
feel free to add:
Acked-by: Miguel Ojeda <ojeda@kernel.org>
Otherwise, if you prefer, I can put it through `rust-next`.
Thanks!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] rust: workqueue: Enable execution of doctests
2024-12-17 23:23 ` Miguel Ojeda
@ 2024-12-17 23:31 ` Tejun Heo
0 siblings, 0 replies; 5+ messages in thread
From: Tejun Heo @ 2024-12-17 23:31 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Dirk Behme, rust-for-linux, Alice Ryhl, Boqun Feng, Miguel Ojeda,
Trevor Gross
On Wed, Dec 18, 2024 at 12:23:47AM +0100, Miguel Ojeda wrote:
> This looks fine to me -- Tejun, are you picking it up? If so, please
> feel free to add:
>
> Acked-by: Miguel Ojeda <ojeda@kernel.org>
>
> Otherwise, if you prefer, I can put it through `rust-next`.
Acked-by: Tejun Heo <tj@kernel.org>
Please take it through rust-next.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] rust: workqueue: Enable execution of doctests
2024-10-16 13:35 [PATCH v2] rust: workqueue: Enable execution of doctests Dirk Behme
2024-10-16 15:28 ` Boqun Feng
2024-12-17 23:23 ` Miguel Ojeda
@ 2024-12-17 23:52 ` Miguel Ojeda
2 siblings, 0 replies; 5+ messages in thread
From: Miguel Ojeda @ 2024-12-17 23:52 UTC (permalink / raw)
To: Dirk Behme
Cc: rust-for-linux, Alice Ryhl, Boqun Feng, Miguel Ojeda,
Trevor Gross, Tejun Heo
On Wed, Oct 16, 2024 at 3:35 PM Dirk Behme <dirk.behme@gmail.com> wrote:
>
> Having the Rust doctests enabled these workqueue tests are built but not
> executed as the final callers of the print_*() functions are missing.
> Add them.
Applied to `rust-next` -- thanks everyone!
[ Reworded slightly. - Miguel ]
Cheers,
Miguel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-12-17 23:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-16 13:35 [PATCH v2] rust: workqueue: Enable execution of doctests Dirk Behme
2024-10-16 15:28 ` Boqun Feng
2024-12-17 23:23 ` Miguel Ojeda
2024-12-17 23:31 ` Tejun Heo
2024-12-17 23:52 ` Miguel Ojeda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).