Skip to content

Commit c8226cd

Browse files
laura-naoojeda
authored andcommitted
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>
1 parent 4a2ae88 commit c8226cd

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

Documentation/rust/testing.rst

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ Testing
66
This document contains useful information how to test the Rust code in the
77
kernel.
88

9-
There are two sorts of tests:
9+
There are three sorts of tests:
1010

1111
- The KUnit tests.
1212
- The ``#[test]`` tests.
13+
- The Kselftests.
1314

1415
The KUnit tests
1516
---------------
@@ -133,3 +134,25 @@ Additionally, there are the ``#[test]`` tests. These can be run using the
133134
This requires the kernel ``.config`` and downloads external repositories. It
134135
runs the ``#[test]`` tests on the host (currently) and thus is fairly limited in
135136
what these tests can test.
137+
138+
The Kselftests
139+
--------------
140+
141+
Kselftests are also available in the ``tools/testing/selftests/rust`` folder.
142+
143+
The kernel config options required for the tests are listed in the
144+
``tools/testing/selftests/rust/config`` file and can be included with the aid
145+
of the ``merge_config.sh`` script::
146+
147+
./scripts/kconfig/merge_config.sh .config tools/testing/selftests/rust/config
148+
149+
The kselftests are built within the kernel source tree and are intended to
150+
be executed on a system that is running the same kernel.
151+
152+
Once a kernel matching the source tree has been installed and booted, the
153+
tests can be compiled and executed using the following command::
154+
155+
make TARGETS="rust" kselftest
156+
157+
Refer to Documentation/dev-tools/kselftest.rst for the general Kselftest
158+
documentation.

0 commit comments

Comments
 (0)