From patchwork Mon Jun 8 02:43:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 241896 List-Id: U-Boot discussion From: sjg at chromium.org (Simon Glass) Date: Sun, 7 Jun 2020 20:43:28 -0600 Subject: [PATCH v2 01/10] Update MEM_SUPPORT_64BIT_DATA to be always defined In-Reply-To: <20200608024337.85575-1-sjg@chromium.org> References: <20200608024337.85575-1-sjg@chromium.org> Message-ID: <20200607204328.v2.1.Ibc067a3d1c5425aa60dfb9314a23d6dc5c2e480d@changeid> Define this macro always so we don't need the preprocessor to check it. Convert the users to #if instead of #ifdef. Note that '#if MEM_SUPPORT_64BIT_DATA' does not give an error if the macro is not define. It just assumes zero. Signed-off-by: Simon Glass Reviewed-by: Stefan Roese --- (no changes since v1) cmd/mem.c | 54 +++++++++++++++++++++---------------------- common/command.c | 2 +- include/compiler.h | 4 +++- lib/display_options.c | 6 ++--- 4 files changed, 34 insertions(+), 32 deletions(-) diff --git a/cmd/mem.c b/cmd/mem.c index 9b97f7bf69..fe43427d3c 100644 --- a/cmd/mem.c +++ b/cmd/mem.c @@ -116,7 +116,7 @@ static int do_mem_nm(struct cmd_tbl *cmdtp, int flag, int argc, static int do_mem_mw(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA u64 writeval; #else ulong writeval; @@ -141,7 +141,7 @@ static int do_mem_mw(struct cmd_tbl *cmdtp, int flag, int argc, /* Get the value to write. */ -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA writeval = simple_strtoull(argv[2], NULL, 16); #else writeval = simple_strtoul(argv[2], NULL, 16); @@ -160,7 +160,7 @@ static int do_mem_mw(struct cmd_tbl *cmdtp, int flag, int argc, while (count-- > 0) { if (size == 4) *((u32 *)buf) = (u32)writeval; -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA else if (size == 8) *((u64 *)buf) = (u64)writeval; #endif @@ -240,7 +240,7 @@ static int do_mem_cmp(struct cmd_tbl *cmdtp, int flag, int argc, int rcode = 0; const char *type; const void *buf1, *buf2, *base; -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA u64 word1, word2; #else ulong word1, word2; @@ -272,7 +272,7 @@ static int do_mem_cmp(struct cmd_tbl *cmdtp, int flag, int argc, if (size == 4) { word1 = *(u32 *)buf1; word2 = *(u32 *)buf2; -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA } else if (size == 8) { word1 = *(u64 *)buf1; word2 = *(u64 *)buf2; @@ -286,7 +286,7 @@ static int do_mem_cmp(struct cmd_tbl *cmdtp, int flag, int argc, } if (word1 != word2) { ulong offset = buf1 - base; -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA printf("%s at 0x%p (%#0*llx) != %s at 0x%p (%#0*llx)\n", type, (void *)(addr1 + offset), size, word1, type, (void *)(addr2 + offset), size, word2); @@ -391,7 +391,7 @@ static int do_mem_loop(struct cmd_tbl *cmdtp, int flag, int argc, { ulong addr, length, i, bytes; int size; -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA volatile u64 *llp; #endif volatile u32 *longp; @@ -424,7 +424,7 @@ static int do_mem_loop(struct cmd_tbl *cmdtp, int flag, int argc, * If we have only one object, just run infinite loops. */ if (length == 1) { -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA if (size == 8) { llp = (u64 *)buf; for (;;) @@ -446,7 +446,7 @@ static int do_mem_loop(struct cmd_tbl *cmdtp, int flag, int argc, i = *cp; } -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA if (size == 8) { for (;;) { llp = (u64 *)buf; @@ -489,7 +489,7 @@ static int do_mem_loopw(struct cmd_tbl *cmdtp, int flag, int argc, { ulong addr, length, i, bytes; int size; -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA volatile u64 *llp; u64 data; #else @@ -519,7 +519,7 @@ static int do_mem_loopw(struct cmd_tbl *cmdtp, int flag, int argc, length = simple_strtoul(argv[2], NULL, 16); /* data to write */ -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA data = simple_strtoull(argv[3], NULL, 16); #else data = simple_strtoul(argv[3], NULL, 16); @@ -532,7 +532,7 @@ static int do_mem_loopw(struct cmd_tbl *cmdtp, int flag, int argc, * If we have only one object, just run infinite loops. */ if (length == 1) { -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA if (size == 8) { llp = (u64 *)buf; for (;;) @@ -554,7 +554,7 @@ static int do_mem_loopw(struct cmd_tbl *cmdtp, int flag, int argc, *cp = data; } -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA if (size == 8) { for (;;) { llp = (u64 *)buf; @@ -1023,7 +1023,7 @@ mod_mem(struct cmd_tbl *cmdtp, int incrflag, int flag, int argc, char *const argv[]) { ulong addr; -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA u64 i; #else ulong i; @@ -1062,7 +1062,7 @@ mod_mem(struct cmd_tbl *cmdtp, int incrflag, int flag, int argc, printf("%08lx:", addr); if (size == 4) printf(" %08x", *((u32 *)ptr)); -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA else if (size == 8) printf(" %016llx", *((u64 *)ptr)); #endif @@ -1089,7 +1089,7 @@ mod_mem(struct cmd_tbl *cmdtp, int incrflag, int flag, int argc, #endif else { char *endp; -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA i = simple_strtoull(console_buffer, &endp, 16); #else i = simple_strtoul(console_buffer, &endp, 16); @@ -1101,7 +1101,7 @@ mod_mem(struct cmd_tbl *cmdtp, int incrflag, int flag, int argc, bootretry_reset_cmd_timeout(); if (size == 4) *((u32 *)ptr) = i; -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA else if (size == 8) *((u64 *)ptr) = i; #endif @@ -1196,7 +1196,7 @@ static int do_random(struct cmd_tbl *cmdtp, int flag, int argc, U_BOOT_CMD( md, 3, 1, do_mem_md, "memory display", -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA "[.b, .w, .l, .q] address [# of objects]" #else "[.b, .w, .l] address [# of objects]" @@ -1207,7 +1207,7 @@ U_BOOT_CMD( U_BOOT_CMD( mm, 2, 1, do_mem_mm, "memory modify (auto-incrementing address)", -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA "[.b, .w, .l, .q] address" #else "[.b, .w, .l] address" @@ -1218,7 +1218,7 @@ U_BOOT_CMD( U_BOOT_CMD( nm, 2, 1, do_mem_nm, "memory modify (constant address)", -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA "[.b, .w, .l, .q] address" #else "[.b, .w, .l] address" @@ -1228,7 +1228,7 @@ U_BOOT_CMD( U_BOOT_CMD( mw, 4, 1, do_mem_mw, "memory write (fill)", -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA "[.b, .w, .l, .q] address value [count]" #else "[.b, .w, .l] address value [count]" @@ -1238,7 +1238,7 @@ U_BOOT_CMD( U_BOOT_CMD( cp, 4, 1, do_mem_cp, "memory copy", -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA "[.b, .w, .l, .q] source target count" #else "[.b, .w, .l] source target count" @@ -1248,7 +1248,7 @@ U_BOOT_CMD( U_BOOT_CMD( cmp, 4, 1, do_mem_cmp, "memory compare", -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA "[.b, .w, .l, .q] addr1 addr2 count" #else "[.b, .w, .l] addr1 addr2 count" @@ -1299,7 +1299,7 @@ U_BOOT_CMD( U_BOOT_CMD( loop, 3, 1, do_mem_loop, "infinite loop on address range", -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA "[.b, .w, .l, .q] address number_of_objects" #else "[.b, .w, .l] address number_of_objects" @@ -1310,7 +1310,7 @@ U_BOOT_CMD( U_BOOT_CMD( loopw, 4, 1, do_mem_loopw, "infinite write loop on address range", -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA "[.b, .w, .l, .q] address number_of_objects data_to_write" #else "[.b, .w, .l] address number_of_objects data_to_write" @@ -1330,7 +1330,7 @@ U_BOOT_CMD( U_BOOT_CMD( mdc, 4, 1, do_mem_mdc, "memory display cyclic", -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA "[.b, .w, .l, .q] address count delay(ms)" #else "[.b, .w, .l] address count delay(ms)" @@ -1340,7 +1340,7 @@ U_BOOT_CMD( U_BOOT_CMD( mwc, 4, 1, do_mem_mwc, "memory write cyclic", -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA "[.b, .w, .l, .q] address value delay(ms)" #else "[.b, .w, .l] address value delay(ms)" diff --git a/common/command.c b/common/command.c index 4f49f15bfd..fc37ed4d7c 100644 --- a/common/command.c +++ b/common/command.c @@ -473,7 +473,7 @@ int cmd_get_data_size(char* arg, int default_size) return 2; case 'l': return 4; -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA case 'q': return 8; #endif diff --git a/include/compiler.h b/include/compiler.h index ed74c272b8..90b7afae53 100644 --- a/include/compiler.h +++ b/include/compiler.h @@ -145,7 +145,9 @@ typedef unsigned long int uintptr_t; #define unlikely(x) __builtin_expect(!!(x), 0) #ifdef __LP64__ -#define MEM_SUPPORT_64BIT_DATA +#define MEM_SUPPORT_64BIT_DATA 1 +#else +#define MEM_SUPPORT_64BIT_DATA 0 #endif #endif diff --git a/lib/display_options.c b/lib/display_options.c index 1dd5b6affd..f4b1059c24 100644 --- a/lib/display_options.c +++ b/lib/display_options.c @@ -138,7 +138,7 @@ int print_buffer(ulong addr, const void *data, uint width, uint count, { /* linebuf as a union causes proper alignment */ union linebuf { -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA uint64_t uq[MAX_LINE_LENGTH_BYTES/sizeof(uint64_t) + 1]; #endif uint32_t ui[MAX_LINE_LENGTH_BYTES/sizeof(uint32_t) + 1]; @@ -146,7 +146,7 @@ int print_buffer(ulong addr, const void *data, uint width, uint count, uint8_t uc[MAX_LINE_LENGTH_BYTES/sizeof(uint8_t) + 1]; } lb; int i; -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA uint64_t __maybe_unused x; #else uint32_t __maybe_unused x; @@ -169,7 +169,7 @@ int print_buffer(ulong addr, const void *data, uint width, uint count, for (i = 0; i < thislinelen; i++) { if (width == 4) x = lb.ui[i] = *(volatile uint32_t *)data; -#ifdef MEM_SUPPORT_64BIT_DATA +#if MEM_SUPPORT_64BIT_DATA else if (width == 8) x = lb.uq[i] = *(volatile uint64_t *)data; #endif From patchwork Mon Jun 8 02:43:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 241897 List-Id: U-Boot discussion From: sjg at chromium.org (Simon Glass) Date: Sun, 7 Jun 2020 20:43:29 -0600 Subject: [PATCH v2 02/10] cmd: mem: Use a macro to avoid #ifdef in help In-Reply-To: <20200608024337.85575-1-sjg@chromium.org> References: <20200608024337.85575-1-sjg@chromium.org> Message-ID: <20200607204328.v2.2.I20e53b990f01eec7de8a443fdf410d109ca0f159@changeid> It is a bit painful to have #ifdefs in the middle of the help for each command. Add a macro to avoid this. Signed-off-by: Simon Glass Reviewed-by: Stefan Roese --- (no changes since v1) cmd/mem.c | 68 ++++++++++++++----------------------------------------- 1 file changed, 17 insertions(+), 51 deletions(-) diff --git a/cmd/mem.c b/cmd/mem.c index fe43427d3c..da02bbce95 100644 --- a/cmd/mem.c +++ b/cmd/mem.c @@ -33,6 +33,13 @@ DECLARE_GLOBAL_DATA_PTR; #define CONFIG_SYS_MEMTEST_SCRATCH 0 #endif +/* Create a compile-time value */ +#if MEM_SUPPORT_64BIT_DATA +#define HELP_Q ", .q" +#else +#define HELP_Q "" +#endif + static int mod_mem(struct cmd_tbl *, int, int, int, char * const []); /* Display values from last command. @@ -1016,7 +1023,6 @@ static int do_mem_mtest(struct cmd_tbl *cmdtp, int flag, int argc, * * Syntax: * mm{.b, .w, .l, .q} {addr} - * nm{.b, .w, .l, .q} {addr} */ static int mod_mem(struct cmd_tbl *cmdtp, int incrflag, int flag, int argc, @@ -1196,63 +1202,39 @@ static int do_random(struct cmd_tbl *cmdtp, int flag, int argc, U_BOOT_CMD( md, 3, 1, do_mem_md, "memory display", -#if MEM_SUPPORT_64BIT_DATA - "[.b, .w, .l, .q] address [# of objects]" -#else - "[.b, .w, .l] address [# of objects]" -#endif + "[.b, .w, .l" HELP_Q "] address [# of objects]" ); U_BOOT_CMD( mm, 2, 1, do_mem_mm, "memory modify (auto-incrementing address)", -#if MEM_SUPPORT_64BIT_DATA - "[.b, .w, .l, .q] address" -#else - "[.b, .w, .l] address" -#endif + "[.b, .w, .l" HELP_Q "] address" ); U_BOOT_CMD( nm, 2, 1, do_mem_nm, "memory modify (constant address)", -#if MEM_SUPPORT_64BIT_DATA - "[.b, .w, .l, .q] address" -#else - "[.b, .w, .l] address" -#endif + "[.b, .w, .l" HELP_Q "] address" ); U_BOOT_CMD( mw, 4, 1, do_mem_mw, "memory write (fill)", -#if MEM_SUPPORT_64BIT_DATA - "[.b, .w, .l, .q] address value [count]" -#else - "[.b, .w, .l] address value [count]" -#endif + "[.b, .w, .l" HELP_Q "] address value [count]" ); U_BOOT_CMD( cp, 4, 1, do_mem_cp, "memory copy", -#if MEM_SUPPORT_64BIT_DATA - "[.b, .w, .l, .q] source target count" -#else - "[.b, .w, .l] source target count" -#endif + "[.b, .w, .l" HELP_Q "] source target count" ); U_BOOT_CMD( cmp, 4, 1, do_mem_cmp, "memory compare", -#if MEM_SUPPORT_64BIT_DATA - "[.b, .w, .l, .q] addr1 addr2 count" -#else - "[.b, .w, .l] addr1 addr2 count" -#endif + "[.b, .w, .l" HELP_Q "] addr1 addr2 count" ); #ifdef CONFIG_CMD_CRC32 @@ -1299,22 +1281,14 @@ U_BOOT_CMD( U_BOOT_CMD( loop, 3, 1, do_mem_loop, "infinite loop on address range", -#if MEM_SUPPORT_64BIT_DATA - "[.b, .w, .l, .q] address number_of_objects" -#else - "[.b, .w, .l] address number_of_objects" -#endif + "[.b, .w, .l" HELP_Q "] address number_of_objects" ); #ifdef CONFIG_LOOPW U_BOOT_CMD( loopw, 4, 1, do_mem_loopw, "infinite write loop on address range", -#if MEM_SUPPORT_64BIT_DATA - "[.b, .w, .l, .q] address number_of_objects data_to_write" -#else - "[.b, .w, .l] address number_of_objects data_to_write" -#endif + "[.b, .w, .l" HELP_Q "] address number_of_objects data_to_write" ); #endif /* CONFIG_LOOPW */ @@ -1330,21 +1304,13 @@ U_BOOT_CMD( U_BOOT_CMD( mdc, 4, 1, do_mem_mdc, "memory display cyclic", -#if MEM_SUPPORT_64BIT_DATA - "[.b, .w, .l, .q] address count delay(ms)" -#else - "[.b, .w, .l] address count delay(ms)" -#endif + "[.b, .w, .l" HELP_Q "] address count delay(ms)" ); U_BOOT_CMD( mwc, 4, 1, do_mem_mwc, "memory write cyclic", -#if MEM_SUPPORT_64BIT_DATA - "[.b, .w, .l, .q] address value delay(ms)" -#else - "[.b, .w, .l] address value delay(ms)" -#endif + "[.b, .w, .l" HELP_Q "] address value delay(ms)" ); #endif /* CONFIG_CMD_MX_CYCLIC */ From patchwork Mon Jun 8 02:43:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 241900 List-Id: U-Boot discussion From: sjg at chromium.org (Simon Glass) Date: Sun, 7 Jun 2020 20:43:30 -0600 Subject: [PATCH v2 03/10] cmd: mem: Drop #ifdef for MEM_SUPPORT_64BIT_DATA In-Reply-To: <20200608024337.85575-1-sjg@chromium.org> References: <20200608024337.85575-1-sjg@chromium.org> Message-ID: <20200607204328.v2.3.I47d7286dc9fe42c0ccfe4fb078bf85a87783b0eb@changeid> This is defined only when __lp64__ is defined. That means that ulong is 64 bits long. Therefore we don't need to use a separate u64 type on those architectures. Fix up the code to take advantage of that, removing the preprocessor conditions. Signed-off-by: Simon Glass Reviewed-by: Stefan Roese --- Changes in v2: - Use MEM_SUPPORT_64BIT_DATA instead of a new define cmd/mem.c | 115 +++++++++++++++++------------------------------------- 1 file changed, 36 insertions(+), 79 deletions(-) diff --git a/cmd/mem.c b/cmd/mem.c index da02bbce95..ab2c9df621 100644 --- a/cmd/mem.c +++ b/cmd/mem.c @@ -34,7 +34,7 @@ DECLARE_GLOBAL_DATA_PTR; #endif /* Create a compile-time value */ -#if MEM_SUPPORT_64BIT_DATA +#ifdef MEM_SUPPORT_64BIT_DATA #define HELP_Q ", .q" #else #define HELP_Q "" @@ -123,11 +123,7 @@ static int do_mem_nm(struct cmd_tbl *cmdtp, int flag, int argc, static int do_mem_mw(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { -#if MEM_SUPPORT_64BIT_DATA - u64 writeval; -#else - ulong writeval; -#endif + ulong writeval; /* 64-bit if MEM_SUPPORT_64BIT_DATA */ ulong addr, count; int size; void *buf, *start; @@ -148,11 +144,10 @@ static int do_mem_mw(struct cmd_tbl *cmdtp, int flag, int argc, /* Get the value to write. */ -#if MEM_SUPPORT_64BIT_DATA - writeval = simple_strtoull(argv[2], NULL, 16); -#else - writeval = simple_strtoul(argv[2], NULL, 16); -#endif + if (MEM_SUPPORT_64BIT_DATA) + writeval = simple_strtoull(argv[2], NULL, 16); + else + writeval = simple_strtoul(argv[2], NULL, 16); /* Count ? */ if (argc == 4) { @@ -167,10 +162,8 @@ static int do_mem_mw(struct cmd_tbl *cmdtp, int flag, int argc, while (count-- > 0) { if (size == 4) *((u32 *)buf) = (u32)writeval; -#if MEM_SUPPORT_64BIT_DATA - else if (size == 8) - *((u64 *)buf) = (u64)writeval; -#endif + else if (MEM_SUPPORT_64BIT_DATA && size == 8) + *((ulong *)buf) = writeval; else if (size == 2) *((u16 *)buf) = (u16)writeval; else @@ -247,11 +240,7 @@ static int do_mem_cmp(struct cmd_tbl *cmdtp, int flag, int argc, int rcode = 0; const char *type; const void *buf1, *buf2, *base; -#if MEM_SUPPORT_64BIT_DATA - u64 word1, word2; -#else - ulong word1, word2; -#endif + ulong word1, word2; /* 64-bit if MEM_SUPPORT_64BIT_DATA */ if (argc != 4) return CMD_RET_USAGE; @@ -279,11 +268,9 @@ static int do_mem_cmp(struct cmd_tbl *cmdtp, int flag, int argc, if (size == 4) { word1 = *(u32 *)buf1; word2 = *(u32 *)buf2; -#if MEM_SUPPORT_64BIT_DATA - } else if (size == 8) { - word1 = *(u64 *)buf1; - word2 = *(u64 *)buf2; -#endif + } else if (MEM_SUPPORT_64BIT_DATA && size == 8) { + word1 = *(ulong *)buf1; + word2 = *(ulong *)buf2; } else if (size == 2) { word1 = *(u16 *)buf1; word2 = *(u16 *)buf2; @@ -293,15 +280,9 @@ static int do_mem_cmp(struct cmd_tbl *cmdtp, int flag, int argc, } if (word1 != word2) { ulong offset = buf1 - base; -#if MEM_SUPPORT_64BIT_DATA - printf("%s at 0x%p (%#0*llx) != %s at 0x%p (%#0*llx)\n", - type, (void *)(addr1 + offset), size, word1, - type, (void *)(addr2 + offset), size, word2); -#else printf("%s at 0x%08lx (%#0*lx) != %s at 0x%08lx (%#0*lx)\n", type, (ulong)(addr1 + offset), size, word1, type, (ulong)(addr2 + offset), size, word2); -#endif rcode = 1; break; } @@ -398,9 +379,7 @@ static int do_mem_loop(struct cmd_tbl *cmdtp, int flag, int argc, { ulong addr, length, i, bytes; int size; -#if MEM_SUPPORT_64BIT_DATA - volatile u64 *llp; -#endif + volatile ulong *llp; /* 64-bit if MEM_SUPPORT_64BIT_DATA */ volatile u32 *longp; volatile u16 *shortp; volatile u8 *cp; @@ -431,13 +410,11 @@ static int do_mem_loop(struct cmd_tbl *cmdtp, int flag, int argc, * If we have only one object, just run infinite loops. */ if (length == 1) { -#if MEM_SUPPORT_64BIT_DATA - if (size == 8) { - llp = (u64 *)buf; + if (MEM_SUPPORT_64BIT_DATA && size == 8) { + llp = (ulong *)buf; for (;;) i = *llp; } -#endif if (size == 4) { longp = (u32 *)buf; for (;;) @@ -453,16 +430,14 @@ static int do_mem_loop(struct cmd_tbl *cmdtp, int flag, int argc, i = *cp; } -#if MEM_SUPPORT_64BIT_DATA - if (size == 8) { + if (MEM_SUPPORT_64BIT_DATA && size == 8) { for (;;) { - llp = (u64 *)buf; + llp = (ulong *)buf; i = length; while (i-- > 0) *llp++; } } -#endif if (size == 4) { for (;;) { longp = (u32 *)buf; @@ -496,12 +471,8 @@ static int do_mem_loopw(struct cmd_tbl *cmdtp, int flag, int argc, { ulong addr, length, i, bytes; int size; -#if MEM_SUPPORT_64BIT_DATA - volatile u64 *llp; - u64 data; -#else - ulong data; -#endif + volatile ulong *llp; /* 64-bit if MEM_SUPPORT_64BIT_DATA */ + ulong data; /* 64-bit if MEM_SUPPORT_64BIT_DATA */ volatile u32 *longp; volatile u16 *shortp; volatile u8 *cp; @@ -526,11 +497,10 @@ static int do_mem_loopw(struct cmd_tbl *cmdtp, int flag, int argc, length = simple_strtoul(argv[2], NULL, 16); /* data to write */ -#if MEM_SUPPORT_64BIT_DATA - data = simple_strtoull(argv[3], NULL, 16); -#else - data = simple_strtoul(argv[3], NULL, 16); -#endif + if (MEM_SUPPORT_64BIT_DATA) + data = simple_strtoull(argv[3], NULL, 16); + else + data = simple_strtoul(argv[3], NULL, 16); bytes = size * length; buf = map_sysmem(addr, bytes); @@ -539,13 +509,11 @@ static int do_mem_loopw(struct cmd_tbl *cmdtp, int flag, int argc, * If we have only one object, just run infinite loops. */ if (length == 1) { -#if MEM_SUPPORT_64BIT_DATA - if (size == 8) { - llp = (u64 *)buf; + if (MEM_SUPPORT_64BIT_DATA && size == 8) { + llp = (ulong *)buf; for (;;) *llp = data; } -#endif if (size == 4) { longp = (u32 *)buf; for (;;) @@ -561,16 +529,14 @@ static int do_mem_loopw(struct cmd_tbl *cmdtp, int flag, int argc, *cp = data; } -#if MEM_SUPPORT_64BIT_DATA - if (size == 8) { + if (MEM_SUPPORT_64BIT_DATA && size == 8) { for (;;) { - llp = (u64 *)buf; + llp = (ulong *)buf; i = length; while (i-- > 0) *llp++ = data; } } -#endif if (size == 4) { for (;;) { longp = (u32 *)buf; @@ -1029,11 +995,7 @@ mod_mem(struct cmd_tbl *cmdtp, int incrflag, int flag, int argc, char *const argv[]) { ulong addr; -#if MEM_SUPPORT_64BIT_DATA - u64 i; -#else - ulong i; -#endif + ulong i; /* 64-bit if MEM_SUPPORT_64BIT_DATA */ int nbytes, size; void *ptr = NULL; @@ -1068,10 +1030,8 @@ mod_mem(struct cmd_tbl *cmdtp, int incrflag, int flag, int argc, printf("%08lx:", addr); if (size == 4) printf(" %08x", *((u32 *)ptr)); -#if MEM_SUPPORT_64BIT_DATA - else if (size == 8) - printf(" %016llx", *((u64 *)ptr)); -#endif + else if (MEM_SUPPORT_64BIT_DATA && size == 8) + printf(" %0lx", *((ulong *)ptr)); else if (size == 2) printf(" %04x", *((u16 *)ptr)); else @@ -1095,11 +1055,10 @@ mod_mem(struct cmd_tbl *cmdtp, int incrflag, int flag, int argc, #endif else { char *endp; -#if MEM_SUPPORT_64BIT_DATA - i = simple_strtoull(console_buffer, &endp, 16); -#else - i = simple_strtoul(console_buffer, &endp, 16); -#endif + if (MEM_SUPPORT_64BIT_DATA) + i = simple_strtoull(console_buffer, &endp, 16); + else + i = simple_strtoul(console_buffer, &endp, 16); nbytes = endp - console_buffer; if (nbytes) { /* good enough to not time out @@ -1107,10 +1066,8 @@ mod_mem(struct cmd_tbl *cmdtp, int incrflag, int flag, int argc, bootretry_reset_cmd_timeout(); if (size == 4) *((u32 *)ptr) = i; -#if MEM_SUPPORT_64BIT_DATA - else if (size == 8) - *((u64 *)ptr) = i; -#endif + else if (MEM_SUPPORT_64BIT_DATA && size == 8) + *((ulong *)ptr) = i; else if (size == 2) *((u16 *)ptr) = i; else From patchwork Mon Jun 8 02:43:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 241898 List-Id: U-Boot discussion From: sjg at chromium.org (Simon Glass) Date: Sun, 7 Jun 2020 20:43:31 -0600 Subject: [PATCH v2 04/10] display_options: Drop #ifdef for MEM_SUPPORT_64BIT_DATA In-Reply-To: <20200608024337.85575-1-sjg@chromium.org> References: <20200608024337.85575-1-sjg@chromium.org> Message-ID: <20200607204328.v2.4.I47d7286dc9fe42c0ccfe4fb078bf85a87783b0eb@changeid> This is defined only when __lp64__ is defined. That means that ulong is 64 bits long. Therefore we don't need to use a separate u64 type on those architectures. Fix up the code to take advantage of that, removing the preprocessor conditions. Signed-off-by: Simon Glass Reviewed-by: Stefan Roese --- (no changes since v1) lib/display_options.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/lib/display_options.c b/lib/display_options.c index f4b1059c24..ea9977cc18 100644 --- a/lib/display_options.c +++ b/lib/display_options.c @@ -138,19 +138,13 @@ int print_buffer(ulong addr, const void *data, uint width, uint count, { /* linebuf as a union causes proper alignment */ union linebuf { -#if MEM_SUPPORT_64BIT_DATA uint64_t uq[MAX_LINE_LENGTH_BYTES/sizeof(uint64_t) + 1]; -#endif uint32_t ui[MAX_LINE_LENGTH_BYTES/sizeof(uint32_t) + 1]; uint16_t us[MAX_LINE_LENGTH_BYTES/sizeof(uint16_t) + 1]; uint8_t uc[MAX_LINE_LENGTH_BYTES/sizeof(uint8_t) + 1]; } lb; int i; -#if MEM_SUPPORT_64BIT_DATA - uint64_t __maybe_unused x; -#else - uint32_t __maybe_unused x; -#endif + ulong x; if (linelen*width > MAX_LINE_LENGTH_BYTES) linelen = MAX_LINE_LENGTH_BYTES / width; @@ -169,20 +163,16 @@ int print_buffer(ulong addr, const void *data, uint width, uint count, for (i = 0; i < thislinelen; i++) { if (width == 4) x = lb.ui[i] = *(volatile uint32_t *)data; -#if MEM_SUPPORT_64BIT_DATA - else if (width == 8) - x = lb.uq[i] = *(volatile uint64_t *)data; -#endif + else if (MEM_SUPPORT_64BIT_DATA && width == 8) + x = lb.uq[i] = *(volatile ulong *)data; else if (width == 2) x = lb.us[i] = *(volatile uint16_t *)data; else x = lb.uc[i] = *(volatile uint8_t *)data; #if defined(CONFIG_SPL_BUILD) printf(" %x", (uint)x); -#elif defined(MEM_SUPPORT_64BIT_DATA) - printf(" %0*llx", width * 2, (long long)x); #else - printf(" %0*x", width * 2, x); + printf(" %0*lx", width * 2, x); #endif data += width; } From patchwork Mon Jun 8 02:43:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 241899 List-Id: U-Boot discussion From: sjg at chromium.org (Simon Glass) Date: Sun, 7 Jun 2020 20:43:32 -0600 Subject: [PATCH v2 05/10] command: Drop #ifdef for MEM_SUPPORT_64BIT_DATA In-Reply-To: <20200608024337.85575-1-sjg@chromium.org> References: <20200608024337.85575-1-sjg@chromium.org> Message-ID: <20200607204328.v2.5.Id801bb27e51c631b4d06e973d233e950e25fc8a3@changeid> This is defined only when __lp64__ is defined. That means that ulong is 64 bits long. Therefore we don't need to use a separate u64 type on those architectures. Fix up the code to take advantage of that, removing the preprocessor conditions. Also include the header file that defines MEM_SUPPORT_64BIT_DATA. It is included by env.h in this file, but that might not last forever. Signed-off-by: Simon Glass --- (no changes since v1) common/command.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/common/command.c b/common/command.c index fc37ed4d7c..2c491e20a7 100644 --- a/common/command.c +++ b/common/command.c @@ -9,6 +9,7 @@ */ #include +#include #include #include #include @@ -473,12 +474,12 @@ int cmd_get_data_size(char* arg, int default_size) return 2; case 'l': return 4; -#if MEM_SUPPORT_64BIT_DATA - case 'q': - return 8; -#endif case 's': return -2; + case 'q': + if (MEM_SUPPORT_64BIT_DATA) + return 8; + /* no break */ default: return -1; } From patchwork Mon Jun 8 02:43:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 241901 List-Id: U-Boot discussion From: sjg at chromium.org (Simon Glass) Date: Sun, 7 Jun 2020 20:43:33 -0600 Subject: [PATCH v2 06/10] test: Add a way to check part of a console line or skip it In-Reply-To: <20200608024337.85575-1-sjg@chromium.org> References: <20200608024337.85575-1-sjg@chromium.org> Message-ID: <20200607204328.v2.6.Ieff8961f595591ceef66847ff1ee0dd6972ceec9@changeid> Some lines of the output are not worth testing, or not worth testing in their entirety. For example, when checking a hex dump we know that the hex-dump routine can display ASCII so we only need to check the hex bytes, not the ASCII dump. Add a new test macros which can check only part of a console line. Sometimes it is useful to skip a line altogether, so add a macro for that also. Signed-off-by: Simon Glass --- Changes in v2: - Add new patch to check part of a console line or skip it include/test/ut.h | 59 +++++++++++++++++++++++++++++++++++++++++++++++ test/ut.c | 22 ++++++++++++++++++ 2 files changed, 81 insertions(+) diff --git a/include/test/ut.h b/include/test/ut.h index 7ddd6e8872..ea738ed177 100644 --- a/include/test/ut.h +++ b/include/test/ut.h @@ -56,6 +56,31 @@ void ut_failf(struct unit_test_state *uts, const char *fname, int line, int ut_check_console_line(struct unit_test_state *uts, const char *fmt, ...) __attribute__ ((format (__printf__, 2, 3))); +/** + * ut_check_console_linen() - Check part of the next console line + * + * This creates a string and then checks it against the next line of console + * output obtained with console_record_readline(). Only the length of the + * string is checked + * + * After the function returns, uts->expect_str holds the expected string and + * uts->actual_str holds the actual string read from the console. + * + * @uts: Test state + * @fmt: printf() format string for the error, followed by args + * @return 0 if OK, other value on error + */ +int ut_check_console_linen(struct unit_test_state *uts, const char *fmt, ...) + __attribute__ ((format (__printf__, 2, 3))); + +/** + * ut_check_skipline() - Check that the next console line exists and skip it + * + * @uts: Test state + * @return 0 if OK, other value on error + */ +int ut_check_skipline(struct unit_test_state *uts); + /** * ut_check_console_end() - Check there is no more console output * @@ -134,6 +159,23 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); } \ } +/* + * Assert that two string expressions are equal, up to length of the + * first + */ +#define ut_asserteq_strn(expr1, expr2) { \ + const char *_val1 = (expr1), *_val2 = (expr2); \ + int _len = strlen(_val1); \ + \ + if (memcmp(_val1, _val2, _len)) { \ + ut_failf(uts, __FILE__, __LINE__, __func__, \ + #expr1 " = " #expr2, \ + "Expected \"%.*s\", got \"%.*s\"", \ + _len, _val1, _len, _val2); \ + return CMD_RET_FAILURE; \ + } \ +} + /* Assert that two memory areas are equal */ #define ut_asserteq_mem(expr1, expr2, len) { \ const u8 *_val1 = (u8 *)(expr1), *_val2 = (u8 *)(expr2); \ @@ -213,6 +255,23 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); return CMD_RET_FAILURE; \ } \ +/* Assert that the next console output line matches up to the length */ +#define ut_assert_nextlinen(fmt, args...) \ + if (ut_check_console_linen(uts, fmt, ##args)) { \ + ut_failf(uts, __FILE__, __LINE__, __func__, \ + "console", "\nExpected '%s',\n got '%s'", \ + uts->expect_str, uts->actual_str); \ + return CMD_RET_FAILURE; \ + } \ + +/* Assert that there is a 'next' console output line, and skip it */ +#define ut_assert_skipline() \ + if (ut_check_skipline(uts)) { \ + ut_failf(uts, __FILE__, __LINE__, __func__, \ + "console", "\nExpected a line, got end"); \ + return CMD_RET_FAILURE; \ + } \ + /* Assert that there is no more console output */ #define ut_assert_console_end() \ if (ut_check_console_end(uts)) { \ diff --git a/test/ut.c b/test/ut.c index c64f0b554d..95bdd66de6 100644 --- a/test/ut.c +++ b/test/ut.c @@ -59,6 +59,28 @@ int ut_check_console_line(struct unit_test_state *uts, const char *fmt, ...) return strcmp(uts->expect_str, uts->actual_str); } +int ut_check_console_linen(struct unit_test_state *uts, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + vsnprintf(uts->expect_str, sizeof(uts->expect_str), fmt, args); + va_end(args); + console_record_readline(uts->actual_str, sizeof(uts->actual_str)); + + return strncmp(uts->expect_str, uts->actual_str, + strlen(uts->expect_str)); +} + +int ut_check_skipline(struct unit_test_state *uts) +{ + if (!console_record_avail()) + return -ENFILE; + console_record_readline(uts->actual_str, sizeof(uts->actual_str)); + + return 0; +} + int ut_check_console_end(struct unit_test_state *uts) { if (!console_record_avail()) From patchwork Mon Jun 8 02:43:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 241905 List-Id: U-Boot discussion From: sjg at chromium.org (Simon Glass) Date: Sun, 7 Jun 2020 20:43:34 -0600 Subject: [PATCH v2 07/10] dm: test: Rename test flags to be generic In-Reply-To: <20200608024337.85575-1-sjg@chromium.org> References: <20200608024337.85575-1-sjg@chromium.org> Message-ID: <20200608024337.85575-2-sjg@chromium.org> At present the flags value is common to all tests but only defined by the driver-model tests. Rename the enum and move it into the generic unit-test header. Signed-off-by: Simon Glass --- (no changes since v1) doc/README.commands | 2 +- include/dm/test.h | 9 --------- include/test/test.h | 10 +++++++++ test/dm/acpi.c | 18 ++++++++--------- test/dm/adc.c | 16 +++++++-------- test/dm/audio.c | 2 +- test/dm/axi.c | 6 +++--- test/dm/blk.c | 10 ++++----- test/dm/board.c | 2 +- test/dm/bootcount.c | 2 +- test/dm/bus.c | 26 ++++++++++++------------ test/dm/cache.c | 2 +- test/dm/clk.c | 6 +++--- test/dm/clk_ccf.c | 2 +- test/dm/core.c | 30 +++++++++++++-------------- test/dm/cpu.c | 2 +- test/dm/devres.c | 12 +++++------ test/dm/dma.c | 6 +++--- test/dm/dsi_host.c | 2 +- test/dm/eth.c | 16 +++++++-------- test/dm/fdtdec.c | 2 +- test/dm/firmware.c | 2 +- test/dm/gpio.c | 16 +++++++-------- test/dm/hwspinlock.c | 2 +- test/dm/i2c.c | 16 +++++++-------- test/dm/i2s.c | 2 +- test/dm/irq.c | 8 ++++---- test/dm/led.c | 12 +++++------ test/dm/mailbox.c | 2 +- test/dm/mdio.c | 2 +- test/dm/mdio_mux.c | 2 +- test/dm/misc.c | 2 +- test/dm/mmc.c | 4 ++-- test/dm/nop.c | 2 +- test/dm/ofnode.c | 12 +++++------ test/dm/ofread.c | 2 +- test/dm/osd.c | 4 ++-- test/dm/p2sb.c | 2 +- test/dm/panel.c | 2 +- test/dm/pch.c | 4 ++-- test/dm/pci.c | 24 +++++++++++----------- test/dm/pci_ep.c | 2 +- test/dm/phy.c | 6 +++--- test/dm/pmc.c | 2 +- test/dm/pmic.c | 10 ++++----- test/dm/power-domain.c | 2 +- test/dm/pwm.c | 2 +- test/dm/ram.c | 2 +- test/dm/regmap.c | 10 ++++----- test/dm/regulator.c | 20 +++++++++--------- test/dm/remoteproc.c | 4 ++-- test/dm/reset.c | 6 +++--- test/dm/rng.c | 2 +- test/dm/rtc.c | 8 ++++---- test/dm/serial.c | 2 +- test/dm/sf.c | 4 ++-- test/dm/smem.c | 2 +- test/dm/sound.c | 4 ++-- test/dm/spi.c | 4 ++-- test/dm/spmi.c | 6 +++--- test/dm/syscon.c | 6 +++--- test/dm/sysreset.c | 8 ++++---- test/dm/tee.c | 2 +- test/dm/test-fdt.c | 46 +++++++++++++++++++++--------------------- test/dm/test-main.c | 10 ++++----- test/dm/timer.c | 2 +- test/dm/usb.c | 10 ++++----- test/dm/video.c | 26 ++++++++++++------------ test/dm/virtio.c | 8 ++++---- test/dm/wdt.c | 2 +- test/lib/lmb.c | 18 ++++++++--------- 71 files changed, 271 insertions(+), 270 deletions(-) diff --git a/doc/README.commands b/doc/README.commands index 229f86d8fb..22ab063fdc 100644 --- a/doc/README.commands +++ b/doc/README.commands @@ -183,4 +183,4 @@ static int dm_test_acpi_cmd_items(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_acpi_cmd_items, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_acpi_cmd_items, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/include/dm/test.h b/include/dm/test.h index f0f36624ce..3355f1bb68 100644 --- a/include/dm/test.h +++ b/include/dm/test.h @@ -147,15 +147,6 @@ struct dm_test_state { struct udevice *removed; }; -/* Test flags for each test */ -enum { - DM_TESTF_SCAN_PDATA = 1 << 0, /* test needs platform data */ - DM_TESTF_PROBE_TEST = 1 << 1, /* probe test uclass */ - DM_TESTF_SCAN_FDT = 1 << 2, /* scan device tree */ - DM_TESTF_FLAT_TREE = 1 << 3, /* test needs flat DT */ - DM_TESTF_LIVE_TREE = 1 << 4, /* needs live device tree */ -}; - /* Declare a new driver model test */ #define DM_TEST(_name, _flags) UNIT_TEST(_name, _flags, dm_test) diff --git a/include/test/test.h b/include/test/test.h index 029288de88..ff92c39006 100644 --- a/include/test/test.h +++ b/include/test/test.h @@ -7,6 +7,7 @@ #define __TEST_TEST_H #include +#include /* * struct unit_test_state - Entire state of test system @@ -27,6 +28,15 @@ struct unit_test_state { char actual_str[256]; }; +/* Test flags for each test */ +enum { + UT_TESTF_SCAN_PDATA = BIT(0), /* test needs platform data */ + UT_TESTF_PROBE_TEST = BIT(1), /* probe test uclass */ + UT_TESTF_SCAN_FDT = BIT(2), /* scan device tree */ + UT_TESTF_FLAT_TREE = BIT(3), /* test needs flat DT */ + UT_TESTF_LIVE_TREE = BIT(4), /* needs live device tree */ +}; + /** * struct unit_test - Information about a unit test * diff --git a/test/dm/acpi.c b/test/dm/acpi.c index 4c46dd83a6..f0ec8dcc21 100644 --- a/test/dm/acpi.c +++ b/test/dm/acpi.c @@ -77,7 +77,7 @@ static int dm_test_acpi_get_name(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_acpi_get_name, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_acpi_get_name, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test acpi_get_table_revision() */ static int dm_test_acpi_get_table_revision(struct unit_test_state *uts) @@ -90,7 +90,7 @@ static int dm_test_acpi_get_table_revision(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_acpi_get_table_revision, - DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test acpi_create_dmar() */ static int dm_test_acpi_create_dmar(struct unit_test_state *uts) @@ -103,7 +103,7 @@ static int dm_test_acpi_create_dmar(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_acpi_create_dmar, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_acpi_create_dmar, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test acpi_fill_header() */ static int dm_test_acpi_fill_header(struct unit_test_state *uts) @@ -130,7 +130,7 @@ static int dm_test_acpi_fill_header(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_acpi_fill_header, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_acpi_fill_header, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test ACPI write_tables() */ static int dm_test_acpi_write_tables(struct unit_test_state *uts) @@ -168,7 +168,7 @@ static int dm_test_acpi_write_tables(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_acpi_write_tables, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_acpi_write_tables, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test basic ACPI functions */ static int dm_test_acpi_basic(struct unit_test_state *uts) @@ -196,7 +196,7 @@ static int dm_test_acpi_basic(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_acpi_basic, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_acpi_basic, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test acpi_setup_base_tables */ static int dm_test_acpi_setup_base_tables(struct unit_test_state *uts) @@ -244,7 +244,7 @@ static int dm_test_acpi_setup_base_tables(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_acpi_setup_base_tables, - DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test 'acpi list' command */ static int dm_test_acpi_cmd_list(struct unit_test_state *uts) @@ -283,7 +283,7 @@ static int dm_test_acpi_cmd_list(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_acpi_cmd_list, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_acpi_cmd_list, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test 'acpi dump' command */ static int dm_test_acpi_cmd_dump(struct unit_test_state *uts) @@ -314,4 +314,4 @@ static int dm_test_acpi_cmd_dump(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_acpi_cmd_dump, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_acpi_cmd_dump, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/adc.c b/test/dm/adc.c index da7bd4bf1f..e7221a4159 100644 --- a/test/dm/adc.c +++ b/test/dm/adc.c @@ -32,7 +32,7 @@ static int dm_test_adc_bind(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_adc_bind, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_adc_bind, UT_TESTF_SCAN_FDT); static int dm_test_adc_wrong_channel_selection(struct unit_test_state *uts) { @@ -43,7 +43,7 @@ static int dm_test_adc_wrong_channel_selection(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_adc_wrong_channel_selection, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_adc_wrong_channel_selection, UT_TESTF_SCAN_FDT); static int dm_test_adc_supply(struct unit_test_state *uts) { @@ -79,7 +79,7 @@ static int dm_test_adc_supply(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_adc_supply, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_adc_supply, UT_TESTF_SCAN_FDT); struct adc_channel adc_channel_test_data[] = { { 0, SANDBOX_ADC_CHANNEL0_DATA }, @@ -104,7 +104,7 @@ static int dm_test_adc_single_channel_conversion(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_adc_single_channel_conversion, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_adc_single_channel_conversion, UT_TESTF_SCAN_FDT); static int dm_test_adc_multi_channel_conversion(struct unit_test_state *uts) { @@ -127,7 +127,7 @@ static int dm_test_adc_multi_channel_conversion(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_adc_multi_channel_conversion, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_adc_multi_channel_conversion, UT_TESTF_SCAN_FDT); static int dm_test_adc_single_channel_shot(struct unit_test_state *uts) { @@ -143,7 +143,7 @@ static int dm_test_adc_single_channel_shot(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_adc_single_channel_shot, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_adc_single_channel_shot, UT_TESTF_SCAN_FDT); static int dm_test_adc_multi_channel_shot(struct unit_test_state *uts) { @@ -163,7 +163,7 @@ static int dm_test_adc_multi_channel_shot(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_adc_multi_channel_shot, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_adc_multi_channel_shot, UT_TESTF_SCAN_FDT); static const int dm_test_adc_uV_data[SANDBOX_ADC_CHANNELS] = { ((u64)SANDBOX_ADC_CHANNEL0_DATA * SANDBOX_BUCK2_INITIAL_EXPECTED_UV) / @@ -194,4 +194,4 @@ static int dm_test_adc_raw_to_uV(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_adc_raw_to_uV, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_adc_raw_to_uV, UT_TESTF_SCAN_FDT); diff --git a/test/dm/audio.c b/test/dm/audio.c index 77c3a3625b..1b192cb22e 100644 --- a/test/dm/audio.c +++ b/test/dm/audio.c @@ -31,4 +31,4 @@ static int dm_test_audio(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_audio, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_audio, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/axi.c b/test/dm/axi.c index e1155a51dd..367620c0aa 100644 --- a/test/dm/axi.c +++ b/test/dm/axi.c @@ -22,7 +22,7 @@ static int dm_test_axi_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_axi_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_axi_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test that sandbox PCI bus numbering works correctly */ static int dm_test_axi_busnum(struct unit_test_state *uts) @@ -34,7 +34,7 @@ static int dm_test_axi_busnum(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_axi_busnum, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_axi_busnum, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test that we can use the store device correctly */ static int dm_test_axi_store(struct unit_test_state *uts) @@ -75,4 +75,4 @@ static int dm_test_axi_store(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_axi_store, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_axi_store, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/blk.c b/test/dm/blk.c index 94b2855b8e..91473470be 100644 --- a/test/dm/blk.c +++ b/test/dm/blk.c @@ -42,7 +42,7 @@ static int dm_test_blk_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_blk_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_blk_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int count_blk_devices(void) { @@ -88,7 +88,7 @@ static int dm_test_blk_usb(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_blk_usb, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_blk_usb, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test that we can find block devices without probing them */ static int dm_test_blk_find(struct unit_test_state *uts) @@ -109,7 +109,7 @@ static int dm_test_blk_find(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_blk_find, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_blk_find, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test that block device numbering works as expected */ static int dm_test_blk_devnum(struct unit_test_state *uts) @@ -144,7 +144,7 @@ static int dm_test_blk_devnum(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_blk_devnum, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_blk_devnum, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test that we can get a block from its parent */ static int dm_test_blk_get_from_parent(struct unit_test_state *uts) @@ -162,4 +162,4 @@ static int dm_test_blk_get_from_parent(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_blk_get_from_parent, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_blk_get_from_parent, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/board.c b/test/dm/board.c index 5472c65fad..6925a671b6 100644 --- a/test/dm/board.c +++ b/test/dm/board.c @@ -55,4 +55,4 @@ static int dm_test_board(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_board, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_board, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/bootcount.c b/test/dm/bootcount.c index be0c278907..57e98a46ca 100644 --- a/test/dm/bootcount.c +++ b/test/dm/bootcount.c @@ -27,5 +27,5 @@ static int dm_test_bootcount(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_bootcount, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_bootcount, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/bus.c b/test/dm/bus.c index 73eb3aede3..73d3515f04 100644 --- a/test/dm/bus.c +++ b/test/dm/bus.c @@ -137,7 +137,7 @@ static int dm_test_bus_children(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_bus_children, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_bus_children, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test our functions for accessing children */ static int dm_test_bus_children_funcs(struct unit_test_state *uts) @@ -176,7 +176,7 @@ static int dm_test_bus_children_funcs(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_bus_children_funcs, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_bus_children_funcs, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int dm_test_bus_children_of_offset(struct unit_test_state *uts) { @@ -200,7 +200,7 @@ static int dm_test_bus_children_of_offset(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_bus_children_of_offset, - DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT | DM_TESTF_FLAT_TREE); + UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT | UT_TESTF_FLAT_TREE); /* Test that we can iterate through children */ static int dm_test_bus_children_iterators(struct unit_test_state *uts) @@ -231,7 +231,7 @@ static int dm_test_bus_children_iterators(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_bus_children_iterators, - DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test that the bus can store data about each child */ static int test_bus_parent_data(struct unit_test_state *uts) @@ -298,7 +298,7 @@ static int dm_test_bus_parent_data(struct unit_test_state *uts) { return test_bus_parent_data(uts); } -DM_TEST(dm_test_bus_parent_data, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_bus_parent_data, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* As above but the size is controlled by the uclass */ static int dm_test_bus_parent_data_uclass(struct unit_test_state *uts) @@ -328,7 +328,7 @@ static int dm_test_bus_parent_data_uclass(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_bus_parent_data_uclass, - DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test that the bus ops are called when a child is probed/removed */ static int dm_test_bus_parent_ops(struct unit_test_state *uts) @@ -367,7 +367,7 @@ static int dm_test_bus_parent_ops(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_bus_parent_ops, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_bus_parent_ops, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int test_bus_parent_platdata(struct unit_test_state *uts) { @@ -442,7 +442,7 @@ static int dm_test_bus_parent_platdata(struct unit_test_state *uts) { return test_bus_parent_platdata(uts); } -DM_TEST(dm_test_bus_parent_platdata, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_bus_parent_platdata, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* As above but the size is controlled by the uclass */ static int dm_test_bus_parent_platdata_uclass(struct unit_test_state *uts) @@ -471,7 +471,7 @@ static int dm_test_bus_parent_platdata_uclass(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_bus_parent_platdata_uclass, - DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test that the child post_bind method is called */ static int dm_test_bus_child_post_bind(struct unit_test_state *uts) @@ -492,7 +492,7 @@ static int dm_test_bus_child_post_bind(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_bus_child_post_bind, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_bus_child_post_bind, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test that the child post_bind method is called */ static int dm_test_bus_child_post_bind_uclass(struct unit_test_state *uts) @@ -514,7 +514,7 @@ static int dm_test_bus_child_post_bind_uclass(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_bus_child_post_bind_uclass, - DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* * Test that the bus' uclass' child_pre_probe() is called before the @@ -548,7 +548,7 @@ static int dm_test_bus_child_pre_probe_uclass(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_bus_child_pre_probe_uclass, - DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* * Test that the bus' uclass' child_post_probe() is called after the @@ -581,4 +581,4 @@ static int dm_test_bus_child_post_probe_uclass(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_bus_child_post_probe_uclass, - DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/cache.c b/test/dm/cache.c index 2e244b109f..bbd8f98d00 100644 --- a/test/dm/cache.c +++ b/test/dm/cache.c @@ -19,4 +19,4 @@ static int dm_test_reset(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_reset, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_reset, UT_TESTF_SCAN_FDT); diff --git a/test/dm/clk.c b/test/dm/clk.c index 48fc3dd714..6fee770e93 100644 --- a/test/dm/clk.c +++ b/test/dm/clk.c @@ -33,7 +33,7 @@ static int dm_test_clk_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_clk_base, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_clk_base, UT_TESTF_SCAN_FDT); static int dm_test_clk(struct unit_test_state *uts) { @@ -160,7 +160,7 @@ static int dm_test_clk(struct unit_test_state *uts) SANDBOX_CLK_ID_UART1)); return 0; } -DM_TEST(dm_test_clk, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_clk, UT_TESTF_SCAN_FDT); static int dm_test_clk_bulk(struct unit_test_state *uts) { @@ -198,4 +198,4 @@ static int dm_test_clk_bulk(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_clk_bulk, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_clk_bulk, UT_TESTF_SCAN_FDT); diff --git a/test/dm/clk_ccf.c b/test/dm/clk_ccf.c index ae3a4d8a76..f822761f7a 100644 --- a/test/dm/clk_ccf.c +++ b/test/dm/clk_ccf.c @@ -95,4 +95,4 @@ static int dm_test_clk_ccf(struct unit_test_state *uts) return 1; } -DM_TEST(dm_test_clk_ccf, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_clk_ccf, UT_TESTF_SCAN_FDT); diff --git a/test/dm/core.c b/test/dm/core.c index 6a930ae31a..a496dcd149 100644 --- a/test/dm/core.c +++ b/test/dm/core.c @@ -166,7 +166,7 @@ static int dm_test_autobind_uclass_pdata_alloc(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_autobind_uclass_pdata_alloc, DM_TESTF_SCAN_PDATA); +DM_TEST(dm_test_autobind_uclass_pdata_alloc, UT_TESTF_SCAN_PDATA); /* Test that binding with uclass platdata setting occurs correctly */ static int dm_test_autobind_uclass_pdata_valid(struct unit_test_state *uts) @@ -192,7 +192,7 @@ static int dm_test_autobind_uclass_pdata_valid(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_autobind_uclass_pdata_valid, DM_TESTF_SCAN_PDATA); +DM_TEST(dm_test_autobind_uclass_pdata_valid, UT_TESTF_SCAN_PDATA); /* Test that autoprobe finds all the expected devices */ static int dm_test_autoprobe(struct unit_test_state *uts) @@ -260,7 +260,7 @@ static int dm_test_autoprobe(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_autoprobe, DM_TESTF_SCAN_PDATA); +DM_TEST(dm_test_autoprobe, UT_TESTF_SCAN_PDATA); /* Check that we see the correct platdata in each device */ static int dm_test_platdata(struct unit_test_state *uts) @@ -278,7 +278,7 @@ static int dm_test_platdata(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_platdata, DM_TESTF_SCAN_PDATA); +DM_TEST(dm_test_platdata, UT_TESTF_SCAN_PDATA); /* Test that we can bind, probe, remove, unbind a driver */ static int dm_test_lifecycle(struct unit_test_state *uts) @@ -334,7 +334,7 @@ static int dm_test_lifecycle(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_lifecycle, DM_TESTF_SCAN_PDATA | DM_TESTF_PROBE_TEST); +DM_TEST(dm_test_lifecycle, UT_TESTF_SCAN_PDATA | UT_TESTF_PROBE_TEST); /* Test that we can bind/unbind and the lists update correctly */ static int dm_test_ordering(struct unit_test_state *uts) @@ -390,7 +390,7 @@ static int dm_test_ordering(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_ordering, DM_TESTF_SCAN_PDATA); +DM_TEST(dm_test_ordering, UT_TESTF_SCAN_PDATA); /* Check that we can perform operations on a device (do a ping) */ int dm_check_operations(struct unit_test_state *uts, struct udevice *dev, @@ -448,7 +448,7 @@ static int dm_test_operations(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_operations, DM_TESTF_SCAN_PDATA); +DM_TEST(dm_test_operations, UT_TESTF_SCAN_PDATA); /* Remove all drivers and check that things work */ static int dm_test_remove(struct unit_test_state *uts) @@ -470,7 +470,7 @@ static int dm_test_remove(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_remove, DM_TESTF_SCAN_PDATA | DM_TESTF_PROBE_TEST); +DM_TEST(dm_test_remove, UT_TESTF_SCAN_PDATA | UT_TESTF_PROBE_TEST); /* Remove and recreate everything, check for memory leaks */ static int dm_test_leak(struct unit_test_state *uts) @@ -755,7 +755,7 @@ static int dm_test_uclass_devices_find(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_uclass_devices_find, DM_TESTF_SCAN_PDATA); +DM_TEST(dm_test_uclass_devices_find, UT_TESTF_SCAN_PDATA); static int dm_test_uclass_devices_find_by_name(struct unit_test_state *uts) { @@ -792,7 +792,7 @@ static int dm_test_uclass_devices_find_by_name(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_uclass_devices_find_by_name, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_uclass_devices_find_by_name, UT_TESTF_SCAN_FDT); static int dm_test_uclass_devices_get(struct unit_test_state *uts) { @@ -809,7 +809,7 @@ static int dm_test_uclass_devices_get(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_uclass_devices_get, DM_TESTF_SCAN_PDATA); +DM_TEST(dm_test_uclass_devices_get, UT_TESTF_SCAN_PDATA); static int dm_test_uclass_devices_get_by_name(struct unit_test_state *uts) { @@ -853,7 +853,7 @@ static int dm_test_uclass_devices_get_by_name(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_uclass_devices_get_by_name, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_uclass_devices_get_by_name, UT_TESTF_SCAN_FDT); static int dm_test_device_get_uclass_id(struct unit_test_state *uts) { @@ -864,7 +864,7 @@ static int dm_test_device_get_uclass_id(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_device_get_uclass_id, DM_TESTF_SCAN_PDATA); +DM_TEST(dm_test_device_get_uclass_id, UT_TESTF_SCAN_PDATA); static int dm_test_uclass_names(struct unit_test_state *uts) { @@ -873,7 +873,7 @@ static int dm_test_uclass_names(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_uclass_names, DM_TESTF_SCAN_PDATA); +DM_TEST(dm_test_uclass_names, UT_TESTF_SCAN_PDATA); static int dm_test_inactive_child(struct unit_test_state *uts) { @@ -904,4 +904,4 @@ static int dm_test_inactive_child(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_inactive_child, DM_TESTF_SCAN_PDATA); +DM_TEST(dm_test_inactive_child, UT_TESTF_SCAN_PDATA); diff --git a/test/dm/cpu.c b/test/dm/cpu.c index 46683d884a..bda5b71b6d 100644 --- a/test/dm/cpu.c +++ b/test/dm/cpu.c @@ -46,4 +46,4 @@ static int dm_test_cpu(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_cpu, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_cpu, UT_TESTF_SCAN_FDT); diff --git a/test/dm/devres.c b/test/dm/devres.c index b5de0cb191..9eb9a67d5a 100644 --- a/test/dm/devres.c +++ b/test/dm/devres.c @@ -40,7 +40,7 @@ static int dm_test_devres_alloc(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_devres_alloc, DM_TESTF_SCAN_PDATA); +DM_TEST(dm_test_devres_alloc, UT_TESTF_SCAN_PDATA); /* Test devm_kfree() can be used to free memory too */ static int dm_test_devres_free(struct unit_test_state *uts) @@ -68,7 +68,7 @@ static int dm_test_devres_free(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_devres_free, DM_TESTF_SCAN_PDATA); +DM_TEST(dm_test_devres_free, UT_TESTF_SCAN_PDATA); /* Test that kzalloc() returns memory that is zeroed */ @@ -88,7 +88,7 @@ static int dm_test_devres_kzalloc(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_devres_kzalloc, DM_TESTF_SCAN_PDATA); +DM_TEST(dm_test_devres_kzalloc, UT_TESTF_SCAN_PDATA); /* Test that devm_kmalloc_array() allocates an array that can be set */ static int dm_test_devres_kmalloc_array(struct unit_test_state *uts) @@ -111,7 +111,7 @@ static int dm_test_devres_kmalloc_array(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_devres_kmalloc_array, DM_TESTF_SCAN_PDATA); +DM_TEST(dm_test_devres_kmalloc_array, UT_TESTF_SCAN_PDATA); /* Test that devm_kcalloc() allocates a zeroed array */ static int dm_test_devres_kcalloc(struct unit_test_state *uts) @@ -140,7 +140,7 @@ static int dm_test_devres_kcalloc(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_devres_kcalloc, DM_TESTF_SCAN_PDATA); +DM_TEST(dm_test_devres_kcalloc, UT_TESTF_SCAN_PDATA); /* Test devres releases resources automatically as expected */ static int dm_test_devres_phase(struct unit_test_state *uts) @@ -185,4 +185,4 @@ static int dm_test_devres_phase(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_devres_phase, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_devres_phase, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/dma.c b/test/dm/dma.c index 317ed4fe8c..51987a2f0b 100644 --- a/test/dm/dma.c +++ b/test/dm/dma.c @@ -34,7 +34,7 @@ static int dm_test_dma_m2m(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_dma_m2m, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_dma_m2m, UT_TESTF_SCAN_FDT); static int dm_test_dma(struct unit_test_state *uts) { @@ -76,7 +76,7 @@ static int dm_test_dma(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_dma, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_dma, UT_TESTF_SCAN_FDT); static int dm_test_dma_rx(struct unit_test_state *uts) { @@ -121,4 +121,4 @@ static int dm_test_dma_rx(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_dma_rx, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_dma_rx, UT_TESTF_SCAN_FDT); diff --git a/test/dm/dsi_host.c b/test/dm/dsi_host.c index 59fcd5558f..05c5275dcb 100644 --- a/test/dm/dsi_host.c +++ b/test/dm/dsi_host.c @@ -55,4 +55,4 @@ static int dm_test_dsi_host(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_dsi_host, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_dsi_host, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/eth.c b/test/dm/eth.c index 1fddcaabb0..c29a1febd6 100644 --- a/test/dm/eth.c +++ b/test/dm/eth.c @@ -39,7 +39,7 @@ static int dm_test_eth(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_eth, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_eth, UT_TESTF_SCAN_FDT); static int dm_test_eth_alias(struct unit_test_state *uts) { @@ -63,7 +63,7 @@ static int dm_test_eth_alias(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_eth_alias, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_eth_alias, UT_TESTF_SCAN_FDT); static int dm_test_eth_prime(struct unit_test_state *uts) { @@ -83,7 +83,7 @@ static int dm_test_eth_prime(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_eth_prime, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_eth_prime, UT_TESTF_SCAN_FDT); /** * This test case is trying to test the following scenario: @@ -144,7 +144,7 @@ static int dm_test_eth_act(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_eth_act, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_eth_act, UT_TESTF_SCAN_FDT); /* The asserts include a return on fail; cleanup in the caller */ static int _dm_test_eth_rotate1(struct unit_test_state *uts) @@ -216,7 +216,7 @@ static int dm_test_eth_rotate(struct unit_test_state *uts) return retval; } -DM_TEST(dm_test_eth_rotate, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_eth_rotate, UT_TESTF_SCAN_FDT); /* The asserts include a return on fail; cleanup in the caller */ static int _dm_test_net_retry(struct unit_test_state *uts) @@ -259,7 +259,7 @@ static int dm_test_net_retry(struct unit_test_state *uts) return retval; } -DM_TEST(dm_test_net_retry, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_net_retry, UT_TESTF_SCAN_FDT); static int sb_check_arp_reply(struct udevice *dev, void *packet, unsigned int len) @@ -344,7 +344,7 @@ static int dm_test_eth_async_arp_reply(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_eth_async_arp_reply, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_eth_async_arp_reply, UT_TESTF_SCAN_FDT); static int sb_check_ping_reply(struct udevice *dev, void *packet, unsigned int len) @@ -429,4 +429,4 @@ static int dm_test_eth_async_ping_reply(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_eth_async_ping_reply, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_eth_async_ping_reply, UT_TESTF_SCAN_FDT); diff --git a/test/dm/fdtdec.c b/test/dm/fdtdec.c index b2f75b5843..79dda43ba0 100644 --- a/test/dm/fdtdec.c +++ b/test/dm/fdtdec.c @@ -56,4 +56,4 @@ static int dm_test_fdtdec_set_carveout(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_fdtdec_set_carveout, - DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT | DM_TESTF_FLAT_TREE); + UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT | UT_TESTF_FLAT_TREE); diff --git a/test/dm/firmware.c b/test/dm/firmware.c index 60fdcbb33f..9a5b288833 100644 --- a/test/dm/firmware.c +++ b/test/dm/firmware.c @@ -19,4 +19,4 @@ static int dm_test_firmware_probe(struct unit_test_state *uts) "sandbox-firmware", &dev)); return 0; } -DM_TEST(dm_test_firmware_probe, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_firmware_probe, UT_TESTF_SCAN_FDT); diff --git a/test/dm/gpio.c b/test/dm/gpio.c index b5ee4e4f87..11f81944ed 100644 --- a/test/dm/gpio.c +++ b/test/dm/gpio.c @@ -111,7 +111,7 @@ static int dm_test_gpio(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_gpio, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_gpio, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test that GPIO open-drain/open-source emulation works correctly */ static int dm_test_gpio_opendrain_opensource(struct unit_test_state *uts) @@ -200,7 +200,7 @@ static int dm_test_gpio_opendrain_opensource(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_gpio_opendrain_opensource, - DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test that sandbox anonymous GPIOs work correctly */ static int dm_test_gpio_anon(struct unit_test_state *uts) @@ -222,7 +222,7 @@ static int dm_test_gpio_anon(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_gpio_anon, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_gpio_anon, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test that gpio_requestf() works as expected */ static int dm_test_gpio_requestf(struct unit_test_state *uts) @@ -240,7 +240,7 @@ static int dm_test_gpio_requestf(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_gpio_requestf, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_gpio_requestf, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test that gpio_request() copies its string */ static int dm_test_gpio_copy(struct unit_test_state *uts) @@ -262,7 +262,7 @@ static int dm_test_gpio_copy(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_gpio_copy, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_gpio_copy, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test that we don't leak memory with GPIOs */ static int dm_test_gpio_leak(struct unit_test_state *uts) @@ -274,7 +274,7 @@ static int dm_test_gpio_leak(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_gpio_leak, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_gpio_leak, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test that we can find GPIOs using phandles */ static int dm_test_gpio_phandles(struct unit_test_state *uts) @@ -348,7 +348,7 @@ static int dm_test_gpio_phandles(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_gpio_phandles, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_gpio_phandles, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Check the gpio pin configuration get from device tree information */ static int dm_test_gpio_get_dir_flags(struct unit_test_state *uts) @@ -384,4 +384,4 @@ static int dm_test_gpio_get_dir_flags(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_gpio_get_dir_flags, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_gpio_get_dir_flags, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/hwspinlock.c b/test/dm/hwspinlock.c index 09ec38b4f3..9c1bdf4c34 100644 --- a/test/dm/hwspinlock.c +++ b/test/dm/hwspinlock.c @@ -37,4 +37,4 @@ static int dm_test_hwspinlock_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_hwspinlock_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_hwspinlock_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/i2c.c b/test/dm/i2c.c index 2025c4216d..16890a7da5 100644 --- a/test/dm/i2c.c +++ b/test/dm/i2c.c @@ -41,7 +41,7 @@ static int dm_test_i2c_find(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_i2c_find, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_i2c_find, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int dm_test_i2c_read_write(struct unit_test_state *uts) { @@ -58,7 +58,7 @@ static int dm_test_i2c_read_write(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_i2c_read_write, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_i2c_read_write, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int dm_test_i2c_speed(struct unit_test_state *uts) { @@ -80,7 +80,7 @@ static int dm_test_i2c_speed(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_i2c_speed, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_i2c_speed, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int dm_test_i2c_offset_len(struct unit_test_state *uts) { @@ -97,7 +97,7 @@ static int dm_test_i2c_offset_len(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_i2c_offset_len, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_i2c_offset_len, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int dm_test_i2c_probe_empty(struct unit_test_state *uts) { @@ -112,7 +112,7 @@ static int dm_test_i2c_probe_empty(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_i2c_probe_empty, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_i2c_probe_empty, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int dm_test_i2c_bytewise(struct unit_test_state *uts) { @@ -167,7 +167,7 @@ static int dm_test_i2c_bytewise(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_i2c_bytewise, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_i2c_bytewise, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int dm_test_i2c_offset(struct unit_test_state *uts) { @@ -240,7 +240,7 @@ static int dm_test_i2c_offset(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_i2c_offset, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_i2c_offset, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int dm_test_i2c_addr_offset(struct unit_test_state *uts) { @@ -305,4 +305,4 @@ static int dm_test_i2c_addr_offset(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_i2c_addr_offset, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_i2c_addr_offset, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/i2s.c b/test/dm/i2s.c index 49ebc3523c..87c301becb 100644 --- a/test/dm/i2s.c +++ b/test/dm/i2s.c @@ -29,4 +29,4 @@ static int dm_test_i2s(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_i2s, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_i2s, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/irq.c b/test/dm/irq.c index 192d80d7e1..f6d6f7617a 100644 --- a/test/dm/irq.c +++ b/test/dm/irq.c @@ -30,7 +30,7 @@ static int dm_test_irq_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_irq_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_irq_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test of irq_first_device_type() */ static int dm_test_irq_type(struct unit_test_state *uts) @@ -42,7 +42,7 @@ static int dm_test_irq_type(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_irq_type, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_irq_type, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test of irq_read_and_clear() */ static int dm_test_read_and_clear(struct unit_test_state *uts) @@ -59,7 +59,7 @@ static int dm_test_read_and_clear(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_read_and_clear, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_read_and_clear, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test of irq_request() */ static int dm_test_request(struct unit_test_state *uts) @@ -74,4 +74,4 @@ static int dm_test_request(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_request, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_request, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/led.c b/test/dm/led.c index 00de7b3997..d00b1685a0 100644 --- a/test/dm/led.c +++ b/test/dm/led.c @@ -25,7 +25,7 @@ static int dm_test_led_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_led_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_led_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test of the LED 'default-state' device tree property */ static int dm_test_led_default_state(struct unit_test_state *uts) @@ -44,7 +44,7 @@ static int dm_test_led_default_state(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_led_default_state, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_led_default_state, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test of the led uclass using the led_gpio driver */ static int dm_test_led_gpio(struct unit_test_state *uts) @@ -69,7 +69,7 @@ static int dm_test_led_gpio(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_led_gpio, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_led_gpio, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test that we can toggle LEDs */ static int dm_test_led_toggle(struct unit_test_state *uts) @@ -94,7 +94,7 @@ static int dm_test_led_toggle(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_led_toggle, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_led_toggle, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test obtaining an LED by label */ static int dm_test_led_label(struct unit_test_state *uts) @@ -115,7 +115,7 @@ static int dm_test_led_label(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_led_label, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_led_label, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test LED blinking */ #ifdef CONFIG_LED_BLINK @@ -138,5 +138,5 @@ static int dm_test_led_blink(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_led_blink, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_led_blink, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); #endif diff --git a/test/dm/mailbox.c b/test/dm/mailbox.c index e6c521b8b5..03b50449eb 100644 --- a/test/dm/mailbox.c +++ b/test/dm/mailbox.c @@ -28,4 +28,4 @@ static int dm_test_mailbox(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_mailbox, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_mailbox, UT_TESTF_SCAN_FDT); diff --git a/test/dm/mdio.c b/test/dm/mdio.c index ba1b54f27e..067ec65acc 100644 --- a/test/dm/mdio.c +++ b/test/dm/mdio.c @@ -54,4 +54,4 @@ static int dm_test_mdio(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_mdio, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_mdio, UT_TESTF_SCAN_FDT); diff --git a/test/dm/mdio_mux.c b/test/dm/mdio_mux.c index f962e09dbc..dc954a0fd5 100644 --- a/test/dm/mdio_mux.c +++ b/test/dm/mdio_mux.c @@ -77,4 +77,4 @@ static int dm_test_mdio_mux(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_mdio_mux, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_mdio_mux, UT_TESTF_SCAN_FDT); diff --git a/test/dm/misc.c b/test/dm/misc.c index 26fd6acecb..c1ed68d407 100644 --- a/test/dm/misc.c +++ b/test/dm/misc.c @@ -80,4 +80,4 @@ static int dm_test_misc(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_misc, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_misc, UT_TESTF_SCAN_FDT); diff --git a/test/dm/mmc.c b/test/dm/mmc.c index 49402b9c90..b789c6b225 100644 --- a/test/dm/mmc.c +++ b/test/dm/mmc.c @@ -22,7 +22,7 @@ static int dm_test_mmc_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_mmc_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_mmc_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int dm_test_mmc_blk(struct unit_test_state *uts) { @@ -41,4 +41,4 @@ static int dm_test_mmc_blk(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_mmc_blk, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_mmc_blk, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/nop.c b/test/dm/nop.c index 2df29f3d15..7da951a42a 100644 --- a/test/dm/nop.c +++ b/test/dm/nop.c @@ -70,4 +70,4 @@ static int dm_test_nop(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_nop, DM_TESTF_FLAT_TREE | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_nop, UT_TESTF_FLAT_TREE | UT_TESTF_SCAN_FDT); diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c index 1114f34cbf..953919fe66 100644 --- a/test/dm/ofnode.c +++ b/test/dm/ofnode.c @@ -16,7 +16,7 @@ static int dm_test_ofnode_compatible(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_ofnode_compatible, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_ofnode_compatible, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int dm_test_ofnode_by_prop_value(struct unit_test_state *uts) { @@ -43,7 +43,7 @@ static int dm_test_ofnode_by_prop_value(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_ofnode_by_prop_value, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_ofnode_by_prop_value, UT_TESTF_SCAN_FDT); static int dm_test_ofnode_fmap(struct unit_test_state *uts) { @@ -58,7 +58,7 @@ static int dm_test_ofnode_fmap(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_ofnode_fmap, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_ofnode_fmap, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int dm_test_ofnode_read(struct unit_test_state *uts) { @@ -84,7 +84,7 @@ static int dm_test_ofnode_read(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_ofnode_read, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_ofnode_read, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int dm_test_ofnode_read_chosen(struct unit_test_state *uts) { @@ -113,7 +113,7 @@ static int dm_test_ofnode_read_chosen(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_ofnode_read_chosen, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_ofnode_read_chosen, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int dm_test_ofnode_get_child_count(struct unit_test_state *uts) { @@ -134,4 +134,4 @@ static int dm_test_ofnode_get_child_count(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_ofnode_get_child_count, - DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/ofread.c b/test/dm/ofread.c index f2a1382259..9064426e21 100644 --- a/test/dm/ofread.c +++ b/test/dm/ofread.c @@ -47,4 +47,4 @@ static int dm_test_ofnode_get_property_by_prop(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_ofnode_get_property_by_prop, - DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/osd.c b/test/dm/osd.c index 5739dfa0b8..afe6ea15c0 100644 --- a/test/dm/osd.c +++ b/test/dm/osd.c @@ -131,7 +131,7 @@ static int dm_test_osd_basics(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_osd_basics, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_osd_basics, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int dm_test_osd_extended(struct unit_test_state *uts) { @@ -215,4 +215,4 @@ static int dm_test_osd_extended(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_osd_extended, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_osd_extended, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/p2sb.c b/test/dm/p2sb.c index ccb75cf375..df24709141 100644 --- a/test/dm/p2sb.c +++ b/test/dm/p2sb.c @@ -25,4 +25,4 @@ static int dm_test_p2sb_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_p2sb_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_p2sb_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/panel.c b/test/dm/panel.c index 7e4ebd6d81..8226cc43c8 100644 --- a/test/dm/panel.c +++ b/test/dm/panel.c @@ -76,4 +76,4 @@ static int dm_test_panel(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_panel, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_panel, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/pch.c b/test/dm/pch.c index 54e33d187b..afe75e7251 100644 --- a/test/dm/pch.c +++ b/test/dm/pch.c @@ -33,7 +33,7 @@ static int dm_test_pch_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_pch_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_pch_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test sandbox PCH ioctl */ static int dm_test_pch_ioctl(struct unit_test_state *uts) @@ -52,4 +52,4 @@ static int dm_test_pch_ioctl(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_pch_ioctl, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_pch_ioctl, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/pci.c b/test/dm/pci.c index fb93e4c78a..222e8a23ee 100644 --- a/test/dm/pci.c +++ b/test/dm/pci.c @@ -19,7 +19,7 @@ static int dm_test_pci_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_pci_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_pci_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test that sandbox PCI bus numbering and device works correctly */ static int dm_test_pci_busdev(struct unit_test_state *uts) @@ -54,7 +54,7 @@ static int dm_test_pci_busdev(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_pci_busdev, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_pci_busdev, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test that we can use the swapcase device correctly */ static int dm_test_pci_swapcase(struct unit_test_state *uts) @@ -107,7 +107,7 @@ static int dm_test_pci_swapcase(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_pci_swapcase, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_pci_swapcase, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test that we can dynamically bind the device driver correctly */ static int dm_test_pci_drvdata(struct unit_test_state *uts) @@ -129,7 +129,7 @@ static int dm_test_pci_drvdata(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_pci_drvdata, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_pci_drvdata, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test that devices on PCI bus#2 can be accessed correctly */ static int dm_test_pci_mixed(struct unit_test_state *uts) @@ -192,7 +192,7 @@ static int dm_test_pci_mixed(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_pci_mixed, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_pci_mixed, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test looking up PCI capability and extended capability */ static int dm_test_pci_cap(struct unit_test_state *uts) @@ -244,7 +244,7 @@ static int dm_test_pci_cap(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_pci_cap, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_pci_cap, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test looking up BARs in EA capability structure */ static int dm_test_pci_ea(struct unit_test_state *uts) @@ -293,7 +293,7 @@ static int dm_test_pci_ea(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_pci_ea, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_pci_ea, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test the dev_read_addr_pci() function */ static int dm_test_pci_addr_flat(struct unit_test_state *uts) @@ -315,14 +315,14 @@ static int dm_test_pci_addr_flat(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_pci_addr_flat, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT | - DM_TESTF_FLAT_TREE); +DM_TEST(dm_test_pci_addr_flat, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT | + UT_TESTF_FLAT_TREE); /* * Test the dev_read_addr_pci() function with livetree. That function is * not currently fully implemented, in that it fails to return the BAR address. * Once that is implemented this test can be removed and dm_test_pci_addr_flat() - * can be used for both flattree and livetree by removing the DM_TESTF_FLAT_TREE + * can be used for both flattree and livetree by removing the UT_TESTF_FLAT_TREE * flag above. */ static int dm_test_pci_addr_live(struct unit_test_state *uts) @@ -337,5 +337,5 @@ static int dm_test_pci_addr_live(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_pci_addr_live, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT | - DM_TESTF_LIVE_TREE); +DM_TEST(dm_test_pci_addr_live, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT | + UT_TESTF_LIVE_TREE); diff --git a/test/dm/pci_ep.c b/test/dm/pci_ep.c index 101f861751..663766d9c6 100644 --- a/test/dm/pci_ep.c +++ b/test/dm/pci_ep.c @@ -60,5 +60,5 @@ static int dm_test_pci_ep_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_pci_ep_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_pci_ep_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/phy.c b/test/dm/phy.c index 99f0119557..5f1fae5237 100644 --- a/test/dm/phy.c +++ b/test/dm/phy.c @@ -52,7 +52,7 @@ static int dm_test_phy_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_phy_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_phy_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test of the phy uclass using the sandbox phy driver operations */ static int dm_test_phy_ops(struct unit_test_state *uts) @@ -110,7 +110,7 @@ static int dm_test_phy_ops(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_phy_ops, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_phy_ops, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int dm_test_phy_bulk(struct unit_test_state *uts) { @@ -143,4 +143,4 @@ static int dm_test_phy_bulk(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_phy_bulk, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_phy_bulk, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/pmc.c b/test/dm/pmc.c index 1a222838ab..e70227e780 100644 --- a/test/dm/pmc.c +++ b/test/dm/pmc.c @@ -30,4 +30,4 @@ static int dm_test_pmc_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_pmc_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_pmc_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/pmic.c b/test/dm/pmic.c index b582329a9c..c9719d8c3a 100644 --- a/test/dm/pmic.c +++ b/test/dm/pmic.c @@ -43,7 +43,7 @@ static int dm_test_power_pmic_get(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_power_pmic_get, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_power_pmic_get, UT_TESTF_SCAN_FDT); /* PMIC get method - MC34708 - for 3 bytes transmission */ static int dm_test_power_pmic_mc34708_get(struct unit_test_state *uts) @@ -53,7 +53,7 @@ static int dm_test_power_pmic_mc34708_get(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_power_pmic_mc34708_get, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_power_pmic_mc34708_get, UT_TESTF_SCAN_FDT); /* Test PMIC I/O */ static int dm_test_power_pmic_io(struct unit_test_state *uts) @@ -82,7 +82,7 @@ static int dm_test_power_pmic_io(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_power_pmic_io, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_power_pmic_io, UT_TESTF_SCAN_FDT); #define MC34708_PMIC_REG_COUNT 64 #define MC34708_PMIC_TEST_VAL 0x125534 @@ -100,7 +100,7 @@ static int dm_test_power_pmic_mc34708_regs_check(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_power_pmic_mc34708_regs_check, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_power_pmic_mc34708_regs_check, UT_TESTF_SCAN_FDT); static int dm_test_power_pmic_mc34708_rw_val(struct unit_test_state *uts) { @@ -127,4 +127,4 @@ static int dm_test_power_pmic_mc34708_rw_val(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_power_pmic_mc34708_rw_val, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_power_pmic_mc34708_rw_val, UT_TESTF_SCAN_FDT); diff --git a/test/dm/power-domain.c b/test/dm/power-domain.c index 8baf5d09d1..2dc9143096 100644 --- a/test/dm/power-domain.c +++ b/test/dm/power-domain.c @@ -45,4 +45,4 @@ static int dm_test_power_domain(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_power_domain, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_power_domain, UT_TESTF_SCAN_FDT); diff --git a/test/dm/pwm.c b/test/dm/pwm.c index b52ee21a69..99dd9e68f2 100644 --- a/test/dm/pwm.c +++ b/test/dm/pwm.c @@ -28,4 +28,4 @@ static int dm_test_pwm_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_pwm_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_pwm_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/ram.c b/test/dm/ram.c index 3efdb6b80b..ff17a03e68 100644 --- a/test/dm/ram.c +++ b/test/dm/ram.c @@ -24,4 +24,4 @@ static int dm_test_ram_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_ram_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_ram_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/regmap.c b/test/dm/regmap.c index 809494d585..0586cae700 100644 --- a/test/dm/regmap.c +++ b/test/dm/regmap.c @@ -66,7 +66,7 @@ static int dm_test_regmap_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_regmap_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_regmap_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test we can access a regmap through syscon */ static int dm_test_regmap_syscon(struct unit_test_state *uts) @@ -92,7 +92,7 @@ static int dm_test_regmap_syscon(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_regmap_syscon, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_regmap_syscon, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Read/Write/Modify test */ static int dm_test_regmap_rw(struct unit_test_state *uts) @@ -126,7 +126,7 @@ static int dm_test_regmap_rw(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_regmap_rw, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_regmap_rw, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Get/Set test */ static int dm_test_regmap_getset(struct unit_test_state *uts) @@ -157,7 +157,7 @@ static int dm_test_regmap_getset(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_regmap_getset, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_regmap_getset, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Read polling test */ static int dm_test_regmap_poll(struct unit_test_state *uts) @@ -185,4 +185,4 @@ static int dm_test_regmap_poll(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_regmap_poll, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_regmap_poll, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/regulator.c b/test/dm/regulator.c index ca916eeebb..cc2aa09382 100644 --- a/test/dm/regulator.c +++ b/test/dm/regulator.c @@ -89,7 +89,7 @@ static int dm_test_power_regulator_get(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_power_regulator_get, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_power_regulator_get, UT_TESTF_SCAN_FDT); /* Test regulator set and get Voltage method */ static int dm_test_power_regulator_set_get_voltage(struct unit_test_state *uts) @@ -116,7 +116,7 @@ static int dm_test_power_regulator_set_get_voltage(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_power_regulator_set_get_voltage, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_power_regulator_set_get_voltage, UT_TESTF_SCAN_FDT); /* Test regulator set and get Current method */ static int dm_test_power_regulator_set_get_current(struct unit_test_state *uts) @@ -155,7 +155,7 @@ static int dm_test_power_regulator_set_get_current(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_power_regulator_set_get_current, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_power_regulator_set_get_current, UT_TESTF_SCAN_FDT); /* Test regulator set and get Enable method */ static int dm_test_power_regulator_set_get_enable(struct unit_test_state *uts) @@ -174,7 +174,7 @@ static int dm_test_power_regulator_set_get_enable(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_power_regulator_set_get_enable, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_power_regulator_set_get_enable, UT_TESTF_SCAN_FDT); /* Test regulator set and get enable if allowed method */ static @@ -195,7 +195,7 @@ int dm_test_power_regulator_set_enable_if_allowed(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_power_regulator_set_enable_if_allowed, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_power_regulator_set_enable_if_allowed, UT_TESTF_SCAN_FDT); /* Test regulator set and get mode method */ static int dm_test_power_regulator_set_get_mode(struct unit_test_state *uts) @@ -214,7 +214,7 @@ static int dm_test_power_regulator_set_get_mode(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_power_regulator_set_get_mode, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_power_regulator_set_get_mode, UT_TESTF_SCAN_FDT); /* Test regulator set and get suspend Voltage method */ static int dm_test_power_regulator_set_get_suspend_voltage(struct unit_test_state *uts) @@ -244,7 +244,7 @@ static int dm_test_power_regulator_set_get_suspend_voltage(struct unit_test_stat } return 0; } -DM_TEST(dm_test_power_regulator_set_get_suspend_voltage, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_power_regulator_set_get_suspend_voltage, UT_TESTF_SCAN_FDT); /* Test regulator set and get suspend Enable method */ static int dm_test_power_regulator_set_get_suspend_enable(struct unit_test_state *uts) @@ -271,7 +271,7 @@ static int dm_test_power_regulator_set_get_suspend_enable(struct unit_test_state } return 0; } -DM_TEST(dm_test_power_regulator_set_get_suspend_enable, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_power_regulator_set_get_suspend_enable, UT_TESTF_SCAN_FDT); /* Test regulator autoset method */ static int dm_test_power_regulator_autoset(struct unit_test_state *uts) @@ -304,7 +304,7 @@ static int dm_test_power_regulator_autoset(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_power_regulator_autoset, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_power_regulator_autoset, UT_TESTF_SCAN_FDT); /* * Struct setting: to keep the expected output settings. @@ -400,4 +400,4 @@ static int dm_test_power_regulator_autoset_list(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_power_regulator_autoset_list, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_power_regulator_autoset_list, UT_TESTF_SCAN_FDT); diff --git a/test/dm/remoteproc.c b/test/dm/remoteproc.c index 9511c7dd6f..0c3b960dd7 100644 --- a/test/dm/remoteproc.c +++ b/test/dm/remoteproc.c @@ -66,7 +66,7 @@ static int dm_test_remoteproc_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_remoteproc_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_remoteproc_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); #define DEVICE_TO_PHYSICAL_OFFSET 0x1000 /** @@ -254,4 +254,4 @@ static int dm_test_remoteproc_elf(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_remoteproc_elf, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_remoteproc_elf, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/reset.c b/test/dm/reset.c index 871d6400a0..42bffc26d2 100644 --- a/test/dm/reset.c +++ b/test/dm/reset.c @@ -38,7 +38,7 @@ static int dm_test_reset_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_reset_base, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_reset_base, UT_TESTF_SCAN_FDT); static int dm_test_reset(struct unit_test_state *uts) { @@ -63,7 +63,7 @@ static int dm_test_reset(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_reset, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_reset, UT_TESTF_SCAN_FDT); static int dm_test_reset_bulk(struct unit_test_state *uts) { @@ -93,4 +93,4 @@ static int dm_test_reset_bulk(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_reset_bulk, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_reset_bulk, UT_TESTF_SCAN_FDT); diff --git a/test/dm/rng.c b/test/dm/rng.c index 583ce9eddf..5b34c93ed6 100644 --- a/test/dm/rng.c +++ b/test/dm/rng.c @@ -24,4 +24,4 @@ static int dm_test_rng_read(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_rng_read, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_rng_read, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/rtc.c b/test/dm/rtc.c index 88f86581cc..f7ddcdc068 100644 --- a/test/dm/rtc.c +++ b/test/dm/rtc.c @@ -25,7 +25,7 @@ static int dm_test_rtc_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_rtc_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_rtc_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static void show_time(const char *msg, struct rtc_time *time) { @@ -115,7 +115,7 @@ static int dm_test_rtc_set_get(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_rtc_set_get, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_rtc_set_get, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Reset the time */ static int dm_test_rtc_reset(struct unit_test_state *uts) @@ -141,7 +141,7 @@ static int dm_test_rtc_reset(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_rtc_reset, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_rtc_reset, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Check that two RTC devices can be used independently */ static int dm_test_rtc_dual(struct unit_test_state *uts) @@ -173,4 +173,4 @@ static int dm_test_rtc_dual(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_rtc_dual, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_rtc_dual, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/serial.c b/test/dm/serial.c index 6237693cb8..407bf3b63f 100644 --- a/test/dm/serial.c +++ b/test/dm/serial.c @@ -68,4 +68,4 @@ static int dm_test_serial(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_serial, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_serial, UT_TESTF_SCAN_FDT); diff --git a/test/dm/sf.c b/test/dm/sf.c index 9e7dead684..4d09993ed7 100644 --- a/test/dm/sf.c +++ b/test/dm/sf.c @@ -64,7 +64,7 @@ static int dm_test_spi_flash(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_spi_flash, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_spi_flash, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Functional test that sandbox SPI flash works correctly */ static int dm_test_spi_flash_func(struct unit_test_state *uts) @@ -92,4 +92,4 @@ static int dm_test_spi_flash_func(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_spi_flash_func, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_spi_flash_func, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/smem.c b/test/dm/smem.c index 4099a5f66c..e7387a2432 100644 --- a/test/dm/smem.c +++ b/test/dm/smem.c @@ -23,5 +23,5 @@ static int dm_test_smem_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_smem_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_smem_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/sound.c b/test/dm/sound.c index aa5368f05b..6af1f3a559 100644 --- a/test/dm/sound.c +++ b/test/dm/sound.c @@ -32,7 +32,7 @@ static int dm_test_sound(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_sound, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_sound, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test of the 'start beep' operations */ static int dm_test_sound_beep(struct unit_test_state *uts) @@ -53,4 +53,4 @@ static int dm_test_sound_beep(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_sound_beep, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_sound_beep, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/spi.c b/test/dm/spi.c index 8e417acc5f..b415f084f0 100644 --- a/test/dm/spi.c +++ b/test/dm/spi.c @@ -91,7 +91,7 @@ static int dm_test_spi_find(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_spi_find, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_spi_find, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test that sandbox SPI works correctly */ static int dm_test_spi_xfer(struct unit_test_state *uts) @@ -123,4 +123,4 @@ static int dm_test_spi_xfer(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_spi_xfer, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_spi_xfer, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/spmi.c b/test/dm/spmi.c index 668b7e133f..53a6bd2fd8 100644 --- a/test/dm/spmi.c +++ b/test/dm/spmi.c @@ -43,7 +43,7 @@ static int dm_test_spmi_probe(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_spmi_probe, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_spmi_probe, UT_TESTF_SCAN_FDT); /* Test if it's possible to read bus directly and indirectly */ static int dm_test_spmi_access(struct unit_test_state *uts) @@ -68,7 +68,7 @@ static int dm_test_spmi_access(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_spmi_access, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_spmi_access, UT_TESTF_SCAN_FDT); /* Test if it's possible to access GPIO that should be in pmic */ @@ -109,4 +109,4 @@ static int dm_test_spmi_access_peripheral(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_spmi_access_peripheral, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_spmi_access_peripheral, UT_TESTF_SCAN_FDT); diff --git a/test/dm/syscon.c b/test/dm/syscon.c index 06a1c69ac5..dbc45ebfa1 100644 --- a/test/dm/syscon.c +++ b/test/dm/syscon.c @@ -28,7 +28,7 @@ static int dm_test_syscon_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_syscon_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_syscon_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test system controller finding */ static int dm_test_syscon_by_driver_data(struct unit_test_state *uts) @@ -45,7 +45,7 @@ static int dm_test_syscon_by_driver_data(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_syscon_by_driver_data, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_syscon_by_driver_data, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test system controller by phandle */ static int dm_test_syscon_by_phandle(struct unit_test_state *uts) @@ -80,4 +80,4 @@ static int dm_test_syscon_by_phandle(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_syscon_by_phandle, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_syscon_by_phandle, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/sysreset.c b/test/dm/sysreset.c index 5b2358ef67..a230cd8dc4 100644 --- a/test/dm/sysreset.c +++ b/test/dm/sysreset.c @@ -43,7 +43,7 @@ static int dm_test_sysreset_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_sysreset_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_sysreset_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int dm_test_sysreset_get_status(struct unit_test_state *uts) { @@ -62,7 +62,7 @@ static int dm_test_sysreset_get_status(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_sysreset_get_status, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_sysreset_get_status, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test that we can walk through the sysreset devices */ static int dm_test_sysreset_walk(struct unit_test_state *uts) @@ -90,7 +90,7 @@ static int dm_test_sysreset_walk(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_sysreset_walk, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_sysreset_walk, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int dm_test_sysreset_get_last(struct unit_test_state *uts) { @@ -109,4 +109,4 @@ static int dm_test_sysreset_get_last(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_sysreset_get_last, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_sysreset_get_last, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/tee.c b/test/dm/tee.c index 632e9960b0..618f3e3efe 100644 --- a/test/dm/tee.c +++ b/test/dm/tee.c @@ -114,4 +114,4 @@ static int dm_test_tee(struct unit_test_state *uts) return rc; } -DM_TEST(dm_test_tee, DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_tee, UT_TESTF_SCAN_FDT); diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c index 4fcae03dc5..70c198ac7c 100644 --- a/test/dm/test-fdt.c +++ b/test/dm/test-fdt.c @@ -377,7 +377,7 @@ static int dm_test_fdt_uclass_seq(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_fdt_uclass_seq, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_fdt_uclass_seq, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test that we can find a device by device tree offset */ static int dm_test_fdt_offset(struct unit_test_state *uts) @@ -407,7 +407,7 @@ static int dm_test_fdt_offset(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_fdt_offset, - DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT | DM_TESTF_FLAT_TREE); + UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT | UT_TESTF_FLAT_TREE); /** * Test various error conditions with uclass_first_device() and @@ -448,7 +448,7 @@ static int dm_test_first_next_device(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_first_next_device, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_first_next_device, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test iteration through devices in a uclass */ static int dm_test_uclass_foreach(struct unit_test_state *uts) @@ -469,7 +469,7 @@ static int dm_test_uclass_foreach(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_uclass_foreach, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_uclass_foreach, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /** * check_devices() - Check return values and pointers @@ -549,7 +549,7 @@ static int dm_test_first_next_ok_device(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_first_next_ok_device, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_first_next_ok_device, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static const struct udevice_id fdt_dummy_ids[] = { { .compatible = "denx,u-boot-fdt-dummy", }, @@ -604,7 +604,7 @@ static int dm_test_fdt_translation(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_fdt_translation, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_fdt_translation, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int dm_test_fdt_remap_addr_flat(struct unit_test_state *uts) { @@ -624,7 +624,7 @@ static int dm_test_fdt_remap_addr_flat(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_fdt_remap_addr_flat, - DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT | DM_TESTF_FLAT_TREE); + UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT | UT_TESTF_FLAT_TREE); static int dm_test_fdt_remap_addr_index_flat(struct unit_test_state *uts) { @@ -646,7 +646,7 @@ static int dm_test_fdt_remap_addr_index_flat(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_fdt_remap_addr_index_flat, - DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT | DM_TESTF_FLAT_TREE); + UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT | UT_TESTF_FLAT_TREE); static int dm_test_fdt_remap_addr_name_flat(struct unit_test_state *uts) { @@ -668,7 +668,7 @@ static int dm_test_fdt_remap_addr_name_flat(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_fdt_remap_addr_name_flat, - DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT | DM_TESTF_FLAT_TREE); + UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT | UT_TESTF_FLAT_TREE); static int dm_test_fdt_remap_addr_live(struct unit_test_state *uts) { @@ -688,7 +688,7 @@ static int dm_test_fdt_remap_addr_live(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_fdt_remap_addr_live, - DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int dm_test_fdt_remap_addr_index_live(struct unit_test_state *uts) { @@ -710,7 +710,7 @@ static int dm_test_fdt_remap_addr_index_live(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_fdt_remap_addr_index_live, - DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int dm_test_fdt_remap_addr_name_live(struct unit_test_state *uts) { @@ -732,7 +732,7 @@ static int dm_test_fdt_remap_addr_name_live(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_fdt_remap_addr_name_live, - DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int dm_test_fdt_livetree_writing(struct unit_test_state *uts) { @@ -784,7 +784,7 @@ static int dm_test_fdt_livetree_writing(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_fdt_livetree_writing, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_fdt_livetree_writing, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int dm_test_fdt_disable_enable_by_path(struct unit_test_state *uts) { @@ -811,8 +811,8 @@ static int dm_test_fdt_disable_enable_by_path(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_fdt_disable_enable_by_path, DM_TESTF_SCAN_PDATA | - DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_fdt_disable_enable_by_path, UT_TESTF_SCAN_PDATA | + UT_TESTF_SCAN_FDT); /* Test a few uclass phandle functions */ static int dm_test_fdt_phandle(struct unit_test_state *uts) @@ -832,7 +832,7 @@ static int dm_test_fdt_phandle(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_fdt_phandle, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_fdt_phandle, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test device_find_first_child_by_uclass() */ static int dm_test_first_child(struct unit_test_state *uts) @@ -859,7 +859,7 @@ static int dm_test_first_child(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_first_child, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_first_child, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test integer functions in dm_read_...() */ static int dm_test_read_int(struct unit_test_state *uts) @@ -904,7 +904,7 @@ static int dm_test_read_int(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_read_int, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_read_int, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int dm_test_read_int_index(struct unit_test_state *uts) { @@ -933,7 +933,7 @@ static int dm_test_read_int_index(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_read_int_index, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_read_int_index, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test iteration through devices by drvdata */ static int dm_test_uclass_drvdata(struct unit_test_state *uts) @@ -954,7 +954,7 @@ static int dm_test_uclass_drvdata(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_uclass_drvdata, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_uclass_drvdata, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test device_first_child_ofdata_err(), etc. */ static int dm_test_child_ofdata(struct unit_test_state *uts) @@ -973,7 +973,7 @@ static int dm_test_child_ofdata(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_child_ofdata, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_child_ofdata, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test device_first_child_err(), etc. */ static int dm_test_first_child_probe(struct unit_test_state *uts) @@ -992,7 +992,7 @@ static int dm_test_first_child_probe(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_first_child_probe, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_first_child_probe, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test that ofdata is read for parents before children */ static int dm_test_ofdata_order(struct unit_test_state *uts) @@ -1017,4 +1017,4 @@ static int dm_test_ofdata_order(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_ofdata_order, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_ofdata_order, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/test-main.c b/test/dm/test-main.c index 53e5ca321f..b5f2e0d57e 100644 --- a/test/dm/test-main.c +++ b/test/dm/test-main.c @@ -87,11 +87,11 @@ static int dm_do_test(struct unit_test_state *uts, struct unit_test *test, ut_assertok(dm_test_init(uts, of_live)); uts->start = mallinfo(); - if (test->flags & DM_TESTF_SCAN_PDATA) + if (test->flags & UT_TESTF_SCAN_PDATA) ut_assertok(dm_scan_platdata(false)); - if (test->flags & DM_TESTF_PROBE_TEST) + if (test->flags & UT_TESTF_PROBE_TEST) ut_assertok(do_autoprobe(uts)); - if (test->flags & DM_TESTF_SCAN_FDT) + if (test->flags & UT_TESTF_SCAN_FDT) ut_assertok(dm_extended_scan_fdt(gd->fdt_blob, false)); /* @@ -166,7 +166,7 @@ static int dm_test_main(const char *test_name) /* Run with the live tree if possible */ runs = 0; if (IS_ENABLED(CONFIG_OF_LIVE)) { - if (!(test->flags & DM_TESTF_FLAT_TREE)) { + if (!(test->flags & UT_TESTF_FLAT_TREE)) { ut_assertok(dm_do_test(uts, test, true)); runs++; } @@ -176,7 +176,7 @@ static int dm_test_main(const char *test_name) * Run with the flat tree if we couldn't run it with live tree, * or it is a core test. */ - if (!(test->flags & DM_TESTF_LIVE_TREE) && + if (!(test->flags & UT_TESTF_LIVE_TREE) && (!runs || dm_test_run_on_flattree(test))) { ut_assertok(dm_do_test(uts, test, false)); runs++; diff --git a/test/dm/timer.c b/test/dm/timer.c index 9367dab5d5..d7fcd68fb8 100644 --- a/test/dm/timer.c +++ b/test/dm/timer.c @@ -21,4 +21,4 @@ static int dm_test_timer_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_timer_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_timer_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/usb.c b/test/dm/usb.c index a25c2c1482..b7f5b0a4c8 100644 --- a/test/dm/usb.c +++ b/test/dm/usb.c @@ -33,7 +33,7 @@ static int dm_test_usb_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_usb_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_usb_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* * Test that we can use the flash stick. This is more of a functional test. It @@ -60,7 +60,7 @@ static int dm_test_usb_flash(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_usb_flash, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_usb_flash, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* test that we can handle multiple storage devices */ static int dm_test_usb_multi(struct unit_test_state *uts) @@ -76,7 +76,7 @@ static int dm_test_usb_multi(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_usb_multi, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_usb_multi, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int count_usb_devices(void) { @@ -120,7 +120,7 @@ static int dm_test_usb_stop(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_usb_stop, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_usb_stop, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /** * dm_test_usb_keyb() - test USB keyboard driver @@ -412,4 +412,4 @@ static int dm_test_usb_keyb(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_usb_keyb, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_usb_keyb, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/video.c b/test/dm/video.c index 0664e3f22b..f4fc40c9c8 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -39,7 +39,7 @@ static int dm_test_video_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_video_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_video_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /** * compress_frame_buffer() - Compress the frame buffer and return its size @@ -132,7 +132,7 @@ static int dm_test_video_text(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_video_text, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_video_text, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test handling of special characters in the console */ static int dm_test_video_chars(struct unit_test_state *uts) @@ -148,7 +148,7 @@ static int dm_test_video_chars(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_video_chars, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_video_chars, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); #ifdef CONFIG_VIDEO_ANSI #define ANSI_ESC "\x1b" @@ -181,7 +181,7 @@ static int dm_test_video_ansi(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_video_ansi, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_video_ansi, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); #endif /** @@ -237,7 +237,7 @@ static int dm_test_video_context(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_video_context, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_video_context, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test rotated text output through the console uclass */ static int dm_test_video_rotation1(struct unit_test_state *uts) @@ -246,7 +246,7 @@ static int dm_test_video_rotation1(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_video_rotation1, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_video_rotation1, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test rotated text output through the console uclass */ static int dm_test_video_rotation2(struct unit_test_state *uts) @@ -255,7 +255,7 @@ static int dm_test_video_rotation2(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_video_rotation2, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_video_rotation2, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test rotated text output through the console uclass */ static int dm_test_video_rotation3(struct unit_test_state *uts) @@ -264,7 +264,7 @@ static int dm_test_video_rotation3(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_video_rotation3, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_video_rotation3, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Read a file into memory and return a pointer to it */ static int read_file(struct unit_test_state *uts, const char *fname, @@ -302,7 +302,7 @@ static int dm_test_video_bmp(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_video_bmp, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_video_bmp, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test drawing a compressed bitmap file */ static int dm_test_video_bmp_comp(struct unit_test_state *uts) @@ -318,7 +318,7 @@ static int dm_test_video_bmp_comp(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_video_bmp_comp, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_video_bmp_comp, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test TrueType console */ static int dm_test_video_truetype(struct unit_test_state *uts) @@ -333,7 +333,7 @@ static int dm_test_video_truetype(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_video_truetype, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_video_truetype, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test scrolling TrueType console */ static int dm_test_video_truetype_scroll(struct unit_test_state *uts) @@ -354,7 +354,7 @@ static int dm_test_video_truetype_scroll(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_video_truetype_scroll, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_video_truetype_scroll, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test TrueType backspace, within and across lines */ static int dm_test_video_truetype_bs(struct unit_test_state *uts) @@ -375,4 +375,4 @@ static int dm_test_video_truetype_bs(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_video_truetype_bs, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_video_truetype_bs, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/virtio.c b/test/dm/virtio.c index 4b317d2ec3..d87d11cd06 100644 --- a/test/dm/virtio.c +++ b/test/dm/virtio.c @@ -33,7 +33,7 @@ static int dm_test_virtio_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_virtio_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_virtio_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test all of the virtio uclass ops */ static int dm_test_virtio_all_ops(struct unit_test_state *uts) @@ -79,7 +79,7 @@ static int dm_test_virtio_all_ops(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_virtio_all_ops, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_virtio_all_ops, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test of the virtio driver that does not have required driver ops */ static int dm_test_virtio_missing_ops(struct unit_test_state *uts) @@ -97,7 +97,7 @@ static int dm_test_virtio_missing_ops(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_virtio_missing_ops, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_virtio_missing_ops, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Test removal of virtio device driver */ static int dm_test_virtio_remove(struct unit_test_state *uts) @@ -119,4 +119,4 @@ static int dm_test_virtio_remove(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_virtio_remove, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_virtio_remove, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/dm/wdt.c b/test/dm/wdt.c index 1d31ec55c6..d49e572ad5 100644 --- a/test/dm/wdt.c +++ b/test/dm/wdt.c @@ -37,4 +37,4 @@ static int dm_test_wdt_base(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_wdt_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(dm_test_wdt_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); diff --git a/test/lib/lmb.c b/test/lib/lmb.c index a0fe0f6b33..3d3a61db10 100644 --- a/test/lib/lmb.c +++ b/test/lib/lmb.c @@ -199,7 +199,7 @@ static int lib_test_lmb_simple(struct unit_test_state *uts) return test_multi_alloc_512mb(uts, 0xE0000000); } -DM_TEST(lib_test_lmb_simple, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(lib_test_lmb_simple, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Create two memory regions with one reserved region and allocate */ static int lib_test_lmb_simple_x2(struct unit_test_state *uts) @@ -215,7 +215,7 @@ static int lib_test_lmb_simple_x2(struct unit_test_state *uts) return test_multi_alloc_512mb_x2(uts, 0xE0000000, 0x40000000); } -DM_TEST(lib_test_lmb_simple_x2, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(lib_test_lmb_simple_x2, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Simulate 512 MiB RAM, allocate some blocks that fit/don't fit */ static int test_bigblock(struct unit_test_state *uts, const phys_addr_t ram) @@ -282,7 +282,7 @@ static int lib_test_lmb_big(struct unit_test_state *uts) return test_bigblock(uts, 0xE0000000); } -DM_TEST(lib_test_lmb_big, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(lib_test_lmb_big, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Simulate 512 MiB RAM, allocate a block without previous reservation */ static int test_noreserved(struct unit_test_state *uts, const phys_addr_t ram, @@ -357,7 +357,7 @@ static int lib_test_lmb_noreserved(struct unit_test_state *uts) return test_noreserved(uts, 0xE0000000, 4, 1); } -DM_TEST(lib_test_lmb_noreserved, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(lib_test_lmb_noreserved, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); static int lib_test_lmb_unaligned_size(struct unit_test_state *uts) { @@ -372,7 +372,7 @@ static int lib_test_lmb_unaligned_size(struct unit_test_state *uts) return test_noreserved(uts, 0xE0000000, 5, 8); } -DM_TEST(lib_test_lmb_unaligned_size, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(lib_test_lmb_unaligned_size, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* * Simulate a RAM that starts at 0 and allocate down to address 0, which must * fail as '0' means failure for the lmb_alloc functions. @@ -415,7 +415,7 @@ static int lib_test_lmb_at_0(struct unit_test_state *uts) return 0; } -DM_TEST(lib_test_lmb_at_0, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(lib_test_lmb_at_0, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Check that calling lmb_reserve with overlapping regions fails. */ static int lib_test_lmb_overlapping_reserve(struct unit_test_state *uts) @@ -454,7 +454,7 @@ static int lib_test_lmb_overlapping_reserve(struct unit_test_state *uts) } DM_TEST(lib_test_lmb_overlapping_reserve, - DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* * Simulate 512 MiB RAM, reserve 3 blocks, allocate addresses in between. @@ -584,7 +584,7 @@ static int lib_test_lmb_alloc_addr(struct unit_test_state *uts) return test_alloc_addr(uts, 0xE0000000); } -DM_TEST(lib_test_lmb_alloc_addr, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +DM_TEST(lib_test_lmb_alloc_addr, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); /* Simulate 512 MiB RAM, reserve 3 blocks, check addresses in between */ static int test_get_unreserved_size(struct unit_test_state *uts, @@ -656,4 +656,4 @@ static int lib_test_lmb_get_free_size(struct unit_test_state *uts) } DM_TEST(lib_test_lmb_get_free_size, - DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); From patchwork Mon Jun 8 02:43:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 241902 List-Id: U-Boot discussion From: sjg at chromium.org (Simon Glass) Date: Sun, 7 Jun 2020 20:43:35 -0600 Subject: [PATCH v2 08/10] console: Always define the console-recording functions In-Reply-To: <20200608024337.85575-1-sjg@chromium.org> References: <20200608024337.85575-1-sjg@chromium.org> Message-ID: <20200608024337.85575-3-sjg@chromium.org> On boards without console recording these function are currently missing. It is more convenient for them to be present but to return dummy values. That way if we know that a test needs recording, we can check if it is available, and skip the test if not, while avoiding #ifdefs. Update the header file according and adjust console_record_reset_enable() to return an error if recording is not available. Signed-off-by: Simon Glass --- (no changes since v1) common/console.c | 4 +++- include/console.h | 39 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/common/console.c b/common/console.c index 1deca3cb78..719ab8a1a6 100644 --- a/common/console.c +++ b/common/console.c @@ -619,10 +619,12 @@ void console_record_reset(void) membuff_purge((struct membuff *)&gd->console_in); } -void console_record_reset_enable(void) +int console_record_reset_enable(void) { console_record_reset(); gd->flags |= GD_FLG_RECORD; + + return 0; } int console_record_readline(char *str, int maxlen) diff --git a/include/console.h b/include/console.h index 74afe22b7e..74a41d953b 100644 --- a/include/console.h +++ b/include/console.h @@ -19,11 +19,14 @@ void clear_ctrlc(void); /* clear the Control-C condition */ int disable_ctrlc(int); /* 1 to disable, 0 to enable Control-C detect */ int confirm_yesno(void); /* 1 if input is "y", "Y", "yes" or "YES" */ +#ifdef CONFIG_CONSOLE_RECORD /** * console_record_init() - set up the console recording buffers * * This should be called as soon as malloc() is available so that the maximum * amount of console output can be recorded. + * + * @return 0 if OK, -ENOMEM if out of memory */ int console_record_init(void); @@ -38,8 +41,10 @@ void console_record_reset(void); * console_record_reset_enable() - reset and enable the console buffers * * This should be called to enable the console buffer. + * + * @return 0 (always) */ -void console_record_reset_enable(void); +int console_record_reset_enable(void); /** * console_record_readline() - Read a line from the console output @@ -59,6 +64,38 @@ int console_record_readline(char *str, int maxlen); * @return available bytes (0 if empty) */ int console_record_avail(void); +#else +static inline int console_record_init(void) +{ + /* Always succeed, since it is not enabled */ + + return 0; +} + +static inline void console_record_reset(void) +{ + /* Nothing to do here */ +} + +static inline int console_record_reset_enable(void) +{ + /* Cannot enable it as it is not supported */ + return -ENOSYS; +} + +static inline int console_record_readline(char *str, int maxlen) +{ + /* Nothing to read */ + return 0; +} + +static inline int console_record_avail(void) +{ + /* There is never anything available */ + return 0; +} + +#endif /* !CONFIG_CONSOLE_RECORD */ /** * console_announce_r() - print a U-Boot console on non-serial consoles From patchwork Mon Jun 8 02:43:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 241903 List-Id: U-Boot discussion From: sjg at chromium.org (Simon Glass) Date: Sun, 7 Jun 2020 20:43:36 -0600 Subject: [PATCH v2 09/10] test: Add a flag for tests that need console recording In-Reply-To: <20200608024337.85575-1-sjg@chromium.org> References: <20200608024337.85575-1-sjg@chromium.org> Message-ID: <20200608024337.85575-4-sjg@chromium.org> Allow tests that need console recording to be marked, so they can be skipped if it is not available. Signed-off-by: Simon Glass --- (no changes since v1) include/test/test.h | 1 + test/cmd_ut.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/include/test/test.h b/include/test/test.h index ff92c39006..d66cd9e889 100644 --- a/include/test/test.h +++ b/include/test/test.h @@ -35,6 +35,7 @@ enum { UT_TESTF_SCAN_FDT = BIT(2), /* scan device tree */ UT_TESTF_FLAT_TREE = BIT(3), /* test needs flat DT */ UT_TESTF_LIVE_TREE = BIT(4), /* needs live device tree */ + UT_TESTF_CONSOLE_REC = BIT(4), /* needs console recording */ }; /** diff --git a/test/cmd_ut.c b/test/cmd_ut.c index cc9543c315..1963f3792c 100644 --- a/test/cmd_ut.c +++ b/test/cmd_ut.c @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -34,6 +35,15 @@ int cmd_ut_category(const char *name, const char *prefix, continue; printf("Test: %s\n", test->name); + if (test->flags & UT_TESTF_CONSOLE_REC) { + int ret = console_record_reset_enable(); + + if (ret) { + printf("Skipping: Console recording disabled\n"); + continue; + } + } + uts.start = mallinfo(); test->func(&uts); From patchwork Mon Jun 8 02:43:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 241904 List-Id: U-Boot discussion From: sjg at chromium.org (Simon Glass) Date: Sun, 7 Jun 2020 20:43:37 -0600 Subject: [PATCH v2 10/10] cmd: Add a memory-search command In-Reply-To: <20200608024337.85575-1-sjg@chromium.org> References: <20200608024337.85575-1-sjg@chromium.org> Message-ID: <20200607204328.v2.10.Iaf24bd607de3836b8cd474fd0ae88452396ccb62@changeid> It is useful to be able to find hex values and strings in a memory range. Add a command to support this. Signed-off-by: Simon Glass --- Changes in v2: - Rename the Kconfig to CONFIG_CMD_MEM_SEARCH - Use a separate var for the remaining search length - Drop unnecessary ':' in the U_BOOT_CMD - Enable the command for sandbox - Split the argc/argv changes over two lines - Add the missing cover-letter tags - Correct a bug when auto-repeating right at the end (and add test) - Move tests to a new suite of their own, instead of DM tests - Add -q flag to the 'quiet' test to test operation when console is enabled README | 10 ++ cmd/Kconfig | 14 ++ cmd/mem.c | 157 ++++++++++++++++++ configs/sandbox_defconfig | 1 + include/test/suites.h | 1 + test/Makefile | 1 + test/cmd/Makefile | 6 + test/cmd/mem.c | 20 +++ test/cmd/mem_search.c | 325 ++++++++++++++++++++++++++++++++++++++ test/cmd_ut.c | 2 + 10 files changed, 537 insertions(+) create mode 100644 test/cmd/Makefile create mode 100644 test/cmd/mem.c create mode 100644 test/cmd/mem_search.c diff --git a/README b/README index bcf1983631..83d22a74d5 100644 --- a/README +++ b/README @@ -3260,6 +3260,7 @@ md - memory display mm - memory modify (auto-incrementing) nm - memory modify (constant address) mw - memory write (fill) +ms - memory search cp - memory copy cmp - memory compare crc32 - checksum calculation @@ -3505,6 +3506,15 @@ List of environment variables (most likely not complete): CONFIG_NET_RETRY_COUNT, if defined. This value has precedence over the valu based on CONFIG_NET_RETRY_COUNT. + memmatches - Number of matches found by the last 'ms' command, in hex + + memaddr - Address of the last match found by the 'ms' command, in hex, + or 0 if none + + mempos - Index position of the last match found by the 'ms' command, + in units of the size (.b, .w, .l) of the search + + The following image location variables contain the location of images used in booting. The "Image" column gives the role of the image and is not an environment variable name. The other columns are environment diff --git a/cmd/Kconfig b/cmd/Kconfig index 192b3b262f..a85871cd48 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -718,6 +718,20 @@ config CMD_MEMORY base - print or set address offset loop - initialize loop on address range +config CMD_MEM_SEARCH + bool "ms - Memory search" + help + Memory-search command + + This allows searching through a region of memory looking for hex + data (byte, 16-bit word, 32-bit long, also 64-bit on machines that + support it). It is also possible to search for a string. The + command accepts a memory range and a list of values to search for. + The values need to appear in memory in the same order they are given + in the command. At most 10 matches can be returned at a time, but + pressing return will show the next 10 matches. Environment variables + are set for use with scripting (memmatches, memaddr, mempos). + config CMD_MX_CYCLIC bool "Enable cyclic md/mw commands" depends on CMD_MEMORY diff --git a/cmd/mem.c b/cmd/mem.c index ab2c9df621..f5b9b3238f 100644 --- a/cmd/mem.c +++ b/cmd/mem.c @@ -25,6 +25,7 @@ #include #include #include +#include #include DECLARE_GLOBAL_DATA_PTR; @@ -50,6 +51,11 @@ static ulong dp_last_length = 0x40; static ulong mm_last_addr, mm_last_size; static ulong base_address = 0; +#ifdef CONFIG_CMD_MEM_SEARCH +static ulong dp_last_ms_length; +static u8 search_buf[64]; +static uint search_len; +#endif /* Memory Display * @@ -360,6 +366,147 @@ static int do_mem_cp(struct cmd_tbl *cmdtp, int flag, int argc, return 0; } +#ifdef CONFIG_CMD_MEM_SEARCH +static int do_mem_search(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + ulong addr, length, bytes, offset; + u8 *ptr, *end, *buf; + bool quiet = false; + ulong last_pos; /* Offset of last match in 'size' units*/ + ulong last_addr; /* Address of last displayed line */ + int limit = 10; + int used_len; + int count; + int size; + int i; + + /* We use the last specified parameters, unless new ones are entered */ + addr = dp_last_addr; + size = dp_last_size; + length = dp_last_ms_length; + + if (argc < 3) + return CMD_RET_USAGE; + + if (!(flag & CMD_FLAG_REPEAT)) { + /* + * Check for a size specification. + * Defaults to long if no or incorrect specification. + */ + size = cmd_get_data_size(argv[0], 4); + if (size < 0 && size != -2 /* string */) + return 1; + + argc--; + argv++; + while (argc && *argv[0] == '-') { + int ch = argv[0][1]; + + if (ch == 'q') + quiet = true; + else if (ch == 'l' && isxdigit(argv[0][2])) + limit = simple_strtoul(argv[0] + 2, NULL, 16); + else + return CMD_RET_USAGE; + argc--; + argv++; + } + + /* Address is specified since argc > 1 */ + addr = simple_strtoul(argv[0], NULL, 16); + addr += base_address; + + /* Length is the number of objects, not number of bytes */ + length = simple_strtoul(argv[1], NULL, 16); + + /* Read the bytes to search for */ + end = search_buf + sizeof(search_buf); + for (i = 2, ptr = search_buf; i < argc && ptr < end; i++) { + if (MEM_SUPPORT_64BIT_DATA && size == 8) { + u64 val = simple_strtoull(argv[i], NULL, 16); + + *(u64 *)ptr = val; + } else if (size == -2) { /* string */ + int len = min(strlen(argv[i]), + (size_t)(end - ptr)); + + memcpy(ptr, argv[i], len); + ptr += len; + continue; + } else { + u32 val = simple_strtoul(argv[i], NULL, 16); + + switch (size) { + case 1: + *ptr = val; + break; + case 2: + *(u16 *)ptr = val; + break; + case 4: + *(u32 *)ptr = val; + break; + } + } + ptr += size; + } + search_len = ptr - search_buf; + } + + /* Do the search */ + if (size == -2) + size = 1; + bytes = size * length; + buf = map_sysmem(addr, bytes); + last_pos = 0; + last_addr = 0; + count = 0; + for (offset = 0; + offset < bytes && offset <= bytes - search_len && count < limit; + offset += size) { + void *ptr = buf + offset; + + if (!memcmp(ptr, search_buf, search_len)) { + uint align = (addr + offset) & 0xf; + ulong match = addr + offset; + + if (!count || (last_addr & ~0xf) != (match & ~0xf)) { + if (!quiet) { + if (count) + printf("--\n"); + print_buffer(match - align, ptr - align, + size, + ALIGN(search_len + align, + 16) / size, 0); + } + last_addr = match; + last_pos = offset / size; + } + count++; + } + } + if (!quiet) { + printf("%d match%s", count, count == 1 ? "" : "es"); + if (count == limit) + printf(" (repeat command to check for more)"); + printf("\n"); + } + env_set_hex("memmatches", count); + env_set_hex("memaddr", last_addr); + env_set_hex("mempos", last_pos); + + unmap_sysmem(buf); + + used_len = offset / size; + dp_last_addr = addr + used_len; + dp_last_size = size; + dp_last_ms_length = length < used_len ? 0 : length - used_len; + + return count ? 0 : CMD_RET_FAILURE; +} +#endif + static int do_mem_base(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { @@ -1194,6 +1341,16 @@ U_BOOT_CMD( "[.b, .w, .l" HELP_Q "] addr1 addr2 count" ); +#ifdef CONFIG_CMD_MEM_SEARCH +/**************************************************/ +U_BOOT_CMD( + ms, 255, 1, do_mem_search, + "memory search", + "[.b, .w, .l" HELP_Q ", .s] [-q | -] address #-of-objects ..." + " -q = quiet, -l = match limit" +); +#endif + #ifdef CONFIG_CMD_CRC32 #ifndef CONFIG_CRC32_VERIFY diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index 5b7569319b..e55ec1a49c 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -37,6 +37,7 @@ CONFIG_CMD_NVEDIT_EFI=y CONFIG_LOOPW=y CONFIG_CMD_MD5SUM=y CONFIG_CMD_MEMINFO=y +CONFIG_CMD_MEM_SEARCH=y CONFIG_CMD_MX_CYCLIC=y CONFIG_CMD_MEMTEST=y CONFIG_SYS_MEMTEST_START=0x00100000 diff --git a/include/test/suites.h b/include/test/suites.h index f120b3a82a..ab7b3bd9ca 100644 --- a/include/test/suites.h +++ b/include/test/suites.h @@ -34,6 +34,7 @@ int do_ut_dm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); int do_ut_env(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); int do_ut_lib(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); int do_ut_log(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]); +int do_ut_mem(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); int do_ut_optee(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); int do_ut_overlay(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); diff --git a/test/Makefile b/test/Makefile index bab8f1a5c2..7c4039964e 100644 --- a/test/Makefile +++ b/test/Makefile @@ -3,6 +3,7 @@ # (C) Copyright 2012 The Chromium Authors obj-$(CONFIG_SANDBOX) += bloblist.o +obj-$(CONFIG_CMDLINE) += cmd/ obj-$(CONFIG_UNIT_TEST) += cmd_ut.o obj-$(CONFIG_UNIT_TEST) += ut.o obj-$(CONFIG_SANDBOX) += command_ut.o diff --git a/test/cmd/Makefile b/test/cmd/Makefile new file mode 100644 index 0000000000..859dcda239 --- /dev/null +++ b/test/cmd/Makefile @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (c) 2013 Google, Inc + +obj-y += mem.o +obj-$(CONFIG_CMD_MEM_SEARCH) += mem_search.o diff --git a/test/cmd/mem.c b/test/cmd/mem.c new file mode 100644 index 0000000000..fa6770e8c0 --- /dev/null +++ b/test/cmd/mem.c @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Executes tests for memory-related commands + * + * Copyright 2020 Google LLC + */ + +#include +#include +#include +#include + +int do_ut_mem(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) +{ + struct unit_test *tests = ll_entry_start(struct unit_test, mem_test); + const int n_ents = ll_entry_count(struct unit_test, mem_test); + + return cmd_ut_category("cmd_mem", "cmd_mem_", tests, n_ents, argc, + argv); +} diff --git a/test/cmd/mem_search.c b/test/cmd/mem_search.c new file mode 100644 index 0000000000..94942793a4 --- /dev/null +++ b/test/cmd/mem_search.c @@ -0,0 +1,325 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Tests for memory commands + * + * Copyright 2020 Google LLC + * Written by Simon Glass + */ + +#include +#include +#include +#include +#include + +#define BUF_SIZE 0x100 + +/* Declare a new mem test */ +#define MEM_TEST(_name, _flags) UNIT_TEST(_name, _flags, mem_test) + +/* Test 'ms' command with bytes */ +static int mem_test_ms_b(struct unit_test_state *uts) +{ + u8 *buf; + + buf = map_sysmem(0, BUF_SIZE + 1); + memset(buf, '\0', BUF_SIZE); + buf[0x0] = 0x12; + buf[0x31] = 0x12; + buf[0xff] = 0x12; + buf[0x100] = 0x12; + ut_assertok(console_record_reset_enable()); + run_command("ms.b 1 ff 12", 0); + ut_assert_nextline("00000030: 00 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................"); + ut_assert_nextline("--"); + ut_assert_nextline("000000f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 12 ................"); + ut_assert_nextline("2 matches"); + ut_assert_console_end(); + + ut_asserteq(2, env_get_hex("memmatches", 0)); + ut_asserteq(0xff, env_get_hex("memaddr", 0)); + ut_asserteq(0xfe, env_get_hex("mempos", 0)); + + unmap_sysmem(buf); + + return 0; +} +MEM_TEST(mem_test_ms_b, UT_TESTF_CONSOLE_REC); + +/* Test 'ms' command with 16-bit values */ +static int mem_test_ms_w(struct unit_test_state *uts) +{ + u16 *buf; + + buf = map_sysmem(0, BUF_SIZE + 2); + memset(buf, '\0', BUF_SIZE); + buf[0x34 / 2] = 0x1234; + buf[BUF_SIZE / 2] = 0x1234; + ut_assertok(console_record_reset_enable()); + run_command("ms.w 0 80 1234", 0); + ut_assert_nextline("00000030: 0000 0000 1234 0000 0000 0000 0000 0000 ....4..........."); + ut_assert_nextline("1 match"); + ut_assert_console_end(); + + ut_asserteq(1, env_get_hex("memmatches", 0)); + ut_asserteq(0x34, env_get_hex("memaddr", 0)); + ut_asserteq(0x34 / 2, env_get_hex("mempos", 0)); + + unmap_sysmem(buf); + + return 0; +} +MEM_TEST(mem_test_ms_w, UT_TESTF_CONSOLE_REC); + +/* Test 'ms' command with 32-bit values */ +static int mem_test_ms_l(struct unit_test_state *uts) +{ + u32 *buf; + + buf = map_sysmem(0, BUF_SIZE + 4); + memset(buf, '\0', BUF_SIZE); + buf[0x38 / 4] = 0x12345678; + buf[BUF_SIZE / 4] = 0x12345678; + ut_assertok(console_record_reset_enable()); + run_command("ms 0 40 12345678", 0); + ut_assert_nextline("00000030: 00000000 00000000 12345678 00000000 ........xV4....."); + ut_assert_nextline("1 match"); + ut_assert_console_end(); + + ut_asserteq(1, env_get_hex("memmatches", 0)); + ut_asserteq(0x38, env_get_hex("memaddr", 0)); + ut_asserteq(0x38 / 4, env_get_hex("mempos", 0)); + + ut_assertok(console_record_reset_enable()); + run_command("ms 0 80 12345679", 0); + ut_assert_nextline("0 matches"); + ut_assert_console_end(); + + ut_asserteq(0, env_get_hex("memmatches", 0)); + ut_asserteq(0, env_get_hex("memaddr", 0)); + ut_asserteq(0 / 4, env_get_hex("mempos", 0)); + + unmap_sysmem(buf); + + return 0; +} +MEM_TEST(mem_test_ms_l, UT_TESTF_CONSOLE_REC); + +/* Test 'ms' command with continuation */ +static int mem_test_ms_cont(struct unit_test_state *uts) +{ + char *const args[] = {"ms.b", "0", "100", "34"}; + int repeatable; + u8 *buf; + int i; + + buf = map_sysmem(0, BUF_SIZE); + memset(buf, '\0', BUF_SIZE); + for (i = 5; i < 0x33; i += 3) + buf[i] = 0x34; + ut_assertok(console_record_reset_enable()); + run_command("ms.b 0 100 34", 0); + ut_assert_nextlinen("00000000: 00 00 00 00 00 34 00 00 34 00 00 34 00 00 34 00"); + ut_assert_nextline("--"); + ut_assert_nextlinen("00000010: 00 34 00 00 34 00 00 34 00 00 34 00 00 34 00 00"); + ut_assert_nextline("--"); + ut_assert_nextlinen("00000020: 34 00 00 34 00 00 34 00 00 34 00 00 34 00 00 34"); + ut_assert_nextlinen("10 matches (repeat command to check for more)"); + ut_assert_console_end(); + + ut_asserteq(10, env_get_hex("memmatches", 0)); + ut_asserteq(0x20, env_get_hex("memaddr", 0)); + ut_asserteq(0x20, env_get_hex("mempos", 0)); + + /* + * run_command() ignoes the repeatable flag when using hush, so call + * cmd_process() directly + */ + ut_assertok(console_record_reset_enable()); + cmd_process(CMD_FLAG_REPEAT, 4, args, &repeatable, NULL); + ut_assert_nextlinen("00000020: 34 00 00 34 00 00 34 00 00 34 00 00 34 00 00 34"); + ut_assert_nextline("--"); + ut_assert_nextlinen("00000030: 00 00 34 00 00 00 00 00"); + ut_assert_nextlinen("6 matches"); + ut_assert_console_end(); + + ut_asserteq(6, env_get_hex("memmatches", 0)); + ut_asserteq(0x32, env_get_hex("memaddr", 0)); + + /* 0x32 less 0x21, where the second search started */ + ut_asserteq(0x11, env_get_hex("mempos", 0)); + + unmap_sysmem(buf); + + return 0; +} +MEM_TEST(mem_test_ms_cont, UT_TESTF_CONSOLE_REC); + +/* Test that an 'ms' command with continuation stops at the end of the range */ +static int mem_test_ms_cont_end(struct unit_test_state *uts) +{ + char *const args[] = {"ms.b", "1", "ff", "12"}; + int repeatable; + u8 *buf; + + buf = map_sysmem(0, BUF_SIZE); + memset(buf, '\0', BUF_SIZE); + buf[0x0] = 0x12; + buf[0x31] = 0x12; + buf[0xff] = 0x12; + buf[0x100] = 0x12; + ut_assertok(console_record_reset_enable()); + run_command("ms.b 1 ff 12", 0); + ut_assert_nextlinen("00000030"); + ut_assert_nextlinen("--"); + ut_assert_nextlinen("000000f0"); + ut_assert_nextlinen("2 matches"); + ut_assert_console_end(); + + /* + * run_command() ignoes the repeatable flag when using hush, so call + * cmd_process() directly. + * + * This should produce no matches. + */ + ut_assertok(console_record_reset_enable()); + cmd_process(CMD_FLAG_REPEAT, 4, args, &repeatable, NULL); + ut_assert_nextlinen("0 matches"); + ut_assert_console_end(); + + /* One more time */ + ut_assertok(console_record_reset_enable()); + cmd_process(CMD_FLAG_REPEAT, 4, args, &repeatable, NULL); + ut_assert_nextlinen("0 matches"); + ut_assert_console_end(); + + unmap_sysmem(buf); + + return 0; +} +MEM_TEST(mem_test_ms_cont_end, UT_TESTF_CONSOLE_REC); + +/* Test 'ms' command with multiple values */ +static int mem_test_ms_mult(struct unit_test_state *uts) +{ + static const char str[] = "hello"; + char *buf; + + buf = map_sysmem(0, BUF_SIZE + 5); + memset(buf, '\0', BUF_SIZE); + strcpy(buf + 0x1e, str); + strcpy(buf + 0x63, str); + strcpy(buf + BUF_SIZE - strlen(str) + 1, str); + ut_assertok(console_record_reset_enable()); + run_command("ms.b 0 100 68 65 6c 6c 6f", 0); + ut_assert_nextline("00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 68 65 ..............he"); + ut_assert_nextline("00000020: 6c 6c 6f 00 00 00 00 00 00 00 00 00 00 00 00 00 llo............."); + ut_assert_nextline("--"); + ut_assert_nextline("00000060: 00 00 00 68 65 6c 6c 6f 00 00 00 00 00 00 00 00 ...hello........"); + ut_assert_nextline("2 matches"); + ut_assert_console_end(); + unmap_sysmem(buf); + + ut_asserteq(2, env_get_hex("memmatches", 0)); + ut_asserteq(0x63, env_get_hex("memaddr", 0)); + ut_asserteq(0x63, env_get_hex("mempos", 0)); + + return 0; +} +MEM_TEST(mem_test_ms_mult, UT_TESTF_CONSOLE_REC); + +/* Test 'ms' command with string */ +static int mem_test_ms_s(struct unit_test_state *uts) +{ + static const char str[] = "hello"; + static const char str2[] = "hellothere"; + char *buf; + + buf = map_sysmem(0, BUF_SIZE); + memset(buf, '\0', BUF_SIZE); + strcpy(buf + 0x1e, str); + strcpy(buf + 0x63, str); + strcpy(buf + 0xa1, str2); + ut_assertok(console_record_reset_enable()); + run_command("ms.s 0 100 hello", 0); + ut_assert_nextline("00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 68 65 ..............he"); + ut_assert_nextline("00000020: 6c 6c 6f 00 00 00 00 00 00 00 00 00 00 00 00 00 llo............."); + ut_assert_nextline("--"); + ut_assert_nextline("00000060: 00 00 00 68 65 6c 6c 6f 00 00 00 00 00 00 00 00 ...hello........"); + ut_assert_nextline("--"); + ut_assert_nextline("000000a0: 00 68 65 6c 6c 6f 74 68 65 72 65 00 00 00 00 00 .hellothere....."); + ut_assert_nextline("3 matches"); + ut_assert_console_end(); + + ut_asserteq(3, env_get_hex("memmatches", 0)); + ut_asserteq(0xa1, env_get_hex("memaddr", 0)); + ut_asserteq(0xa1, env_get_hex("mempos", 0)); + + ut_assertok(console_record_reset_enable()); + run_command("ms.s 0 100 hello there", 0); + ut_assert_nextline("000000a0: 00 68 65 6c 6c 6f 74 68 65 72 65 00 00 00 00 00 .hellothere....."); + ut_assert_nextline("1 match"); + ut_assert_console_end(); + + ut_asserteq(1, env_get_hex("memmatches", 0)); + ut_asserteq(0xa1, env_get_hex("memaddr", 0)); + ut_asserteq(0xa1, env_get_hex("mempos", 0)); + + unmap_sysmem(buf); + + return 0; +} +MEM_TEST(mem_test_ms_s, UT_TESTF_CONSOLE_REC); + +/* Test 'ms' command with limit */ +static int mem_test_ms_limit(struct unit_test_state *uts) +{ + u8 *buf; + + buf = map_sysmem(0, BUF_SIZE + 1); + memset(buf, '\0', BUF_SIZE); + buf[0x0] = 0x12; + buf[0x31] = 0x12; + buf[0x62] = 0x12; + buf[0x76] = 0x12; + ut_assertok(console_record_reset_enable()); + run_command("ms.b -l2 1 ff 12", 0); + ut_assert_nextline("00000030: 00 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................"); + ut_assert_nextline("--"); + ut_assert_nextlinen("00000060: 00 00 12 00 00 00 00 00 00 00 00 00 00 00 00 00"); + ut_assert_nextline("2 matches (repeat command to check for more)"); + ut_assert_console_end(); + + ut_asserteq(2, env_get_hex("memmatches", 0)); + ut_asserteq(0x62, env_get_hex("memaddr", 0)); + ut_asserteq(0x61, env_get_hex("mempos", 0)); + + unmap_sysmem(buf); + + return 0; +} +MEM_TEST(mem_test_ms_limit, UT_TESTF_CONSOLE_REC); + +/* Test 'ms' command in quiet mode */ +static int mem_test_ms_quiet(struct unit_test_state *uts) +{ + u8 *buf; + + buf = map_sysmem(0, BUF_SIZE + 1); + memset(buf, '\0', BUF_SIZE); + buf[0x0] = 0x12; + buf[0x31] = 0x12; + buf[0x62] = 0x12; + buf[0x76] = 0x12; + ut_assertok(console_record_reset_enable()); + run_command("ms.b -q -l2 1 ff 12", 0); + ut_assert_console_end(); + unmap_sysmem(buf); + + ut_asserteq(2, env_get_hex("memmatches", 0)); + ut_asserteq(0x62, env_get_hex("memaddr", 0)); + ut_asserteq(0x61, env_get_hex("mempos", 0)); + + return 0; +} +MEM_TEST(mem_test_ms_quiet, UT_TESTF_CONSOLE_REC); diff --git a/test/cmd_ut.c b/test/cmd_ut.c index 1963f3792c..8f0bc688a2 100644 --- a/test/cmd_ut.c +++ b/test/cmd_ut.c @@ -74,6 +74,7 @@ static struct cmd_tbl cmd_ut_sub[] = { #ifdef CONFIG_UT_LOG U_BOOT_CMD_MKENT(log, CONFIG_SYS_MAXARGS, 1, do_ut_log, "", ""), #endif + U_BOOT_CMD_MKENT(mem, CONFIG_SYS_MAXARGS, 1, do_ut_mem, "", ""), #ifdef CONFIG_UT_TIME U_BOOT_CMD_MKENT(time, CONFIG_SYS_MAXARGS, 1, do_ut_time, "", ""), #endif @@ -145,6 +146,7 @@ static char ut_help_text[] = #ifdef CONFIG_UT_LOG "ut log [test-name] - test logging functions\n" #endif + "ut mem [test-name] - test memory-related commands\n" #ifdef CONFIG_UT_OPTEE "ut optee [test-name]\n" #endif