diff options
author | Dirk Behme <dirk.behme@de.bosch.com> | 2023-12-12 09:13:13 +0100 |
---|---|---|
committer | Miguel Ojeda <ojeda@kernel.org> | 2023-12-21 22:47:40 +0100 |
commit | be412baf72402bd732e250033e03ad159d060a30 (patch) | |
tree | 065b56f1033ed64a4a7795aeabcd08272abd4a4a | |
parent | 7583ce66ddf7ed4f7aaa14b5e4cf78058ca597e1 (diff) |
docs: rust: Add rusttest info
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>
Reviewed-by: Benno Lossin <benno.lossin@proton.me>
Link: https://lore.kernel.org/r/20231212081313.226120-1-dirk.behme@de.bosch.com
[ Added "the", newline and quotes for `.config`. Expanded "repos". ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
-rw-r--r-- | Documentation/rust/general-information.rst | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Documentation/rust/general-information.rst b/Documentation/rust/general-information.rst index 081397827a7e..236c6dd3c647 100644 --- a/Documentation/rust/general-information.rst +++ b/Documentation/rust/general-information.rst @@ -77,3 +77,27 @@ 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 +the ``rusttest`` Make target:: + + make LLVM=1 rusttest + +This requires the kernel ``.config`` and downloads external repositories. +It runs the ``#[test]`` tests on the host (currently) and thus is fairly +limited in what these tests can test. |