]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
doc: make writing DM test subsection of writing C test
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Tue, 18 Nov 2025 20:17:30 +0000 (21:17 +0100)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Fri, 21 Nov 2025 18:25:56 +0000 (19:25 +0100)
A driver model test is just a special case of a C test.

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
doc/develop/tests_writing.rst

index 062194659b5afb956f8004970c4a14039dfac15e..b6972489d4c4d717f9353bd65957654bae209a22 100644 (file)
@@ -206,8 +206,36 @@ some common test tasks.
 
 (there are also UEFI C tests in lib/efi_selftest/ not considered here.)
 
+Add a C test to an existing suite
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Use this when you are adding to or modifying an existing feature outside driver
+model. An example is bloblist.
+
+Add a new function in the same file as the rest of the suite and register it
+with the suite. For example, to add a new mem_search test::
+
+   /* Test 'ms' command with 32-bit values */
+   static int mem_test_ms_new_thing(struct unit_test_state *uts)
+   {
+         /* test code here */
+
+         return 0;
+   }
+   MEM_TEST(mem_test_ms_new_thing, UTF_CONSOLE);
+
+Note that the MEM_TEST() macros is defined at the top of the file.
+
+Example commit: 9fe064646d2 ("bloblist: Support relocating to a larger space") [1]
+
+[1] https://gitlab.denx.de/u-boot/u-boot/-/commit/9fe064646d2
+
+
 Add a new driver model test
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
+'''''''''''''''''''''''''''
+
+``dm`` is the test suite that contains C tests for U-boot
+:doc:`Driver Model <driver-model/index>`.
 
 Use this when adding a test for a new or existing uclass, adding new operations
 or features to a uclass, adding new ofnode or dev_read_() functions, or anything
@@ -249,31 +277,6 @@ Example commit: c48cb7ebfb4 ("sandbox: add ADC unit tests") [1]
 [1] https://gitlab.denx.de/u-boot/u-boot/-/commit/c48cb7ebfb4
 
 
-Add a C test to an existing suite
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Use this when you are adding to or modifying an existing feature outside driver
-model. An example is bloblist.
-
-Add a new function in the same file as the rest of the suite and register it
-with the suite. For example, to add a new mem_search test::
-
-   /* Test 'ms' command with 32-bit values */
-   static int mem_test_ms_new_thing(struct unit_test_state *uts)
-   {
-         /* test code here */
-
-         return 0;
-   }
-   MEM_TEST(mem_test_ms_new_thing, UTF_CONSOLE);
-
-Note that the MEM_TEST() macros is defined at the top of the file.
-
-Example commit: 9fe064646d2 ("bloblist: Support relocating to a larger space") [1]
-
-[1] https://gitlab.denx.de/u-boot/u-boot/-/commit/9fe064646d2
-
-
 Add a new test suite
 ~~~~~~~~~~~~~~~~~~~~