summaryrefslogtreecommitdiffstats
path: root/Documentation/rust
diff options
context:
space:
mode:
authorLaura Nao <laura.nao@collabora.com>2024-04-05 17:38:41 +0200
committerMiguel Ojeda <ojeda@kernel.org>2024-05-05 19:14:42 +0200
commitc8226cdb64db75d67ada0529ef7e19a2bf98e9f1 (patch)
tree559a4a8c9949e468b21c59fd78c3a119a3ee4359 /Documentation/rust
parentrust: remove unneeded `kernel::prelude` imports from doctests (diff)
downloadlinux-c8226cdb64db75d67ada0529ef7e19a2bf98e9f1.tar.xz
linux-c8226cdb64db75d67ada0529ef7e19a2bf98e9f1.zip
docs: rust: Add instructions for the Rust kselftest
Add section describing how to build and run the Rust kselftest. Signed-off-by: Laura Nao <laura.nao@collabora.com> Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com> Reviewed-by: Valentin Obst <kernel@valentinobst.de> Link: https://lore.kernel.org/r/20240405153841.320459-1-laura.nao@collabora.com [ Formatted paths as inline code literals. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'Documentation/rust')
-rw-r--r--Documentation/rust/testing.rst25
1 files changed, 24 insertions, 1 deletions
diff --git a/Documentation/rust/testing.rst b/Documentation/rust/testing.rst
index 6658998d1b6c..acfd0c2be48d 100644
--- a/Documentation/rust/testing.rst
+++ b/Documentation/rust/testing.rst
@@ -6,10 +6,11 @@ Testing
This document contains useful information how to test the Rust code in the
kernel.
-There are two sorts of tests:
+There are three sorts of tests:
- The KUnit tests.
- The ``#[test]`` tests.
+- The Kselftests.
The KUnit tests
---------------
@@ -133,3 +134,25 @@ Additionally, there are the ``#[test]`` tests. These can be run using the
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.
+
+The Kselftests
+--------------
+
+Kselftests are also available in the ``tools/testing/selftests/rust`` folder.
+
+The kernel config options required for the tests are listed in the
+``tools/testing/selftests/rust/config`` file and can be included with the aid
+of the ``merge_config.sh`` script::
+
+ ./scripts/kconfig/merge_config.sh .config tools/testing/selftests/rust/config
+
+The kselftests are built within the kernel source tree and are intended to
+be executed on a system that is running the same kernel.
+
+Once a kernel matching the source tree has been installed and booted, the
+tests can be compiled and executed using the following command::
+
+ make TARGETS="rust" kselftest
+
+Refer to Documentation/dev-tools/kselftest.rst for the general Kselftest
+documentation.