* [PATCH v4] docs: rust: Add rusttest info
@ 2023-12-12 8:13 Dirk Behme
2023-12-20 11:34 ` Benno Lossin
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Dirk Behme @ 2023-12-12 8:13 UTC (permalink / raw)
To: rust-for-linux; +Cc: dirk.behme, David Gow
Searching the Rust kernel documentation all existing Rust Make
targets (rustavailable, rustfmt, rustfmtcheck, rustdoc and
rust-analyzer) are explicitly documented with their Make commands.
While the Make target rusttest is mentioned two times in the
existing documentation, it's Make command is not explicitly
documented, yet. Add a test section to document this.
While at it, add some info about the more important KUnit testing
too.
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com>
---
v4: Swap the KUnit and make parts to make the more important KUnit
being the first. Add and optimize the links to the KUnit docs
and mention the KUnit built-in option. Fix some typos and wording.
P.S.: In my 6.7.0-rc1 setup "make LLVM=1 rusttest" seems to work.
Documentation/rust/general-information.rst | 23 ++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/Documentation/rust/general-information.rst b/Documentation/rust/general-information.rst
index 081397827a7ea..58283f4894ea0 100644
--- a/Documentation/rust/general-information.rst
+++ b/Documentation/rust/general-information.rst
@@ -77,3 +77,26 @@ configuration:
#[cfg(CONFIG_X="y")] // Enabled as a built-in (`y`)
#[cfg(CONFIG_X="m")] // Enabled as a module (`m`)
#[cfg(not(CONFIG_X))] // Disabled
+
+Testing
+-------
+
+There are the tests that come from the examples in the Rust documentation
+and get transformed into KUnit tests. These can be run via KUnit. For example
+via ``kunit_tool`` (``kunit.py``) on the command line::
+
+ ./tools/testing/kunit/kunit.py run --make_options LLVM=1 --arch x86_64 --kconfig_add CONFIG_RUST=y
+
+Alternatively, KUnit can run them as kernel built-in at boot. Refer to
+Documentation/dev-tools/kunit/index.rst for the general KUnit documentation
+and Documentation/dev-tools/kunit/architecture.rst for the details of kernel
+built-in vs. command line testing.
+
+Additionally, there are the ``#[test]`` tests. These can be run using
+``rusttest`` Make target::
+
+ make LLVM=1 rusttest
+
+This requires the kernel .config and downloads external repos. It
+runs the ``#[test]`` tests on the host (currently) and thus is fairly
+limited in what these tests can test.
--
2.28.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH v4] docs: rust: Add rusttest info
2023-12-12 8:13 [PATCH v4] docs: rust: Add rusttest info Dirk Behme
@ 2023-12-20 11:34 ` Benno Lossin
2023-12-20 17:38 ` Martin Rodriguez Reboredo
2023-12-21 21:41 ` Miguel Ojeda
2 siblings, 0 replies; 5+ messages in thread
From: Benno Lossin @ 2023-12-20 11:34 UTC (permalink / raw)
To: Dirk Behme, rust-for-linux; +Cc: David Gow
On 12/12/23 09:13, Dirk Behme wrote:
> Searching the Rust kernel documentation all existing Rust Make
> targets (rustavailable, rustfmt, rustfmtcheck, rustdoc and
> rust-analyzer) are explicitly documented with their Make commands.
> While the Make target rusttest is mentioned two times in the
> existing documentation, it's Make command is not explicitly
> documented, yet. Add a test section to document this.
>
> While at it, add some info about the more important KUnit testing
> too.
>
> Reviewed-by: David Gow <davidgow@google.com>
> Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com>
> ---
Reviewed-by: Benno Lossin <benno.lossin@proton.me>
--
Cheers,
Benno
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4] docs: rust: Add rusttest info
2023-12-12 8:13 [PATCH v4] docs: rust: Add rusttest info Dirk Behme
2023-12-20 11:34 ` Benno Lossin
@ 2023-12-20 17:38 ` Martin Rodriguez Reboredo
2023-12-21 21:41 ` Miguel Ojeda
2 siblings, 0 replies; 5+ messages in thread
From: Martin Rodriguez Reboredo @ 2023-12-20 17:38 UTC (permalink / raw)
To: Dirk Behme, rust-for-linux; +Cc: David Gow
On 12/12/23 05:13, Dirk Behme wrote:
> Searching the Rust kernel documentation all existing Rust Make
> targets (rustavailable, rustfmt, rustfmtcheck, rustdoc and
> rust-analyzer) are explicitly documented with their Make commands.
> While the Make target rusttest is mentioned two times in the
> existing documentation, it's Make command is not explicitly
> documented, yet. Add a test section to document this.
>
> While at it, add some info about the more important KUnit testing
> too.
>
> Reviewed-by: David Gow <davidgow@google.com>
> Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com>
> ---
> [...]
Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4] docs: rust: Add rusttest info
2023-12-12 8:13 [PATCH v4] docs: rust: Add rusttest info Dirk Behme
2023-12-20 11:34 ` Benno Lossin
2023-12-20 17:38 ` Martin Rodriguez Reboredo
@ 2023-12-21 21:41 ` Miguel Ojeda
2023-12-22 9:17 ` David Gow
2 siblings, 1 reply; 5+ messages in thread
From: Miguel Ojeda @ 2023-12-21 21:41 UTC (permalink / raw)
To: Dirk Behme; +Cc: rust-for-linux, David Gow
On Tue, Dec 12, 2023 at 9:14 AM Dirk Behme <dirk.behme@de.bosch.com> wrote:
>
> Searching the Rust kernel documentation all existing Rust Make
> targets (rustavailable, rustfmt, rustfmtcheck, rustdoc and
> rust-analyzer) are explicitly documented with their Make commands.
> While the Make target rusttest is mentioned two times in the
> existing documentation, it's Make command is not explicitly
> documented, yet. Add a test section to document this.
>
> While at it, add some info about the more important KUnit testing
> too.
>
> Reviewed-by: David Gow <davidgow@google.com>
> Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com>
Applied to `rust-next` with a few nits tweaked (added "the", newline
and quotes for `.config`; expanded "repos") -- thanks everyone!
David: your `Reviewed-by` was here but the change substantially
changed from v3 to v4 -- I have kept it, but if you want it out,
please shout :) For instance, perhaps we could simplify the paragraph
about KUnit to just:
Alternatively, KUnit can run built-in KUnit tests on boot. Please see
Documentation/dev-tools/kunit/index.rst for details.
since the KUnit docs explain in several places the boot option vs.
`kunit_tool`, and it is one less thing to maintain, but I have left it
as-is.
Cheers,
Miguel
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v4] docs: rust: Add rusttest info
2023-12-21 21:41 ` Miguel Ojeda
@ 2023-12-22 9:17 ` David Gow
0 siblings, 0 replies; 5+ messages in thread
From: David Gow @ 2023-12-22 9:17 UTC (permalink / raw)
To: Miguel Ojeda; +Cc: Dirk Behme, rust-for-linux
[-- Attachment #1: Type: text/plain, Size: 1611 bytes --]
On Fri, 22 Dec 2023 at 05:41, Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> On Tue, Dec 12, 2023 at 9:14 AM Dirk Behme <dirk.behme@de.bosch.com> wrote:
> >
> > Searching the Rust kernel documentation all existing Rust Make
> > targets (rustavailable, rustfmt, rustfmtcheck, rustdoc and
> > rust-analyzer) are explicitly documented with their Make commands.
> > While the Make target rusttest is mentioned two times in the
> > existing documentation, it's Make command is not explicitly
> > documented, yet. Add a test section to document this.
> >
> > While at it, add some info about the more important KUnit testing
> > too.
> >
> > Reviewed-by: David Gow <davidgow@google.com>
> > Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com>
>
> Applied to `rust-next` with a few nits tweaked (added "the", newline
> and quotes for `.config`; expanded "repos") -- thanks everyone!
>
> David: your `Reviewed-by` was here but the change substantially
> changed from v3 to v4 -- I have kept it, but if you want it out,
> please shout :) For instance, perhaps we could simplify the paragraph
> about KUnit to just:
>
> Alternatively, KUnit can run built-in KUnit tests on boot. Please see
> Documentation/dev-tools/kunit/index.rst for details.
>
> since the KUnit docs explain in several places the boot option vs.
> `kunit_tool`, and it is one less thing to maintain, but I have left it
> as-is.
Yeah, this still seems fine to me. I think it'll need updating later
when we support additional types of KUnit tests, but this works for
now.
Thanks,
-- David
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4003 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-12-22 9:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-12 8:13 [PATCH v4] docs: rust: Add rusttest info Dirk Behme
2023-12-20 11:34 ` Benno Lossin
2023-12-20 17:38 ` Martin Rodriguez Reboredo
2023-12-21 21:41 ` Miguel Ojeda
2023-12-22 9:17 ` David Gow
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).