Rust for Linux List
 help / color / mirror / Atom feed
* [PATCH v2] docs: rust: Add instructions for the Rust kselftest
@ 2024-04-03  9:24 Laura Nao
  2024-04-05  8:46 ` Valentin Obst
  0 siblings, 1 reply; 3+ messages in thread
From: Laura Nao @ 2024-04-03  9:24 UTC (permalink / raw)
  To: ojeda, alex.gaynor, wedsonaf
  Cc: boqun.feng, gary, bjorn3_gh, benno.lossin, a.hindborg, aliceryhl,
	rust-for-linux, kernel-linux, dirk.behme, kernel, kernel,
	Laura Nao, Muhammad Usama Anjum

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>
---
Changes in v2:
- Use plural to account for potential other tests added later
- Omit details about the test_probe_samples test
- Clarify that kselftests are intended to be executed on a system running the same kernel to be tested
---
 Documentation/rust/testing.rst | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/Documentation/rust/testing.rst b/Documentation/rust/testing.rst
index 6658998d1b6c..64f58c4308f8 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 test 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 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.
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] docs: rust: Add instructions for the Rust kselftest
  2024-04-03  9:24 [PATCH v2] docs: rust: Add instructions for the Rust kselftest Laura Nao
@ 2024-04-05  8:46 ` Valentin Obst
  2024-04-05 10:45   ` Laura Nao
  0 siblings, 1 reply; 3+ messages in thread
From: Valentin Obst @ 2024-04-05  8:46 UTC (permalink / raw)
  To: laura.nao
  Cc: a.hindborg, alex.gaynor, aliceryhl, benno.lossin, bjorn3_gh,
	boqun.feng, dirk.behme, gary, kernel-linux, kernel, kernel, ojeda,
	rust-for-linux, usama.anjum, wedsonaf

> 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>

Hi,

thanks for clarifying the system requirements. Only minor things (see
below), irrespective of that offering:

Reviewed-by: Valentin Obst <kernel@valentinobst.de>

> ---
> Changes in v2:
> - Use plural to account for potential other tests added later
> - Omit details about the test_probe_samples test
> - Clarify that kselftests are intended to be executed on a system running the same kernel to be tested
> ---
>  Documentation/rust/testing.rst | 25 ++++++++++++++++++++++++-
>  1 file changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/rust/testing.rst b/Documentation/rust/testing.rst
> index 6658998d1b6c..64f58c4308f8 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 test are listed in the

Is this intentionally still in singular? Maybe replace /test/tests/?

> +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 booted, the tests

Maybe say 'installed and booted' here since at least one test is using
modprobe, which expects to find the modules and other things in some
standard locations.

	- Best Valentin

> +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.
> --
> 2.30.2
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] docs: rust: Add instructions for the Rust kselftest
  2024-04-05  8:46 ` Valentin Obst
@ 2024-04-05 10:45   ` Laura Nao
  0 siblings, 0 replies; 3+ messages in thread
From: Laura Nao @ 2024-04-05 10:45 UTC (permalink / raw)
  To: kernel
  Cc: a.hindborg, alex.gaynor, aliceryhl, benno.lossin, bjorn3_gh,
	boqun.feng, dirk.behme, gary, kernel-linux, kernel, laura.nao,
	ojeda, rust-for-linux, usama.anjum, wedsonaf

Hi Valentin,

On 4/5/24 10:46, Valentin Obst wrote:
>> 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>
> 
> Hi,
> 
> thanks for clarifying the system requirements. Only minor things (see
> below), irrespective of that offering:
> 
> Reviewed-by: Valentin Obst <kernel@valentinobst.de>
> 
>> ---
>> Changes in v2:
>> - Use plural to account for potential other tests added later
>> - Omit details about the test_probe_samples test
>> - Clarify that kselftests are intended to be executed on a system running the same kernel to be tested
>> ---
>>   Documentation/rust/testing.rst | 25 ++++++++++++++++++++++++-
>>   1 file changed, 24 insertions(+), 1 deletion(-)
>>
>> diff --git a/Documentation/rust/testing.rst b/Documentation/rust/testing.rst
>> index 6658998d1b6c..64f58c4308f8 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 test are listed in the
> 
> Is this intentionally still in singular? Maybe replace /test/tests/?
> 

Argh, that slipped through - I'll fix it.

>> +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 booted, the tests
> 
> Maybe say 'installed and booted' here since at least one test is using
> modprobe, which expects to find the modules and other things in some
> standard locations.
> 

Right, thanks for the suggestion. I'll send another version with these
couple changes applied.

Thanks,

Laura

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-05 10:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-03  9:24 [PATCH v2] docs: rust: Add instructions for the Rust kselftest Laura Nao
2024-04-05  8:46 ` Valentin Obst
2024-04-05 10:45   ` Laura Nao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox