[PATCH v2 3/6] test: cmd: setexptr: Add tests for bitmap string format
lukas.funke-oss at weidmueller.com
lukas.funke-oss at weidmueller.com
Tue Dec 12 09:52:33 CET 2023
From: Lukas Funke <lukas.funke at weidmueller.com>
Add test to test the bitmap format specifier
Signed-off-by: Lukas Funke <lukas.funke at weidmueller.com>
---
(no changes since v1)
test/cmd/setexpr.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/test/cmd/setexpr.c b/test/cmd/setexpr.c
index 312593e1e3..4e1c9e983b 100644
--- a/test/cmd/setexpr.c
+++ b/test/cmd/setexpr.c
@@ -465,6 +465,15 @@ static int setexpr_test_fmt(struct unit_test_state *uts)
ut_asserteq(1, run_command("setexpr fred fmt hello% bf", 0));
/* Error exceeding maximum string length */
ut_asserteq(1, run_command("setexpr fred fmt \"%0128d\" 456", 0));
+ /* Test bitmask long string*/
+ ut_assertok(run_command("setexpr fred fmt isolcpu=%32pbl 0x1F1", 0));
+ ut_asserteq_str("isolcpu=0,4-8", env_get("fred"));
+ /* Test bitmask long string (more complicated) */
+ ut_assertok(run_command("setexpr fred fmt nohz_full=%32pbl 0x55555555", 0));
+ ut_asserteq_str("nohz_full=0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30", env_get("fred"));
+ /* Test bitmask short string*/
+ ut_assertok(run_command("setexpr fred fmt %32pb 0x55555555", 0));
+ ut_asserteq_str("55555555", env_get("fred"));
unmap_sysmem(buf);
--
2.30.2
More information about the U-Boot
mailing list