Skip to content

Commit be412ba

Browse files
dirkbehmeojeda
authored andcommitted
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 <[email protected]> Signed-off-by: Dirk Behme <[email protected]> Reviewed-by: Martin Rodriguez Reboredo <[email protected]> Reviewed-by: Benno Lossin <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Added "the", newline and quotes for `.config`. Expanded "repos". ] Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 7583ce6 commit be412ba

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Documentation/rust/general-information.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,27 @@ configuration:
7777
#[cfg(CONFIG_X="y")] // Enabled as a built-in (`y`)
7878
#[cfg(CONFIG_X="m")] // Enabled as a module (`m`)
7979
#[cfg(not(CONFIG_X))] // Disabled
80+
81+
82+
Testing
83+
-------
84+
85+
There are the tests that come from the examples in the Rust documentation
86+
and get transformed into KUnit tests. These can be run via KUnit. For example
87+
via ``kunit_tool`` (``kunit.py``) on the command line::
88+
89+
./tools/testing/kunit/kunit.py run --make_options LLVM=1 --arch x86_64 --kconfig_add CONFIG_RUST=y
90+
91+
Alternatively, KUnit can run them as kernel built-in at boot. Refer to
92+
Documentation/dev-tools/kunit/index.rst for the general KUnit documentation
93+
and Documentation/dev-tools/kunit/architecture.rst for the details of kernel
94+
built-in vs. command line testing.
95+
96+
Additionally, there are the ``#[test]`` tests. These can be run using
97+
the ``rusttest`` Make target::
98+
99+
make LLVM=1 rusttest
100+
101+
This requires the kernel ``.config`` and downloads external repositories.
102+
It runs the ``#[test]`` tests on the host (currently) and thus is fairly
103+
limited in what these tests can test.

0 commit comments

Comments
 (0)