linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Documentation: kunit: Add CLI args for kunit_tool
@ 2022-07-19  9:22 Sadiya Kazi
  2022-07-19 12:08 ` Maíra Canal
  2022-07-20  7:42 ` David Gow
  0 siblings, 2 replies; 3+ messages in thread
From: Sadiya Kazi @ 2022-07-19  9:22 UTC (permalink / raw)
  To: brendanhiggins, davidgow, skhan, corbet, linux-kselftest,
	kunit-dev, linux-doc, linux-kernel
  Cc: Sadiya Kazi

Run_wrapper.rst was missing some command line arguments. Added
additional args in the file. Included all initial review comments.

Signed-off-by: Sadiya Kazi <sadiyakazi@google.com>
---
 Documentation/dev-tools/kunit/run_wrapper.rst | 48 +++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/Documentation/dev-tools/kunit/run_wrapper.rst b/Documentation/dev-tools/kunit/run_wrapper.rst
index 5e560f2c5fca..91f5dda36e83 100644
--- a/Documentation/dev-tools/kunit/run_wrapper.rst
+++ b/Documentation/dev-tools/kunit/run_wrapper.rst
@@ -257,3 +257,51 @@ command line arguments:
             added or modified. Instead, enable all tests
             which have satisfied dependencies by adding
             ``CONFIG_KUNIT_ALL_TESTS=y`` to your ``.kunitconfig``.
+- ``--kunitconfig``: Specifies the path to the ``.kunitconfig`` file.
+  This Kconfig fragment enables KUnit tests. The "/.kunitconfig" gets
+  appended to the path specified. For example, If a directory path "lib/kunit"
+  is given, the complete path will be "lib/kunit/.kunitconfig".
+
+- ``--kconfig_add``: Specifies additional configuration options to be
+  appended to the ``.kunitconfig`` file. For example, ``CONFIG_KASAN=y``.
+
+- ``--arch``: Runs tests with the specified architecture. The architecture
+  specified must match the string passed to the ARCH make parameter.
+  For example, i386, x86_64, arm, um, etc. Non-UML architectures run on QEMU.
+  Default to 'um'.
+
+- ``--cross_compile``: Specifies the Kbuild toolchain. It passes the
+  same argument as passed to the ``CROSS_COMPILE`` variable used by
+  Kbuild. This will be the prefix for the toolchain
+  binaries such as GCC. For example:
+
+  - ``sparc64-linux-gnu`` if we have the sparc toolchain installed on
+    our system.
+
+  - ``$HOME/toolchains/microblaze/gcc-9.2.0-nolibc/microblaze-linux/bin/microblaze-linux``
+    if we have downloaded the microblaze toolchain from the 0-day
+    website to a specified path in our home directory called toolchains.
+
+- ``--qemu_config``: Specifies the path to the file containing a
+  custom qemu architecture definition. This should be a python file
+  containing a QemuArchParams object.
+
+- ``--qemu_args``: Specifies additional QEMU arguments, for example, "-smp 8".
+
+- ``--jobs``: Specifies the number of jobs (commands) to run simultaneously.
+  By default, this is set to the number of cores on your system.
+
+- ``--timeout``: Specifies the maximum number of seconds allowed for all tests to run.
+  This does not include the time taken to build the tests.
+
+- ``--kernel_args``: Specifies the kernel command-line arguments. Might be repeated.
+
+- ``--run_isolated``: If set, boots the kernel for each individual suite/test.
+  This is useful for debugging a non-hermetic test, one that
+  might pass/fail based on what ran before it.
+
+- ``--raw_output``: If set, generates unformatted output from kernel.
+  If set to ``--raw_output=kunit``, filters to just KUnit output.
+
+- ``--json``: If set, it stores the test results in a JSON format and prints to stdout or
+  saves to a file if a filename is specified.
-- 
2.37.0.170.g444d1eabd0-goog


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

* Re: [PATCH] Documentation: kunit: Add CLI args for kunit_tool
  2022-07-19  9:22 [PATCH] Documentation: kunit: Add CLI args for kunit_tool Sadiya Kazi
@ 2022-07-19 12:08 ` Maíra Canal
  2022-07-20  7:42 ` David Gow
  1 sibling, 0 replies; 3+ messages in thread
From: Maíra Canal @ 2022-07-19 12:08 UTC (permalink / raw)
  To: Sadiya Kazi, brendanhiggins, davidgow, skhan, corbet,
	linux-kselftest, kunit-dev, linux-doc, linux-kernel

On 7/19/22 06:22, 'Sadiya Kazi' via KUnit Development wrote:
> Run_wrapper.rst was missing some command line arguments. Added
> additional args in the file. Included all initial review comments.
> 
> Signed-off-by: Sadiya Kazi <sadiyakazi@google.com>
> ---
>  Documentation/dev-tools/kunit/run_wrapper.rst | 48 +++++++++++++++++++
>  1 file changed, 48 insertions(+)
> 
> diff --git a/Documentation/dev-tools/kunit/run_wrapper.rst b/Documentation/dev-tools/kunit/run_wrapper.rst
> index 5e560f2c5fca..91f5dda36e83 100644
> --- a/Documentation/dev-tools/kunit/run_wrapper.rst
> +++ b/Documentation/dev-tools/kunit/run_wrapper.rst
> @@ -257,3 +257,51 @@ command line arguments:
>              added or modified. Instead, enable all tests
>              which have satisfied dependencies by adding
>              ``CONFIG_KUNIT_ALL_TESTS=y`` to your ``.kunitconfig``.
> +- ``--kunitconfig``: Specifies the path to the ``.kunitconfig`` file.
> +  This Kconfig fragment enables KUnit tests. The "/.kunitconfig" gets
> +  appended to the path specified. For example, If a directory path "lib/kunit"
You might want to change it for a lower-case "if", like: "For example,
if a directory path "lib/kunit"".

> +  is given, the complete path will be "lib/kunit/.kunitconfig".

This explanation may imply that if I pass `--kunitconfig
lib/kunit/.kunitconfig` it wouldn't work, as "/.kunitconfig" is always
appended to the path. But this is not true, both `--kunitconfig
lib/kunit/.kunitconfig` and `--kunitconfig lib/kunit` are valid options.

> +
> +- ``--kconfig_add``: Specifies additional configuration options to be
> +  appended to the ``.kunitconfig`` file. For example, ``CONFIG_KASAN=y``.

You could expand this example to:
```
./tools/testing/kunit/kunit.py run --kconfig_add CONFIG_KASAN=y
```

> +
> +- ``--arch``: Runs tests with the specified architecture. The architecture

"Runs tests on the specified architecture."

> +  specified must match the string passed to the ARCH make parameter.

ARCH is not a "make parameter", ARCH is a environment variable.
Therefor, ARCH is not "passed to make", as it a environment variable on
the shell. Check the ARCH documentation [1].

> +  For example, i386, x86_64, arm, um, etc. Non-UML architectures run on QEMU.
> +  Default to 'um'.
> +
> +- ``--cross_compile``: Specifies the Kbuild toolchain. It passes the
> +  same argument as passed to the ``CROSS_COMPILE`` variable used by> +  Kbuild. This will be the prefix for the toolchain
> +  binaries such as GCC. For example:
> +
> +  - ``sparc64-linux-gnu`` if we have the sparc toolchain installed on
> +    our system.
> +
> +  - ``$HOME/toolchains/microblaze/gcc-9.2.0-nolibc/microblaze-linux/bin/microblaze-linux``
> +    if we have downloaded the microblaze toolchain from the 0-day
> +    website to a specified path in our home directory called toolchains.

This is a copy of the explanation on [2]. You may want to delete the
previous explanation or change this one.

> +
> +- ``--qemu_config``: Specifies the path to the file containing a

"Specifies the path to a file containing a"

> +  custom qemu architecture definition. This should be a python file
> +  containing a QemuArchParams object.

"containing a `QemuArchParams` object."

The qemu_config has also a pretty good documentation on [2].

> +
> +- ``--qemu_args``: Specifies additional QEMU arguments, for example, "-smp 8".
> +
> +- ``--jobs``: Specifies the number of jobs (commands) to run simultaneously.
> +  By default, this is set to the number of cores on your system.

This CLI argument is already explained on [3]. You may want to delete
the previous explanation or change this one.

> +
> +- ``--timeout``: Specifies the maximum number of seconds allowed for all tests to run.
> +  This does not include the time taken to build the tests.

Same here.

> +
> +- ``--kernel_args``: Specifies the kernel command-line arguments. Might be repeated.
> +
> +- ``--run_isolated``: If set, boots the kernel for each individual suite/test.
> +  This is useful for debugging a non-hermetic test, one that
> +  might pass/fail based on what ran before it.
> +
> +- ``--raw_output``: If set, generates unformatted output from kernel.
> +  If set to ``--raw_output=kunit``, filters to just KUnit output.

This command line argument is already explain on the Parse Test Results
section [4].

> +
> +- ``--json``: If set, it stores the test results in a JSON format and prints to stdout or

"If set, it stores the test results in a JSON format and prints it to
`stdout` or"

> +  saves to a file if a filename is specified.

It's great to see new documentation for KUnit!

[1] https://docs.kernel.org/kbuild/kbuild.html#arch
[2]
https://docs.kernel.org/dev-tools/kunit/run_wrapper.html#run-tests-on-qemu
[3]
https://docs.kernel.org/dev-tools/kunit/run_wrapper.html#run-tests-with-kunit-tool
[4]
https://docs.kernel.org/dev-tools/kunit/run_wrapper.html#parse-test-results

Best Regards,
- Maíra Canal

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

* Re: [PATCH] Documentation: kunit: Add CLI args for kunit_tool
  2022-07-19  9:22 [PATCH] Documentation: kunit: Add CLI args for kunit_tool Sadiya Kazi
  2022-07-19 12:08 ` Maíra Canal
@ 2022-07-20  7:42 ` David Gow
  1 sibling, 0 replies; 3+ messages in thread
From: David Gow @ 2022-07-20  7:42 UTC (permalink / raw)
  To: Sadiya Kazi
  Cc: Brendan Higgins, Shuah Khan, Jonathan Corbet,
	open list:KERNEL SELFTEST FRAMEWORK, KUnit Development,
	open list:DOCUMENTATION, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 4738 bytes --]

On Tue, Jul 19, 2022 at 5:22 PM Sadiya Kazi <sadiyakazi@google.com> wrote:
>
> Run_wrapper.rst was missing some command line arguments. Added
> additional args in the file. Included all initial review comments.
>
> Signed-off-by: Sadiya Kazi <sadiyakazi@google.com>
> ---

This looks pretty good, save for some minor nitpicks below. I also
echo Maíra's comments, though I'm not _too_ worried about having a
little bit of duplication if it means we get a complete (or
nearly-complete) list of arguments here, but still have them described
in the appropriate part of the rest of the documentation.

Cheers,
-- David

>  Documentation/dev-tools/kunit/run_wrapper.rst | 48 +++++++++++++++++++
>  1 file changed, 48 insertions(+)
>
> diff --git a/Documentation/dev-tools/kunit/run_wrapper.rst b/Documentation/dev-tools/kunit/run_wrapper.rst
> index 5e560f2c5fca..91f5dda36e83 100644
> --- a/Documentation/dev-tools/kunit/run_wrapper.rst
> +++ b/Documentation/dev-tools/kunit/run_wrapper.rst
> @@ -257,3 +257,51 @@ command line arguments:
>              added or modified. Instead, enable all tests
>              which have satisfied dependencies by adding
>              ``CONFIG_KUNIT_ALL_TESTS=y`` to your ``.kunitconfig``.
> +- ``--kunitconfig``: Specifies the path to the ``.kunitconfig`` file.
> +  This Kconfig fragment enables KUnit tests. The "/.kunitconfig" gets
> +  appended to the path specified. For example, If a directory path "lib/kunit"
> +  is given, the complete path will be "lib/kunit/.kunitconfig".

This is definitely a bit confusing: it seems to describe "how it
works" more than "what is it, and when do you use it". Perhaps
something more like:

"Specifies a .kunitconfig file to use to build and run with a
predefined set of tests and their dependencies. (e.g., to run tests
for a given subsystem). This can be the path to a file, or to a
directory (in which case a file named ".kunitconfig" in said directory
will be used.)"

> +
> +- ``--kconfig_add``: Specifies additional configuration options to be
> +  appended to the ``.kunitconfig`` file. For example, ``CONFIG_KASAN=y``.
> +
> +- ``--arch``: Runs tests with the specified architecture. The architecture
> +  specified must match the string passed to the ARCH make parameter.
> +  For example, i386, x86_64, arm, um, etc. Non-UML architectures run on QEMU.
> +  Default to 'um'.
> +
> +- ``--cross_compile``: Specifies the Kbuild toolchain. It passes the
> +  same argument as passed to the ``CROSS_COMPILE`` variable used by
> +  Kbuild. This will be the prefix for the toolchain
> +  binaries such as GCC. For example:
> +
> +  - ``sparc64-linux-gnu`` if we have the sparc toolchain installed on
> +    our system.

This example should be ``sparc64-linux-gnu-`` (with the extra
hyphen-minus at the end). It's concatenated to produce, e.g.,
sparc64-linux-gnu-gcc.

> +
> +  - ``$HOME/toolchains/microblaze/gcc-9.2.0-nolibc/microblaze-linux/bin/microblaze-linux``
> +    if we have downloaded the microblaze toolchain from the 0-day
> +    website to a specified path in our home directory called toolchains.
> +
> +- ``--qemu_config``: Specifies the path to the file containing a
> +  custom qemu architecture definition. This should be a python file
> +  containing a QemuArchParams object.
> +
> +- ``--qemu_args``: Specifies additional QEMU arguments, for example, "-smp 8".
> +
> +- ``--jobs``: Specifies the number of jobs (commands) to run simultaneously.
> +  By default, this is set to the number of cores on your system.
> +
> +- ``--timeout``: Specifies the maximum number of seconds allowed for all tests to run.
> +  This does not include the time taken to build the tests.
> +
> +- ``--kernel_args``: Specifies the kernel command-line arguments. Might be repeated.

Nit: maybe "Specifies _additional_ kernel command-line arguments".
kunit_tool already sets some.

> +
> +- ``--run_isolated``: If set, boots the kernel for each individual suite/test.
> +  This is useful for debugging a non-hermetic test, one that
> +  might pass/fail based on what ran before it.



> +
> +- ``--raw_output``: If set, generates unformatted output from kernel.
> +  If set to ``--raw_output=kunit``, filters to just KUnit output.

--raw_output=kunit is the default if just --raw_output is set. You
need to specify --raw_output=all for the full kernel output.

> +
> +- ``--json``: If set, it stores the test results in a JSON format and prints to stdout or
> +  saves to a file if a filename is specified.

Nit: let's remove the first 'it' to be consistent with the previous
entries. i.e., "If set, stores..."

> --
> 2.37.0.170.g444d1eabd0-goog
>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4003 bytes --]

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

end of thread, other threads:[~2022-07-20  7:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-19  9:22 [PATCH] Documentation: kunit: Add CLI args for kunit_tool Sadiya Kazi
2022-07-19 12:08 ` Maíra Canal
2022-07-20  7:42 ` David Gow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).