summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2025-11-22 08:44:38 -0600
committerTom Rini <[email protected]>2025-11-22 08:44:38 -0600
commit74c68b54977447e97b98b12c3ca7fe2a7f4a3803 (patch)
tree949504975745ed37bc3d60535b9ce17fb984c2d8 /test
parent2bc0715b558fa1ac5c88b11e250740b16a905837 (diff)
parentfff78d3bb25dc0c4b20b4ab9908cb355f5808178 (diff)
Merge tag 'efi-2026-01-rc3-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request efi-2026-01-rc3-2 CIL https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/28454 Documentation: * board: ti: am6254atl_sk: correct value of PRELOADED_BL33_BASE * pytest: fix u-boot-test-flash typo * samsung: Fix PXE description for the E850-96 board * board: ti: k3: Update TI firmware repository URL to GitHub * add missing macro descriptions to include/test/ut.h and add it to the API documenation * rearrange the description of DM tests and describe return values Testing: * Enable CI testing ACPI on qemu-riscv64_smode_acpi_defconfig * Add qemu-riscv64_smode_defconfig to the CI tests * Generalize tests such that they can run on RISC-V QEMU - fdt_test_apply requires CONFIG_OF_LIBFDT_OVERLAY - cmd/fdt: do not assume RNG device exists - cmd/bdinfo: make no flash assumption - cmd/bdinfo: consider arch_print_bdinfo() output - common/print: do not use fixed buffer addresses - cmd/fdt: do not use fixed buffer addresses - raise CONFIG_CONSOLE_RECORD_OUT_SIZE default to 0x6000 * enable CONFIG_CONSOLE_RECORD=y on qemu-riscv64_smode_acpi # -----BEGIN PGP SIGNATURE----- # # iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAmkg1IsACgkQxIHbvCwF # GsQVLA//dmiApob+J9FUhD8joD+DaKSNfLYmv8zwfIFL2xRxx7D+CQT+r+I9FJYI # KojiLyn4PE/5VOm+wrsvAoYoMLJwAHvg5nmYJLLzvm6V//DLd1AEopP/+Uh8gEVW # xYGLcvDyGgZpraAhcmqRnAS89py3SigwGzhcUMbT6ZC6pgMVEsBpg8XeMpY7N05c # rwyqFAAPD8RcF7veQCpry87NiK5o+9YuM1zKl5sDFOpEWKq5ToNwhQ00bnux9lUd # HWz9X6ge58iFiMXRqUCnOaPeXeChn9ejyEiKtfQ0JtykOf9NT2WMdD2VKe9PCYsd # f7OynJTGG2OXTKBhon/xj75itiTm7EELc/FHwHEdtZIIHgpi/C33yQgKxLf9mtUo # Z7DKYpPoaTCbJhs9LCK942KPtshbtAJLKTVqyBPo7Jn0mneeCQUsbaQRU7JruJTK # hKluUjsAry3Do3wv/w6B8R6MMgfpBktPkqjg9e/maSdhYdkNAYpjajtORgpqmJRV # HTGJXfL3qFC50jlenlMYOm4Qake33MIMzubaxoM3j5ENDUJ7KAbWADEoWDpve8Tu # b/fX8uuW+g2T18Y/M9Bsk/jaUjDTx0xtZUSYNIIQJFDaJMzUxGYWlmtXhLZwFU8g # 7S5pBmgxoSAtQSMAeoJPJp9FSgXYqiGLUeSwcOH2NaPn0lLFvK0= # =D0Yy # -----END PGP SIGNATURE----- # gpg: Signature made Fri 21 Nov 2025 03:07:23 PM CST # gpg: using RSA key 6DC4F9C71F29A6FA06B76D33C481DBBC2C051AC4 # gpg: Good signature from "Heinrich Schuchardt <[email protected]>" [unknown] # gpg: aka "[jpeg image of size 1389]" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 6DC4 F9C7 1F29 A6FA 06B7 6D33 C481 DBBC 2C05 1AC4
Diffstat (limited to 'test')
-rw-r--r--test/cmd/bdinfo.c15
-rw-r--r--test/cmd/fdt.c31
-rw-r--r--test/common/print.c71
3 files changed, 71 insertions, 46 deletions
diff --git a/test/cmd/bdinfo.c b/test/cmd/bdinfo.c
index 09f44ee41ed..28d448a0866 100644
--- a/test/cmd/bdinfo.c
+++ b/test/cmd/bdinfo.c
@@ -161,9 +161,9 @@ static int bdinfo_test_all(struct unit_test_state *uts)
ut_assertok(bdinfo_check_mem(uts));
/* CONFIG_SYS_HAS_SRAM testing not supported */
- ut_assertok(test_num_l(uts, "flashstart", 0));
- ut_assertok(test_num_l(uts, "flashsize", 0));
- ut_assertok(test_num_l(uts, "flashoffset", 0));
+ ut_check_console_linen(uts, "flashstart");
+ ut_check_console_linen(uts, "flashsize");
+ ut_check_console_linen(uts, "flashoffset");
ut_assert_nextline("baudrate = %lu bps",
env_get_ulong("baudrate", 10, 1234));
ut_assertok(test_num_l(uts, "relocaddr", gd->relocaddr));
@@ -215,8 +215,15 @@ static int bdinfo_test_all(struct unit_test_state *uts)
ut_assertok(test_num_l(uts, "malloc base", gd_malloc_start()));
}
+ /* Check arch_print_bdinfo() output */
if (IS_ENABLED(CONFIG_X86))
- ut_check_skip_to_linen(uts, " high end =");
+ ut_check_skip_to_linen(uts, "tsc");
+
+#ifdef CONFIG_RISCV
+ ut_check_console_linen(uts, "boot hart");
+ if (gd->arch.firmware_fdt_addr)
+ ut_check_console_linen(uts, "firmware fdt");
+#endif
return 0;
}
diff --git a/test/cmd/fdt.c b/test/cmd/fdt.c
index 96a8488e172..4c3c6308ab4 100644
--- a/test/cmd/fdt.c
+++ b/test/cmd/fdt.c
@@ -10,6 +10,7 @@
#include <fdt_support.h>
#include <mapmem.h>
#include <asm/global_data.h>
+#include <dm/uclass.h>
#include <linux/libfdt.h>
#include <test/ut.h>
@@ -264,7 +265,7 @@ FDT_TEST(fdt_test_addr_resize, UTF_CONSOLE);
static int fdt_test_move(struct unit_test_state *uts)
{
char fdt[256];
- ulong addr, newaddr = 0x10000;
+ ulong addr, newaddr;
const int size = sizeof(fdt);
uint32_t ts;
void *buf;
@@ -274,8 +275,10 @@ static int fdt_test_move(struct unit_test_state *uts)
ts = fdt_totalsize(fdt);
/* Moved target DT location */
- buf = map_sysmem(newaddr, size);
+ buf = memalign(8, size);
+ ut_assertnonnull(buf);
memset(buf, 0, size);
+ newaddr = map_to_sysmem(buf);
/* Test moving the working FDT to a new location */
ut_assertok(run_commandf("fdt move %08lx %08lx %x", addr, newaddr, ts));
@@ -287,6 +290,8 @@ static int fdt_test_move(struct unit_test_state *uts)
ut_assert_nextline("Total of %d byte(s) were the same", ts);
ut_assert_console_end();
+ free(buf);
+
return 0;
}
FDT_TEST(fdt_test_move, UTF_CONSOLE);
@@ -1267,6 +1272,7 @@ static int fdt_test_chosen(struct unit_test_state *uts)
{
const char *env_bootargs = env_get("bootargs");
char fdt[8192];
+ struct udevice *dev;
ulong addr;
ut_assertok(make_test_fdt(uts, fdt, sizeof(fdt), &addr));
@@ -1280,11 +1286,16 @@ static int fdt_test_chosen(struct unit_test_state *uts)
/* Test add new chosen node without initrd */
ut_assertok(run_commandf("fdt chosen"));
ut_assertok(run_commandf("fdt print /chosen"));
- ut_assert_nextline("chosen {");
+ ut_assert(0 < console_record_readline(uts->actual_str,
+ sizeof(uts->actual_str)));
+ if (!strcmp("No RNG device", uts->actual_str))
+ ut_assert(0 < console_record_readline(uts->actual_str,
+ sizeof(uts->actual_str)));
+ ut_asserteq_str("chosen {", uts->actual_str);
ut_assert_nextlinen("\tu-boot,version = "); /* Ignore the version string */
if (env_bootargs)
ut_assert_nextline("\tbootargs = \"%s\";", env_bootargs);
- if (IS_ENABLED(CONFIG_DM_RNG) &&
+ if (!uclass_get_device(UCLASS_RNG, 0, &dev) &&
!IS_ENABLED(CONFIG_MEASURED_BOOT) &&
!IS_ENABLED(CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT))
ut_assert_nextlinen("\tkaslr-seed = ");
@@ -1294,7 +1305,12 @@ static int fdt_test_chosen(struct unit_test_state *uts)
/* Test add new chosen node with initrd */
ut_assertok(run_commandf("fdt chosen 0x1234 0x5678"));
ut_assertok(run_commandf("fdt print /chosen"));
- ut_assert_nextline("chosen {");
+ ut_assert(0 < console_record_readline(uts->actual_str,
+ sizeof(uts->actual_str)));
+ if (!strcmp("No RNG device", uts->actual_str))
+ ut_assert(0 < console_record_readline(uts->actual_str,
+ sizeof(uts->actual_str)));
+ ut_asserteq_str("chosen {", uts->actual_str);
ut_assert_nextline("\tlinux,initrd-end = <0x%08x 0x%08x>;",
upper_32_bits(0x1234 + 0x5678 - 1),
lower_32_bits(0x1234 + 0x5678 - 1));
@@ -1303,7 +1319,7 @@ static int fdt_test_chosen(struct unit_test_state *uts)
ut_assert_nextlinen("\tu-boot,version = "); /* Ignore the version string */
if (env_bootargs)
ut_assert_nextline("\tbootargs = \"%s\";", env_bootargs);
- if (IS_ENABLED(CONFIG_DM_RNG) &&
+ if (!uclass_get_device(UCLASS_RNG, 0, &dev) &&
!IS_ENABLED(CONFIG_MEASURED_BOOT) &&
!IS_ENABLED(CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT))
ut_assert_nextlinen("\tkaslr-seed = ");
@@ -1319,6 +1335,9 @@ static int fdt_test_apply(struct unit_test_state *uts)
char fdt[8192], fdto[8192];
ulong addr, addro;
+ if (!IS_ENABLED(CONFIG_OF_LIBFDT_OVERLAY))
+ return -EAGAIN;
+
/* Create base DT with __symbols__ node */
ut_assertok(fdt_create(fdt, sizeof(fdt)));
ut_assertok(fdt_finish_reservemap(fdt));
diff --git a/test/common/print.c b/test/common/print.c
index 76ee851fe6a..f33476a36b4 100644
--- a/test/common/print.c
+++ b/test/common/print.c
@@ -168,12 +168,8 @@ static int print_display_buffer(struct unit_test_state *uts)
u8 *buf;
int i;
- /* This test requires writable memory at zero */
- if (IS_ENABLED(CONFIG_X86))
- return -EAGAIN;
-
- buf = map_sysmem(0, BUF_SIZE);
- memset(buf, '\0', BUF_SIZE);
+ buf = calloc(1, BUF_SIZE);
+ ut_assertnonnull(buf);
for (i = 0; i < 0x11; i++)
buf[i] = i * 0x11;
@@ -232,7 +228,7 @@ static int print_display_buffer(struct unit_test_state *uts)
ut_assert_nextline("00000000: 00 1f 20 21 7e 7f 80 81 ff 99 .. !~.....");
ut_assert_console_end();
- unmap_sysmem(buf);
+ free(buf);
return 0;
}
@@ -244,13 +240,14 @@ static int print_hexdump_line(struct unit_test_state *uts)
u8 *buf;
int i;
- buf = map_sysmem(0, BUF_SIZE);
- memset(buf, '\0', BUF_SIZE);
+ buf = calloc(1, BUF_SIZE);
+ ut_assertnonnull(buf);
for (i = 0; i < 0x11; i++)
buf[i] = i * 0x11;
/* Check buffer size calculations */
- linebuf = map_sysmem(0x400, BUF_SIZE);
+ linebuf = calloc(1, BUF_SIZE);
+ ut_assertnonnull(buf);
memset(linebuf, '\xff', BUF_SIZE);
ut_asserteq(-ENOSPC, hexdump_line(0, buf, 1, 0x10, 0, linebuf, 75));
ut_asserteq(0xff, linebuf[0]);
@@ -258,7 +255,8 @@ static int print_hexdump_line(struct unit_test_state *uts)
ut_asserteq('\0', linebuf[75]);
ut_asserteq(0xff, linebuf[76]);
- unmap_sysmem(buf);
+ free(linebuf);
+ free(buf);
return 0;
}
@@ -268,70 +266,71 @@ static int print_do_hex_dump(struct unit_test_state *uts)
{
u8 *buf;
int i;
+ ulong addr;
- /* This test requires writable memory at zero */
- if (IS_ENABLED(CONFIG_X86))
- return -EAGAIN;
-
- buf = map_sysmem(0, BUF_SIZE);
- memset(buf, '\0', BUF_SIZE);
+ buf = calloc(1, BUF_SIZE);
+ ut_assertnonnull(buf);
+ addr = map_to_sysmem(buf);
for (i = 0; i < 0x11; i++)
buf[i] = i * 0x11;
/* bytes */
print_hex_dump_bytes("", DUMP_PREFIX_ADDRESS, buf, 0x12);
ut_assert_nextline("%0*lx: 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff ..\"3DUfw........",
- IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x0UL);
+ IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, addr);
ut_assert_nextline("%0*lx: 10 00 ..",
- IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x10UL);
+ IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8,
+ addr + 0x10UL);
ut_assert_console_end();
/* line length */
print_hex_dump("", DUMP_PREFIX_ADDRESS, 8, 1, buf, 0x12, true);
ut_assert_nextline("%0*lx: 00 11 22 33 44 55 66 77 ..\"3DUfw",
- IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x0UL);
+ IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, addr);
ut_assert_nextline("%0*lx: 88 99 aa bb cc dd ee ff ........",
- IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x8UL);
+ IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8,
+ addr + 0x8UL);
ut_assert_nextline("%0*lx: 10 00 ..",
- IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x10UL);
+ IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8,
+ addr + 0x10UL);
ut_assert_console_end();
- unmap_sysmem(buf);
/* long line */
buf[0x41] = 0x41;
print_hex_dump("", DUMP_PREFIX_ADDRESS, 0x40, 1, buf, 0x42, true);
ut_assert_nextline("%0*lx: 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ..\"3DUfw........................................................",
- IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x0UL);
+ IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, addr);
ut_assert_nextline("%0*lx: 00 41 .A",
- IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x40UL);
+ IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8,
+ addr + 0x40UL);
ut_assert_console_end();
/* 16-bit */
print_hex_dump("", DUMP_PREFIX_ADDRESS, 0, 2, buf, 0x12, true);
ut_assert_nextline("%0*lx: 1100 3322 5544 7766 9988 bbaa ddcc ffee ..\"3DUfw........",
- IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x0UL);
+ IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, addr);
ut_assert_nextline("%0*lx: 0010 ..",
- IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x10UL);
+ IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8,
+ addr + 0x10UL);
ut_assert_console_end();
- unmap_sysmem(buf);
/* 32-bit */
print_hex_dump("", DUMP_PREFIX_ADDRESS, 0, 4, buf, 0x14, true);
ut_assert_nextline("%0*lx: 33221100 77665544 bbaa9988 ffeeddcc ..\"3DUfw........",
- IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x0UL);
+ IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, addr);
ut_assert_nextline("%0*lx: 00000010 ....",
- IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x10UL);
+ IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8,
+ addr + 0x10UL);
ut_assert_console_end();
- unmap_sysmem(buf);
/* 64-bit */
print_hex_dump("", DUMP_PREFIX_ADDRESS, 16, 8, buf, 0x18, true);
ut_assert_nextline("%0*lx: 7766554433221100 ffeeddccbbaa9988 ..\"3DUfw........",
- IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x0UL);
+ IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, addr);
ut_assert_nextline("%0*lx: 0000000000000010 ........",
- IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x10UL);
+ IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8,
+ addr + 0x10UL);
ut_assert_console_end();
- unmap_sysmem(buf);
/* ASCII */
buf[1] = 31;
@@ -342,9 +341,9 @@ static int print_do_hex_dump(struct unit_test_state *uts)
buf[8] = 255;
print_hex_dump("", DUMP_PREFIX_ADDRESS, 0, 1, buf, 10, true);
ut_assert_nextline("%0*lx: 00 1f 20 21 7e 7f 80 81 ff 99 .. !~.....",
- IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, 0x0UL);
+ IS_ENABLED(CONFIG_PHYS_64BIT) ? 16 : 8, addr);
ut_assert_console_end();
- unmap_sysmem(buf);
+ free(buf);
return 0;
}