From: Rae Moar <rmoar@google.com>
To: shuah@kernel.org, davidgow@google.com, dlatypov@google.com,
brendan.higgins@linux.dev, sadiyakazi@google.com
Cc: keescook@chromium.org, arnd@arndb.de,
linux-kselftest@vger.kernel.org, linux-arch@vger.kernel.org,
kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org,
Rae Moar <rmoar@google.com>
Subject: [PATCH v3 6/6] Documentation: Add debugfs docs with run after boot
Date: Mon, 4 Dec 2023 22:19:31 +0000 [thread overview]
Message-ID: <20231204221932.1465004-6-rmoar@google.com> (raw)
In-Reply-To: <20231204221932.1465004-1-rmoar@google.com>
Expand the documentation on the KUnit debugfs filesystem on the
run_manual.rst page.
Add section describing how to access results using debugfs.
Add section describing how to run tests after boot using debugfs.
Signed-off-by: Rae Moar <rmoar@google.com>
---
Changes since v2:
- Add info to documentation about cleaning up data, init tests, and
running tests concurrently
Documentation/dev-tools/kunit/run_manual.rst | 49 ++++++++++++++++++--
1 file changed, 45 insertions(+), 4 deletions(-)
diff --git a/Documentation/dev-tools/kunit/run_manual.rst b/Documentation/dev-tools/kunit/run_manual.rst
index e7b46421f247..aebb52ba9605 100644
--- a/Documentation/dev-tools/kunit/run_manual.rst
+++ b/Documentation/dev-tools/kunit/run_manual.rst
@@ -49,9 +49,50 @@ loaded.
The results will appear in TAP format in ``dmesg``.
+debugfs
+=======
+
+``debugfs`` is a file system that enables user interaction with the files to
+make kernel information available to user space (See more information at
+Documentation/filesystems/debugfs.html)
+
+By default, only the root user has access to the debugfs directory.
+
+If ``CONFIG_KUNIT_DEBUGFS`` is enabled, you can use KUnit debugfs
+filesystem to perform the following actions.
+
+Retrieve Test Results
+=====================
+
+You can use debugfs to retrieve KUnit test results. The test results are
+accessible from the debugfs filesystem in the following read-only file:
+
+.. code-block :: bash
+
+ /sys/kernel/debug/kunit/<test_suite>/results
+
+The test results are available in KTAP format.
+
+Run Tests After Kernel Has Booted
+=================================
+
+You can use the debugfs filesystem to trigger built-in tests to run after
+boot. To run the test suite, you can use the following command to write to
+the ``/sys/kernel/debug/kunit/<test_suite>/run`` file:
+
+.. code-block :: bash
+
+ echo "any string" > /sys/kernel/debugfs/kunit/<test_suite>/run
+
+As a result, the test suite runs and the results are printed to the kernel
+log.
+
+However, this feature is not available with KUnit tests that use init data.
+
+Also, you cannot use this feature to run tests concurrently as there is a
+mutex lock around running KUnit tests at the same time.
+
.. note ::
- If ``CONFIG_KUNIT_DEBUGFS`` is enabled, KUnit test results will
- be accessible from the ``debugfs`` filesystem (if mounted).
- They will be in ``/sys/kernel/debug/kunit/<test_suite>/results``, in
- TAP format.
+ For test authors, to use this feature, tests will need to correctly initialise
+ and/or clean up any data, so the test runs correctly a second time.
--
2.43.0.rc2.451.g8631bc7472-goog
next prev parent reply other threads:[~2023-12-04 22:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-04 22:19 [PATCH v3 1/6] kunit: move KUNIT_TABLE out of INIT_DATA Rae Moar
2023-12-04 22:19 ` [PATCH v3 2/6] kunit: add KUNIT_INIT_TABLE to init linker section Rae Moar
2023-12-09 7:57 ` David Gow
2023-12-04 22:19 ` [PATCH v3 3/6] kunit: add example suite to test init suites Rae Moar
2023-12-09 7:57 ` David Gow
2023-12-04 22:19 ` [PATCH v3 4/6] kunit: add is_init test attribute Rae Moar
2023-12-09 7:57 ` David Gow
2023-12-11 22:24 ` Rae Moar
2023-12-04 22:19 ` [PATCH v3 5/6] kunit: add ability to run tests after boot using debugfs Rae Moar
2023-12-09 7:57 ` David Gow
2023-12-04 22:19 ` Rae Moar [this message]
2023-12-09 7:57 ` [PATCH v3 6/6] Documentation: Add debugfs docs with run after boot David Gow
2023-12-11 22:16 ` Rae Moar
2023-12-09 7:48 ` [PATCH v3 1/6] kunit: move KUNIT_TABLE out of INIT_DATA David Gow
2023-12-11 22:08 ` Rae Moar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231204221932.1465004-6-rmoar@google.com \
--to=rmoar@google.com \
--cc=arnd@arndb.de \
--cc=brendan.higgins@linux.dev \
--cc=davidgow@google.com \
--cc=dlatypov@google.com \
--cc=keescook@chromium.org \
--cc=kunit-dev@googlegroups.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=sadiyakazi@google.com \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox