[PATCH 03/21] bloblist: test: doc: Move into the common suite

Simon Glass sjg at chromium.org
Mon Oct 28 13:41:08 CET 2024


There is no particular need for bloblist to have its own test suite.
Move it into the common suite instead.

Add the missing help for 'common' and update the docs.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 doc/usage/cmd/ut.rst   | 29 +++++++++++++++++++++-------
 test/cmd_ut.c          |  6 +-----
 test/common/bloblist.c | 44 ++++++++++++++----------------------------
 3 files changed, 38 insertions(+), 41 deletions(-)

diff --git a/doc/usage/cmd/ut.rst b/doc/usage/cmd/ut.rst
index afeafa824d6..cadabb964e7 100644
--- a/doc/usage/cmd/ut.rst
+++ b/doc/usage/cmd/ut.rst
@@ -70,7 +70,6 @@ List available unit-test suites::
     Suites:
     all - execute all enabled tests
     addrmap - very basic test of addrmap command
-    bloblist - bloblist implementation
     bootstd - standard boot implementation
     compression - compressors and bootm decompression
     dm - driver model
@@ -89,8 +88,8 @@ List available unit-test suites::
 
 Run one of the suites::
 
-    => ut bloblist
-    Running 14 bloblist tests
+    => ut common
+    Running 21 common tests
     Test: bloblist_test_align: bloblist.c
     Test: bloblist_test_bad_blob: bloblist.c
     Test: bloblist_test_blob: bloblist.c
@@ -105,16 +104,32 @@ Run one of the suites::
     Test: bloblist_test_resize_fail: bloblist.c
     Test: bloblist_test_resize_last: bloblist.c
     Test: bloblist_test_shrink: bloblist.c
-    Failures: 0
+    Test: cli_ch_test: cread.c
+    Test: cread_test: cread.c
+    Test: dm_test_cyclic_running: cyclic.c
+    Test: test_autoboot: test_autoboot.c
+    Enter password "a" in 1 seconds to stop autoboot
+    Enter password "a" in 1 seconds to stop autoboot
+    Enter password "a" in 1 seconds to stop autoboot
+    Enter password "a" in 1 seconds to stop autoboot
+    Enter password "a" in 1 seconds to stop autoboot
+    Enter password "a" in 1 seconds to stop autoboot
+    Autoboot password unlock not successful
+    Test: test_event_base: event.c
+    Test: test_event_probe: event.c
+    Test: test_event_probe: event.c (flat tree)
+    Test: test_event_simple: event.c
+    Skipped: 2, Failures: 0
+    =>
 
 Run just a single test in a suite::
 
-    => ut bloblist bloblist_test_grow
+    => ut common bloblist_test_grow
     Test: bloblist_test_grow: bloblist.c
     Failures: 0
 
 Show information about tests::
 
     => ut info
-    Test suites: 21
-    Total tests: 642
+    Test suites: 29
+    Total tests: 806
diff --git a/test/cmd_ut.c b/test/cmd_ut.c
index 53fddebd49d..cba97725f76 100644
--- a/test/cmd_ut.c
+++ b/test/cmd_ut.c
@@ -113,8 +113,6 @@ static struct cmd_tbl cmd_ut_sub[] = {
 #ifdef CONFIG_SANDBOX
 	U_BOOT_CMD_MKENT(compression, CONFIG_SYS_MAXARGS, 1, do_ut_compression,
 			 "", ""),
-	U_BOOT_CMD_MKENT(bloblist, CONFIG_SYS_MAXARGS, 1, do_ut_bloblist,
-			 "", ""),
 	U_BOOT_CMD_MKENT(bootm, CONFIG_SYS_MAXARGS, 1, do_ut_bootm, "", ""),
 #endif
 	U_BOOT_CMD_MKENT(str, CONFIG_SYS_MAXARGS, 1, do_ut_str, "", ""),
@@ -198,15 +196,13 @@ U_BOOT_LONGHELP(ut,
 #ifdef CONFIG_CMD_BDI
 	"\nbdinfo - bdinfo command"
 #endif
-#ifdef CONFIG_SANDBOX
-	"\nbloblist - bloblist implementation"
-#endif
 #ifdef CONFIG_BOOTSTD
 	"\nbootstd - standard boot implementation"
 #endif
 #ifdef CONFIG_CMDLINE
 	"\ncmd - test various commands"
 #endif
+	"\ncommon   - tests for common/ directory"
 #ifdef CONFIG_SANDBOX
 	"\ncompression - compressors and bootm decompression"
 #endif
diff --git a/test/common/bloblist.c b/test/common/bloblist.c
index 7b90fa7f352..dbd174299fd 100644
--- a/test/common/bloblist.c
+++ b/test/common/bloblist.c
@@ -6,14 +6,10 @@
 #include <bloblist.h>
 #include <log.h>
 #include <mapmem.h>
-#include <test/suites.h>
+#include <test/common.h>
 #include <test/test.h>
 #include <test/ut.h>
 
-/* Declare a new bloblist test */
-#define BLOBLIST_TEST(_name, _flags) \
-		UNIT_TEST(_name, _flags, bloblist_test)
-
 enum {
 	TEST_TAG		= BLOBLISTT_U_BOOT_SPL_HANDOFF,
 	TEST_TAG2		= BLOBLISTT_VBOOT_CTX,
@@ -91,7 +87,7 @@ static int bloblist_test_init(struct unit_test_state *uts)
 
 	return 1;
 }
-BLOBLIST_TEST(bloblist_test_init, 0);
+COMMON_TEST(bloblist_test_init, 0);
 
 static int bloblist_test_blob(struct unit_test_state *uts)
 {
@@ -131,7 +127,7 @@ static int bloblist_test_blob(struct unit_test_state *uts)
 
 	return 0;
 }
-BLOBLIST_TEST(bloblist_test_blob, 0);
+COMMON_TEST(bloblist_test_blob, 0);
 
 /* Check bloblist_ensure_size_ret() */
 static int bloblist_test_blob_ensure(struct unit_test_state *uts)
@@ -165,7 +161,7 @@ static int bloblist_test_blob_ensure(struct unit_test_state *uts)
 
 	return 0;
 }
-BLOBLIST_TEST(bloblist_test_blob_ensure, 0);
+COMMON_TEST(bloblist_test_blob_ensure, 0);
 
 static int bloblist_test_bad_blob(struct unit_test_state *uts)
 {
@@ -181,7 +177,7 @@ static int bloblist_test_bad_blob(struct unit_test_state *uts)
 
 	return 0;
 }
-BLOBLIST_TEST(bloblist_test_bad_blob, 0);
+COMMON_TEST(bloblist_test_bad_blob, 0);
 
 static int bloblist_test_checksum(struct unit_test_state *uts)
 {
@@ -254,7 +250,7 @@ static int bloblist_test_checksum(struct unit_test_state *uts)
 
 	return 0;
 }
-BLOBLIST_TEST(bloblist_test_checksum, 0);
+COMMON_TEST(bloblist_test_checksum, 0);
 
 /* Test the 'bloblist info' command */
 static int bloblist_test_cmd_info(struct unit_test_state *uts)
@@ -275,7 +271,7 @@ static int bloblist_test_cmd_info(struct unit_test_state *uts)
 
 	return 0;
 }
-BLOBLIST_TEST(bloblist_test_cmd_info, UTF_CONSOLE);
+COMMON_TEST(bloblist_test_cmd_info, UTF_CONSOLE);
 
 /* Test the 'bloblist list' command */
 static int bloblist_test_cmd_list(struct unit_test_state *uts)
@@ -297,7 +293,7 @@ static int bloblist_test_cmd_list(struct unit_test_state *uts)
 
 	return 0;
 }
-BLOBLIST_TEST(bloblist_test_cmd_list, UTF_CONSOLE);
+COMMON_TEST(bloblist_test_cmd_list, UTF_CONSOLE);
 
 /* Test alignment of bloblist blobs */
 static int bloblist_test_align(struct unit_test_state *uts)
@@ -355,7 +351,7 @@ static int bloblist_test_align(struct unit_test_state *uts)
 
 	return 0;
 }
-BLOBLIST_TEST(bloblist_test_align, 0);
+COMMON_TEST(bloblist_test_align, 0);
 
 /* Test relocation of a bloblist */
 static int bloblist_test_reloc(struct unit_test_state *uts)
@@ -389,7 +385,7 @@ static int bloblist_test_reloc(struct unit_test_state *uts)
 
 	return 0;
 }
-BLOBLIST_TEST(bloblist_test_reloc, 0);
+COMMON_TEST(bloblist_test_reloc, 0);
 
 /* Test expansion of a blob */
 static int bloblist_test_grow(struct unit_test_state *uts)
@@ -442,7 +438,7 @@ static int bloblist_test_grow(struct unit_test_state *uts)
 
 	return 0;
 }
-BLOBLIST_TEST(bloblist_test_grow, 0);
+COMMON_TEST(bloblist_test_grow, 0);
 
 /* Test shrinking of a blob */
 static int bloblist_test_shrink(struct unit_test_state *uts)
@@ -492,7 +488,7 @@ static int bloblist_test_shrink(struct unit_test_state *uts)
 
 	return 0;
 }
-BLOBLIST_TEST(bloblist_test_shrink, 0);
+COMMON_TEST(bloblist_test_shrink, 0);
 
 /* Test failing to adjust a blob size */
 static int bloblist_test_resize_fail(struct unit_test_state *uts)
@@ -527,7 +523,7 @@ static int bloblist_test_resize_fail(struct unit_test_state *uts)
 
 	return 0;
 }
-BLOBLIST_TEST(bloblist_test_resize_fail, 0);
+COMMON_TEST(bloblist_test_resize_fail, 0);
 
 /* Test expanding the last blob in a bloblist */
 static int bloblist_test_resize_last(struct unit_test_state *uts)
@@ -578,7 +574,7 @@ static int bloblist_test_resize_last(struct unit_test_state *uts)
 
 	return 0;
 }
-BLOBLIST_TEST(bloblist_test_resize_last, 0);
+COMMON_TEST(bloblist_test_resize_last, 0);
 
 /* Check a completely full bloblist */
 static int bloblist_test_blob_maxsize(struct unit_test_state *uts)
@@ -601,14 +597,4 @@ static int bloblist_test_blob_maxsize(struct unit_test_state *uts)
 
 	return 0;
 }
-BLOBLIST_TEST(bloblist_test_blob_maxsize, 0);
-
-int do_ut_bloblist(struct cmd_tbl *cmdtp, int flag, int argc,
-		   char *const argv[])
-{
-	struct unit_test *tests = UNIT_TEST_SUITE_START(bloblist_test);
-	const int n_ents = UNIT_TEST_SUITE_COUNT(bloblist_test);
-
-	return cmd_ut_category("bloblist", "bloblist_test_",
-			       tests, n_ents, argc, argv);
-}
+COMMON_TEST(bloblist_test_blob_maxsize, 0);
-- 
2.43.0



More information about the U-Boot mailing list