<div dir="ltr"><div><br></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 12, 2023 at 10:29 AM Mauro Carvalho Chehab <<a href="mailto:mchehab@kernel.org" target="_blank">mchehab@kernel.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">As an example for the new documentation tool, add a documentation<br>
for drm_buddy_test.<br>
<br>
I opted to place this on a completely different directory, in order<br>
to make easier to test the feature with:<br>
<br>
        $ make SPHINXDIRS="tests" htmldocs<br>
<br>
Signed-off-by: Mauro Carvalho Chehab <<a href="mailto:mchehab@kernel.org" target="_blank">mchehab@kernel.org</a>><br>
---<br>
<br>
To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.<br>
See [PATCH RFC 0/2] at: <a href="https://lore.kernel.org/all/cover.1689171160.git.mchehab@kernel.org/" rel="noreferrer" target="_blank">https://lore.kernel.org/all/cover.1689171160.git.mchehab@kernel.org/</a><br>
<br>
 Documentation/index.rst                |  2 +-<br>
 Documentation/tests/index.rst          |  6 ++++++<br>
 Documentation/tests/kunit.rst          |  5 +++++<br>
 drivers/gpu/drm/tests/drm_buddy_test.c | 12 ++++++++++++<br>
 4 files changed, 24 insertions(+), 1 deletion(-)<br>
 create mode 100644 Documentation/tests/index.rst<br>
 create mode 100644 Documentation/tests/kunit.rst<br>
<br>
diff --git a/Documentation/index.rst b/Documentation/index.rst<br>
index 9dfdc826618c..80a6ce14a61a 100644<br>
--- a/Documentation/index.rst<br>
+++ b/Documentation/index.rst<br>
@@ -60,7 +60,7 @@ Various other manuals with useful information for all kernel developers.<br>
    fault-injection/index<br>
    livepatch/index<br>
    rust/index<br>
-<br>
+   test/index<br>
<br>
 User-oriented documentation<br>
 ===========================<br>
diff --git a/Documentation/tests/index.rst b/Documentation/tests/index.rst<br>
new file mode 100644<br>
index 000000000000..bfc39eb5c0aa<br>
--- /dev/null<br>
+++ b/Documentation/tests/index.rst<br>
@@ -0,0 +1,6 @@<br>
+========================<br>
+Kunit documentation test<br>
+========================<br>
+<br>
+.. toctree::<br>
+   kunit<br>
diff --git a/Documentation/tests/kunit.rst b/Documentation/tests/kunit.rst<br>
new file mode 100644<br>
index 000000000000..6ffc151988a0<br>
--- /dev/null<br>
+++ b/Documentation/tests/kunit.rst<br>
@@ -0,0 +1,5 @@<br>
+Kunit tests<br>
+-----------<br>
+<br>
+.. include-test:: drivers/gpu/drm/tests/drm_buddy_test.c<br>
+<br>
diff --git a/drivers/gpu/drm/tests/drm_buddy_test.c b/drivers/gpu/drm/tests/drm_buddy_test.c<br>
index 09ee6f6af896..dd6c5afd6cd6 100644<br>
--- a/drivers/gpu/drm/tests/drm_buddy_test.c<br>
+++ b/drivers/gpu/drm/tests/drm_buddy_test.c<br>
@@ -737,6 +737,18 @@ static int drm_buddy_suite_init(struct kunit_suite *suite)<br>
        return 0;<br>
 }<br>
<br>
+/**<br>
+ * KTEST_SUITE: set of tests for drm buddy alloc<br>
+ * Scope: drm subsystem<br>
+ * Mega feature: drm<br>
+ * Feature: buddy_alloc<br>
+ *<br>
+ * KTEST_TEST: drm_test_buddy_alloc_%s<br>
+ * Description: Run DRM buddy allocation %arg[1] test<br>
+ *<br>
+ * arg[1].values: limit, range, optimistic, smoke, pathological<br>
+ */</blockquote><div dir="auto"><br></div><div dir="auto">Hi!</div><div dir="auto"><br></div><div dir="auto">This is such a cool patch series. I just have a few comments related to the output.</div><div dir="auto"><br></div><div dir="auto">In the html output the tests are listed as:</div><div dir="auto">ktest@drm_buddy_test@…</div><div dir="auto"><br></div><div dir="auto">I wonder if instead of using the file name of “drm_buddy_test” this could possibly be the suite name, “drm_buddy”, as this is what users will call when using kunit.py to run the tests. Although "drm_buddy_test" is also the module name so I don't mind it too much. But in the future the file name and module name are not guaranteed to be the same for other tests. </div><div dir="auto"><br></div><div dir="auto">Most preferably, there would be a reference to the kunit suite name, file name, and the module name.</div><div dir="auto"><br></div><div dir="auto">This may be difficult to implement as these can all differ. I am currently working on the KUnit Attribute framework which saves the module name and I am thinking about also saving the file path as a future attribute. This could be a helpful framework for the KUnit tests specifically.</div><div dir="auto"><br></div><div>I am not sure how easy it would be to access c objects/functions using this system.</div><div><br></div><div>Finally, I was wondering if it is the intention to put a list of all kunit tests that use this new feature into tests/kunit.rst or would this be broken up in some way</div><div dir="auto"><br></div><div>Thanks!</div><div>-Rae</div><div dir="auto"><br></div><div dir="auto"><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" dir="auto"><br>
+<br>
 static struct kunit_case drm_buddy_tests[] = {<br>
        KUNIT_CASE(drm_test_buddy_alloc_limit),<br>
        KUNIT_CASE(drm_test_buddy_alloc_range),<br>
-- <br>
2.40.1<br>
<br>
</blockquote></div></div>
</div>