summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/bloblist.c28
-rw-r--r--test/boot/bootdev.c2
-rw-r--r--test/boot/bootflow.c7
-rw-r--r--test/boot/cedit.c22
-rw-r--r--test/boot/expo.c26
-rw-r--r--test/boot/files/expo_ids.h3
-rw-r--r--test/boot/files/expo_layout.dts5
-rw-r--r--test/bootm.c21
-rw-r--r--test/cmd/Makefile13
-rw-r--r--test/cmd/coreboot.c119
-rw-r--r--test/cmd/cpuid.c22
-rw-r--r--test/cmd/font.c21
-rw-r--r--test/cmd/mem_copy.c2
-rw-r--r--test/cmd/meminfo.c42
-rw-r--r--test/cmd/msr.c38
-rw-r--r--test/dm/Makefile2
-rw-r--r--test/dm/acpi.c43
-rw-r--r--test/dm/core.c22
-rw-r--r--test/dm/irq.c15
-rw-r--r--test/dm/wdt.c14
-rw-r--r--test/hush/Makefile2
-rw-r--r--test/lib/alist.c253
-rw-r--r--test/lib/lmb.c10
-rw-r--r--test/py/tests/test_android/test_ab.py31
-rw-r--r--test/py/tests/test_efi_loader.py2
-rw-r--r--test/py/tests/test_eficonfig/test_eficonfig.py6
-rw-r--r--test/py/tests/test_env.py2
-rw-r--r--test/py/tests/test_event_dump.py1
-rw-r--r--test/py/tests/test_fs/test_basic.py5
-rw-r--r--test/py/tests/test_spi.py12
-rw-r--r--test/py/tests/test_usb.py171
-rw-r--r--test/py/tests/test_ut.py2
-rw-r--r--test/test-main.c31
33 files changed, 833 insertions, 162 deletions
diff --git a/test/bloblist.c b/test/bloblist.c
index fd85c7ab79e..e0ad94e77d8 100644
--- a/test/bloblist.c
+++ b/test/bloblist.c
@@ -94,7 +94,7 @@ static int bloblist_test_init(struct unit_test_state *uts)
return 1;
}
-BLOBLIST_TEST(bloblist_test_init, 0);
+BLOBLIST_TEST(bloblist_test_init, UFT_BLOBLIST);
static int bloblist_test_blob(struct unit_test_state *uts)
{
@@ -134,7 +134,7 @@ static int bloblist_test_blob(struct unit_test_state *uts)
return 0;
}
-BLOBLIST_TEST(bloblist_test_blob, 0);
+BLOBLIST_TEST(bloblist_test_blob, UFT_BLOBLIST);
/* Check bloblist_ensure_size_ret() */
static int bloblist_test_blob_ensure(struct unit_test_state *uts)
@@ -168,7 +168,7 @@ static int bloblist_test_blob_ensure(struct unit_test_state *uts)
return 0;
}
-BLOBLIST_TEST(bloblist_test_blob_ensure, 0);
+BLOBLIST_TEST(bloblist_test_blob_ensure, UFT_BLOBLIST);
static int bloblist_test_bad_blob(struct unit_test_state *uts)
{
@@ -184,7 +184,7 @@ static int bloblist_test_bad_blob(struct unit_test_state *uts)
return 0;
}
-BLOBLIST_TEST(bloblist_test_bad_blob, 0);
+BLOBLIST_TEST(bloblist_test_bad_blob, UFT_BLOBLIST);
static int bloblist_test_checksum(struct unit_test_state *uts)
{
@@ -257,7 +257,7 @@ static int bloblist_test_checksum(struct unit_test_state *uts)
return 0;
}
-BLOBLIST_TEST(bloblist_test_checksum, 0);
+BLOBLIST_TEST(bloblist_test_checksum, UFT_BLOBLIST);
/* Test the 'bloblist info' command */
static int bloblist_test_cmd_info(struct unit_test_state *uts)
@@ -278,7 +278,7 @@ static int bloblist_test_cmd_info(struct unit_test_state *uts)
return 0;
}
-BLOBLIST_TEST(bloblist_test_cmd_info, UTF_CONSOLE);
+BLOBLIST_TEST(bloblist_test_cmd_info, UFT_BLOBLIST | UTF_CONSOLE);
/* Test the 'bloblist list' command */
static int bloblist_test_cmd_list(struct unit_test_state *uts)
@@ -300,7 +300,7 @@ static int bloblist_test_cmd_list(struct unit_test_state *uts)
return 0;
}
-BLOBLIST_TEST(bloblist_test_cmd_list, UTF_CONSOLE);
+BLOBLIST_TEST(bloblist_test_cmd_list, UFT_BLOBLIST | UTF_CONSOLE);
/* Test alignment of bloblist blobs */
static int bloblist_test_align(struct unit_test_state *uts)
@@ -358,7 +358,7 @@ static int bloblist_test_align(struct unit_test_state *uts)
return 0;
}
-BLOBLIST_TEST(bloblist_test_align, 0);
+BLOBLIST_TEST(bloblist_test_align, UFT_BLOBLIST);
/* Test relocation of a bloblist */
static int bloblist_test_reloc(struct unit_test_state *uts)
@@ -392,7 +392,7 @@ static int bloblist_test_reloc(struct unit_test_state *uts)
return 0;
}
-BLOBLIST_TEST(bloblist_test_reloc, 0);
+BLOBLIST_TEST(bloblist_test_reloc, UFT_BLOBLIST);
/* Test expansion of a blob */
static int bloblist_test_grow(struct unit_test_state *uts)
@@ -445,7 +445,7 @@ static int bloblist_test_grow(struct unit_test_state *uts)
return 0;
}
-BLOBLIST_TEST(bloblist_test_grow, 0);
+BLOBLIST_TEST(bloblist_test_grow, UFT_BLOBLIST);
/* Test shrinking of a blob */
static int bloblist_test_shrink(struct unit_test_state *uts)
@@ -495,7 +495,7 @@ static int bloblist_test_shrink(struct unit_test_state *uts)
return 0;
}
-BLOBLIST_TEST(bloblist_test_shrink, 0);
+BLOBLIST_TEST(bloblist_test_shrink, UFT_BLOBLIST);
/* Test failing to adjust a blob size */
static int bloblist_test_resize_fail(struct unit_test_state *uts)
@@ -530,7 +530,7 @@ static int bloblist_test_resize_fail(struct unit_test_state *uts)
return 0;
}
-BLOBLIST_TEST(bloblist_test_resize_fail, 0);
+BLOBLIST_TEST(bloblist_test_resize_fail, UFT_BLOBLIST);
/* Test expanding the last blob in a bloblist */
static int bloblist_test_resize_last(struct unit_test_state *uts)
@@ -581,7 +581,7 @@ static int bloblist_test_resize_last(struct unit_test_state *uts)
return 0;
}
-BLOBLIST_TEST(bloblist_test_resize_last, 0);
+BLOBLIST_TEST(bloblist_test_resize_last, UFT_BLOBLIST);
/* Check a completely full bloblist */
static int bloblist_test_blob_maxsize(struct unit_test_state *uts)
@@ -604,7 +604,7 @@ static int bloblist_test_blob_maxsize(struct unit_test_state *uts)
return 0;
}
-BLOBLIST_TEST(bloblist_test_blob_maxsize, 0);
+BLOBLIST_TEST(bloblist_test_blob_maxsize, UFT_BLOBLIST);
int do_ut_bloblist(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c
index 369105ca4cf..369c611d924 100644
--- a/test/boot/bootdev.c
+++ b/test/boot/bootdev.c
@@ -630,7 +630,7 @@ static int bootdev_test_next_label(struct unit_test_state *uts)
ut_assertok(bootdev_next_label(&iter, &dev, &mflags));
ut_assert_nextline("scanning bus for devices...");
ut_assert_skip_to_line(
- " Capacity: 1.9 MB = 0.0 GB (4095 x 512)");
+ " Capacity: 2.0 MB = 0.0 GB (4096 x 512)");
ut_assert_console_end();
ut_assertnonnull(dev);
ut_asserteq_str("scsi.id0lun0.bootdev", dev->name);
diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c
index 154dea70a59..2f859c40adb 100644
--- a/test/boot/bootflow.c
+++ b/test/boot/bootflow.c
@@ -370,7 +370,7 @@ static int bootflow_iter(struct unit_test_state *uts)
return 0;
}
-BOOTSTD_TEST(bootflow_iter, UTF_DM | UTF_SCAN_FDT);
+BOOTSTD_TEST(bootflow_iter, UTF_DM | UTF_SCAN_FDT | UTF_CONSOLE);
#if defined(CONFIG_SANDBOX) && defined(CONFIG_BOOTMETH_GLOBAL)
/* Check using the system bootdev */
@@ -542,7 +542,7 @@ static int prep_mmc_bootdev(struct unit_test_state *uts, const char *mmc_dev,
/* Enable the script bootmeth too */
ut_assertok(uclass_first_device_err(UCLASS_BOOTSTD, &bootstd));
ut_assertok(device_bind(bootstd, DM_DRIVER_REF(bootmeth_2script),
- "bootmeth_script", 0, ofnode_null(), &dev));
+ "script", 0, ofnode_null(), &dev));
/* Enable the cros bootmeth if needed */
if (IS_ENABLED(CONFIG_BOOTMETH_CROS) && bind_cros_android) {
@@ -857,6 +857,9 @@ static int bootflow_menu_theme(struct unit_test_state *uts)
ofnode node;
int i;
+ if (!CONFIG_IS_ENABLED(BOOTSTD_MENU))
+ return -EAGAIN;
+
ut_assertok(scan_mmc4_bootdev(uts));
ut_assertok(bootflow_menu_new(&exp));
diff --git a/test/boot/cedit.c b/test/boot/cedit.c
index 1f7af8e5d79..4d1b99bc2ea 100644
--- a/test/boot/cedit.c
+++ b/test/boot/cedit.c
@@ -31,9 +31,11 @@ static int cedit_base(struct unit_test_state *uts)
* ^N Move down to second item
* ^M Select item
* \e Quit
+ *
+ * cedit_run() returns -EACCESS so this command returns CMD_RET_FAILURE
*/
console_in_puts("\x0e\x0d\x0e\x0d\e");
- ut_assertok(run_command("cedit run", 0));
+ ut_asserteq(1, run_command("cedit run", 0));
exp = cur_exp;
scn = expo_lookup_scene_id(exp, exp->scene_id);
@@ -94,14 +96,16 @@ static int cedit_fdt(struct unit_test_state *uts)
ut_asserteq(ID_CPU_SPEED_2,
ofnode_read_u32_default(node, "cpu-speed", 0));
+ ut_asserteq(3,
+ ofnode_read_u32_default(node, "cpu-speed-value", 0));
ut_asserteq_str("2.5 GHz", ofnode_read_string(node, "cpu-speed-str"));
ut_asserteq_str("my-machine", ofnode_read_string(node, "machine-name"));
- /* There should only be 5 properties */
+ /* There should only be 7 properties */
for (i = 0, ofnode_first_property(node, &prop); ofprop_valid(&prop);
i++, ofnode_next_property(&prop))
;
- ut_asserteq(5, i);
+ ut_asserteq(7, i);
ut_assert_console_end();
@@ -147,14 +151,16 @@ static int cedit_env(struct unit_test_state *uts)
strcpy(str, "my-machine");
ut_assertok(run_command("cedit write_env -v", 0));
- ut_assert_nextlinen("c.cpu-speed=7");
+ ut_assert_nextlinen("c.cpu-speed=11");
ut_assert_nextlinen("c.cpu-speed-str=2.5 GHz");
- ut_assert_nextlinen("c.power-loss=10");
+ ut_assert_nextlinen("c.cpu-speed-value=3");
+ ut_assert_nextlinen("c.power-loss=14");
ut_assert_nextlinen("c.power-loss-str=Always Off");
+ ut_assert_nextlinen("c.power-loss-value=0");
ut_assert_nextlinen("c.machine-name=my-machine");
ut_assert_console_end();
- ut_asserteq(7, env_get_ulong("c.cpu-speed", 10, 0));
+ ut_asserteq(11, env_get_ulong("c.cpu-speed", 10, 0));
ut_asserteq_str("2.5 GHz", env_get("c.cpu-speed-str"));
ut_asserteq_str("my-machine", env_get("c.machine-name"));
@@ -163,8 +169,8 @@ static int cedit_env(struct unit_test_state *uts)
*str = '\0';
ut_assertok(run_command("cedit read_env -v", 0));
- ut_assert_nextlinen("c.cpu-speed=7");
- ut_assert_nextlinen("c.power-loss=10");
+ ut_assert_nextlinen("c.cpu-speed=11");
+ ut_assert_nextlinen("c.power-loss=14");
ut_assert_nextlinen("c.machine-name=my-machine");
ut_assert_console_end();
diff --git a/test/boot/expo.c b/test/boot/expo.c
index 9b4aa803eb1..db14ff86f8b 100644
--- a/test/boot/expo.c
+++ b/test/boot/expo.c
@@ -91,7 +91,7 @@ static int expo_base(struct unit_test_state *uts)
*name = '\0';
ut_assertnonnull(exp);
ut_asserteq(0, exp->scene_id);
- ut_asserteq(0, exp->next_id);
+ ut_asserteq(EXPOID_BASE_ID, exp->next_id);
/* Make sure the name was allocated */
ut_assertnonnull(exp->name);
@@ -130,7 +130,7 @@ static int expo_scene(struct unit_test_state *uts)
ut_assertok(expo_new(EXPO_NAME, NULL, &exp));
scn = NULL;
- ut_asserteq(0, exp->next_id);
+ ut_asserteq(EXPOID_BASE_ID, exp->next_id);
strcpy(name, SCENE_NAME1);
id = scene_new(exp, name, SCENE1, &scn);
*name = '\0';
@@ -151,7 +151,7 @@ static int expo_scene(struct unit_test_state *uts)
scn = NULL;
id = scene_new(exp, SCENE_NAME2, 0, &scn);
ut_assertnonnull(scn);
- ut_assertok(scene_title_set(scn, title_id));
+ scn->title_id = title_id;
ut_asserteq(STR_SCENE_TITLE + 1, id);
ut_asserteq(STR_SCENE_TITLE + 2, exp->next_id);
ut_asserteq_ptr(exp, scn->expo);
@@ -167,6 +167,25 @@ static int expo_scene(struct unit_test_state *uts)
}
BOOTSTD_TEST(expo_scene, UTF_DM | UTF_SCAN_FDT);
+/* Check creating a scene with no ID */
+static int expo_scene_no_id(struct unit_test_state *uts)
+{
+ struct scene *scn;
+ struct expo *exp;
+ char name[100];
+ int id;
+
+ ut_assertok(expo_new(EXPO_NAME, NULL, &exp));
+ ut_asserteq(EXPOID_BASE_ID, exp->next_id);
+
+ strcpy(name, SCENE_NAME1);
+ id = scene_new(exp, SCENE_NAME1, 0, &scn);
+ ut_asserteq(EXPOID_BASE_ID, scn->id);
+
+ return 0;
+}
+BOOTSTD_TEST(expo_scene_no_id, UTF_DM | UTF_SCAN_FDT);
+
/* Check creating a scene with objects */
static int expo_object(struct unit_test_state *uts)
{
@@ -698,6 +717,7 @@ static int expo_test_build(struct unit_test_state *uts)
ut_asserteq(0, item->desc_id);
ut_asserteq(0, item->preview_id);
ut_asserteq(0, item->flags);
+ ut_asserteq(0, item->value);
txt = scene_obj_find(scn, item->label_id, SCENEOBJT_NONE);
ut_asserteq_str("2 GHz", expo_get_str(exp, txt->str_id));
diff --git a/test/boot/files/expo_ids.h b/test/boot/files/expo_ids.h
index a86e0d06f6b..ffb511364b1 100644
--- a/test/boot/files/expo_ids.h
+++ b/test/boot/files/expo_ids.h
@@ -4,8 +4,7 @@
*/
enum {
- ZERO,
- ID_PROMPT,
+ ID_PROMPT = EXPOID_BASE_ID,
ID_SCENE1,
ID_SCENE1_TITLE,
diff --git a/test/boot/files/expo_layout.dts b/test/boot/files/expo_layout.dts
index bed552288f4..9bc1e4950b9 100644
--- a/test/boot/files/expo_layout.dts
+++ b/test/boot/files/expo_layout.dts
@@ -39,8 +39,11 @@
item-id = <ID_CPU_SPEED_1 ID_CPU_SPEED_2
ID_CPU_SPEED_3>;
+ /* values for the menu items */
+ item-value = <0 3 6>;
+
start-bit = <0x400>;
- bit-length = <2>;
+ bit-length = <3>;
};
power-loss {
diff --git a/test/bootm.c b/test/bootm.c
index 26c15552bf6..52b83f149cb 100644
--- a/test/bootm.c
+++ b/test/bootm.c
@@ -26,12 +26,15 @@ static int bootm_test_nop(struct unit_test_state *uts)
{
char buf[BUF_SIZE];
+ /* This tests relies on GD_FLG_SILENT not being set */
+ gd->flags &= ~GD_FLG_SILENT;
+
*buf = '\0';
- ut_assertok(bootm_process_cmdline(buf, BUF_SIZE, true));
+ ut_assertok(bootm_process_cmdline(buf, BUF_SIZE, BOOTM_CL_ALL));
ut_asserteq_str("", buf);
strcpy(buf, "test");
- ut_assertok(bootm_process_cmdline(buf, BUF_SIZE, true));
+ ut_assertok(bootm_process_cmdline(buf, BUF_SIZE, BOOTM_CL_ALL));
ut_asserteq_str("test", buf);
return 0;
@@ -43,23 +46,26 @@ static int bootm_test_nospace(struct unit_test_state *uts)
{
char buf[BUF_SIZE];
+ /* This tests relies on GD_FLG_SILENT not being set */
+ gd->flags &= ~GD_FLG_SILENT;
+
/* Zero buffer size */
*buf = '\0';
- ut_asserteq(-ENOSPC, bootm_process_cmdline(buf, 0, true));
+ ut_asserteq(-ENOSPC, bootm_process_cmdline(buf, 0, BOOTM_CL_ALL));
/* Buffer string not terminated */
memset(buf, 'a', BUF_SIZE);
- ut_asserteq(-ENOSPC, bootm_process_cmdline(buf, BUF_SIZE, true));
+ ut_asserteq(-ENOSPC, bootm_process_cmdline(buf, BUF_SIZE, BOOTM_CL_ALL));
/* Not enough space to copy string */
memset(buf, '\0', BUF_SIZE);
memset(buf, 'a', BUF_SIZE / 2);
- ut_asserteq(-ENOSPC, bootm_process_cmdline(buf, BUF_SIZE, true));
+ ut_asserteq(-ENOSPC, bootm_process_cmdline(buf, BUF_SIZE, BOOTM_CL_ALL));
/* Just enough space */
memset(buf, '\0', BUF_SIZE);
memset(buf, 'a', BUF_SIZE / 2 - 1);
- ut_assertok(bootm_process_cmdline(buf, BUF_SIZE, true));
+ ut_assertok(bootm_process_cmdline(buf, BUF_SIZE, BOOTM_CL_ALL));
return 0;
}
@@ -70,6 +76,9 @@ static int bootm_test_silent(struct unit_test_state *uts)
{
char buf[BUF_SIZE];
+ /* This tests relies on GD_FLG_SILENT not being set */
+ gd->flags &= ~GD_FLG_SILENT;
+
/* 'silent_linux' not set should do nothing */
env_set("silent_linux", NULL);
strcpy(buf, CONSOLE_STR);
diff --git a/test/cmd/Makefile b/test/cmd/Makefile
index 8f2134998ad..0055330dbec 100644
--- a/test/cmd/Makefile
+++ b/test/cmd/Makefile
@@ -12,25 +12,30 @@ ifdef CONFIG_CONSOLE_RECORD
obj-$(CONFIG_CMD_PAUSE) += test_pause.o
endif
obj-y += exit.o mem.o
+obj-$(CONFIG_X86) += cpuid.o msr.o
obj-$(CONFIG_CMD_ADDRMAP) += addrmap.o
obj-$(CONFIG_CMD_BDI) += bdinfo.o
+obj-$(CONFIG_COREBOOT_SYSINFO) += coreboot.o
obj-$(CONFIG_CMD_FDT) += fdt.o
obj-$(CONFIG_CONSOLE_TRUETYPE) += font.o
obj-$(CONFIG_CMD_HISTORY) += history.o
obj-$(CONFIG_CMD_LOADM) += loadm.o
-obj-$(CONFIG_CMD_MEM_SEARCH) += mem_search.o
+obj-$(CONFIG_CMD_MEMINFO) += meminfo.o
obj-$(CONFIG_CMD_MEMORY) += mem_copy.o
+obj-$(CONFIG_CMD_MEM_SEARCH) += mem_search.o
ifdef CONFIG_CMD_PCI
obj-$(CONFIG_CMD_PCI_MPS) += pci_mps.o
endif
-obj-$(CONFIG_CMD_PINMUX) += pinmux.o
-obj-$(CONFIG_CMD_PWM) += pwm.o
obj-$(CONFIG_CMD_SEAMA) += seama.o
ifdef CONFIG_SANDBOX
obj-$(CONFIG_CMD_MBR) += mbr.o
+obj-$(CONFIG_CMD_PINMUX) += pinmux.o
+obj-$(CONFIG_CMD_PWM) += pwm.o
obj-$(CONFIG_CMD_READ) += rw.o
obj-$(CONFIG_CMD_SETEXPR) += setexpr.o
+obj-$(CONFIG_CMD_TEMPERATURE) += temperature.o
+ifdef CONFIG_NET
obj-$(CONFIG_CMD_WGET) += wget.o
+endif
obj-$(CONFIG_ARM_FFA_TRANSPORT) += armffa.o
endif
-obj-$(CONFIG_CMD_TEMPERATURE) += temperature.o
diff --git a/test/cmd/coreboot.c b/test/cmd/coreboot.c
new file mode 100644
index 00000000000..a99898d15c4
--- /dev/null
+++ b/test/cmd/coreboot.c
@@ -0,0 +1,119 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test for coreboot commands
+ *
+ * Copyright 2023 Google LLC
+ * Written by Simon Glass <sjg@chromium.org>
+ */
+
+#include <cedit.h>
+#include <command.h>
+#include <dm.h>
+#include <expo.h>
+#include <rtc.h>
+#include <test/cedit-test.h>
+#include <test/cmd.h>
+#include <test/test.h>
+#include <test/ut.h>
+#include "../../boot/scene_internal.h"
+
+enum {
+ CSUM_LOC = 0x3f0 / 8,
+};
+
+/**
+ * test_cmd_cbsysinfo() - test the cbsysinfo command produces expected output
+ *
+ * This includes ensuring that the coreboot build has the expected options
+ * enabled
+ */
+static int test_cmd_cbsysinfo(struct unit_test_state *uts)
+{
+ ut_assertok(run_command("cbsysinfo", 0));
+ ut_assert_nextlinen("Coreboot table at");
+
+ /* Make sure CMOS options are enabled */
+ ut_assert_skip_to_line(
+ " 1c0 1 e 1 power_on_after_fail 0:Disable 1:Enable");
+ ut_assert_skip_to_line("CMOS start : 1c0");
+ ut_assert_nextline(" CMOS end : 1cf");
+ ut_assert_nextline(" CMOS csum loc: 3f0");
+
+ /* Make sure the linear frame buffer is enabled */
+ ut_assert_skip_to_linen("Framebuffer");
+ ut_assert_nextlinen(" Phys addr");
+
+ ut_assert_skip_to_line("Chrome OS VPD: 00000000");
+ ut_assert_nextlinen("RSDP");
+ ut_assert_nextlinen("Unimpl.");
+ ut_assert_console_end();
+
+ return 0;
+}
+CMD_TEST(test_cmd_cbsysinfo, UTF_CONSOLE);
+
+/* test cbcmos command */
+static int test_cmd_cbcmos(struct unit_test_state *uts)
+{
+ u16 old_csum, new_csum;
+ struct udevice *dev;
+
+ /* initially the checksum should be correct */
+ ut_assertok(run_command("cbcmos check", 0));
+ ut_assert_console_end();
+
+ /* make a change to the checksum */
+ ut_assertok(uclass_first_device_err(UCLASS_RTC, &dev));
+ ut_assertok(rtc_read16(dev, CSUM_LOC, &old_csum));
+ ut_assertok(rtc_write16(dev, CSUM_LOC, old_csum + 1));
+
+ /* now the command should fail */
+ ut_asserteq(1, run_command("cbcmos check", 0));
+ ut_assert_nextline("Checksum %04x error: calculated %04x",
+ old_csum + 1, old_csum);
+ ut_assert_console_end();
+
+ /* now get it to fix the checksum */
+ ut_assertok(run_command("cbcmos update", 0));
+ ut_assert_nextline("Checksum %04x written", old_csum);
+ ut_assert_console_end();
+
+ /* check the RTC looks right */
+ ut_assertok(rtc_read16(dev, CSUM_LOC, &new_csum));
+ ut_asserteq(old_csum, new_csum);
+ ut_assert_console_end();
+
+ return 0;
+}
+CMD_TEST(test_cmd_cbcmos, UTF_CONSOLE);
+
+/* test 'cedit cb_load' command */
+static int test_cmd_cedit_cb_load(struct unit_test_state *uts)
+{
+ struct scene_obj_menu *menu;
+ struct video_priv *vid_priv;
+ struct scene_obj_txt *txt;
+ struct scene *scn;
+ struct expo *exp;
+ int scn_id;
+
+ ut_assertok(run_command("cedit cb_load", 0));
+ ut_assertok(run_command("cedit read_cmos", 0));
+ ut_assert_console_end();
+
+ exp = cur_exp;
+ scn_id = cedit_prepare(exp, &vid_priv, &scn);
+ ut_assert(scn_id > 0);
+ ut_assertnonnull(scn);
+
+ /* just do a very basic test that the first menu is present */
+ menu = scene_obj_find(scn, scn->highlight_id, SCENEOBJT_NONE);
+ ut_assertnonnull(menu);
+
+ txt = scene_obj_find(scn, menu->title_id, SCENEOBJT_NONE);
+ ut_assertnonnull(txt);
+ ut_asserteq_str("Boot option", expo_get_str(exp, txt->str_id));
+
+ return 0;
+}
+CMD_TEST(test_cmd_cedit_cb_load, UTF_CONSOLE);
diff --git a/test/cmd/cpuid.c b/test/cmd/cpuid.c
new file mode 100644
index 00000000000..e07f5fd4696
--- /dev/null
+++ b/test/cmd/cpuid.c
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Tests for cpuid command
+ *
+ * Copyright 2024 Google LLC
+ * Written by Simon Glass <sjg@chromium.org>
+ */
+
+#include <test/cmd.h>
+#include <test/ut.h>
+
+static int cmd_test_cpuid(struct unit_test_state *uts)
+{
+ ut_assertok(run_commandf("cpuid 1"));
+ ut_assert_nextline("eax 00060fb1");
+ ut_assert_nextline("ebx 00000800");
+ ut_assert_nextline("ecx 80002001");
+ ut_assert_nextline("edx 078bfbfd");
+
+ return 0;
+}
+CMD_TEST(cmd_test_cpuid, UTF_CONSOLE);
diff --git a/test/cmd/font.c b/test/cmd/font.c
index 25d365dedd2..3335dd65bea 100644
--- a/test/cmd/font.c
+++ b/test/cmd/font.c
@@ -27,14 +27,20 @@ static int font_test_base(struct unit_test_state *uts)
ut_assertok(uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev));
ut_assertok(run_command("font list", 0));
- ut_assert_nextline("nimbus_sans_l_regular");
+ if (IS_ENABLED(CONFIG_CONSOLE_TRUETYPE_NIMBUS))
+ ut_assert_nextline("nimbus_sans_l_regular");
+ if (IS_ENABLED(CONFIG_CONSOLE_TRUETYPE_ANKACODER))
+ ut_assert_nextline("ankacoder_c75_r");
if (IS_ENABLED(CONFIG_CONSOLE_TRUETYPE_CANTORAONE))
ut_assert_nextline("cantoraone_regular");
ut_assert_console_end();
ut_assertok(vidconsole_get_font_size(dev, &name, &size));
- ut_asserteq_str("nimbus_sans_l_regular", name);
- ut_asserteq(18, size);
+ if (IS_ENABLED(CONFIG_CONSOLE_TRUETYPE_ANKACODER))
+ ut_asserteq_str("ankacoder_c75_r", name);
+ else
+ ut_asserteq_str("nimbus_sans_l_regular", name);
+ ut_asserteq(CONFIG_CONSOLE_TRUETYPE_SIZE, size);
if (!IS_ENABLED(CONFIG_CONSOLE_TRUETYPE_CANTORAONE))
return 0;
@@ -58,10 +64,19 @@ static int font_test_base(struct unit_test_state *uts)
ut_assertok(vidconsole_get_font_size(dev, &name, &size));
ut_asserteq_str("cantoraone_regular", name);
ut_asserteq(40, size);
+ ut_assertok(ut_check_console_end(uts));
+
+ ut_assertok(run_command("font size", 0));
+ ut_assert_nextline("40");
+ ut_assertok(ut_check_console_end(uts));
ut_assertok(run_command("font size 30", 0));
ut_assert_console_end();
+ ut_assertok(run_command("font size", 0));
+ ut_assert_nextline("30");
+ ut_assertok(ut_check_console_end(uts));
+
ut_assertok(vidconsole_get_font_size(dev, &name, &size));
ut_asserteq_str("cantoraone_regular", name);
ut_asserteq(30, size);
diff --git a/test/cmd/mem_copy.c b/test/cmd/mem_copy.c
index 1ba0cebbbe0..67eca328777 100644
--- a/test/cmd/mem_copy.c
+++ b/test/cmd/mem_copy.c
@@ -21,7 +21,7 @@ struct param {
static int do_test(struct unit_test_state *uts,
const char *suffix, int d, int s, int count)
{
- const long addr = 0x1000;
+ const long addr = CONFIG_SYS_LOAD_ADDR + 0x1000;
u8 shadow[BUF_SIZE];
u8 *buf;
int i, w, bytes;
diff --git a/test/cmd/meminfo.c b/test/cmd/meminfo.c
new file mode 100644
index 00000000000..53b41e3b49e
--- /dev/null
+++ b/test/cmd/meminfo.c
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test for 'meminfo' command
+ *
+ * Copyright 2024 Google LLC
+ * Written by Simon Glass <sjg@chromium.org>
+ */
+
+#include <dm/test.h>
+#include <test/cmd.h>
+#include <test/ut.h>
+
+/* Test 'meminfo' command */
+static int cmd_test_meminfo(struct unit_test_state *uts)
+{
+ ut_assertok(run_command("meminfo", 0));
+ ut_assert_nextline("DRAM: 256 MiB");
+ ut_assert_nextline_empty();
+
+ ut_assert_nextline("Region Base Size End Gap");
+ ut_assert_nextlinen("-");
+
+ /* For now we don't worry about checking the values */
+ ut_assert_nextlinen("video");
+ ut_assert_nextlinen("code");
+ ut_assert_nextlinen("malloc");
+ ut_assert_nextlinen("board_info");
+ ut_assert_nextlinen("global_data");
+ ut_assert_nextlinen("devicetree");
+ ut_assert_nextlinen("bootstage");
+ ut_assert_nextlinen("bloblist");
+ ut_assert_nextlinen("stack");
+
+ /* we expect at least one lmb line, but don't know how many */
+ ut_assert_nextlinen("lmb");
+ ut_assert_skip_to_linen("free");
+
+ ut_assert_console_end();
+
+ return 0;
+}
+CMD_TEST(cmd_test_meminfo, UTF_CONSOLE);
diff --git a/test/cmd/msr.c b/test/cmd/msr.c
new file mode 100644
index 00000000000..e9a152ee5bf
--- /dev/null
+++ b/test/cmd/msr.c
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Tests for msr command
+ *
+ * Copyright 2024 Google LLC
+ * Written by Simon Glass <sjg@chromium.org>
+ */
+
+#include <test/cmd.h>
+#include <test/ut.h>
+
+static int cmd_test_msr(struct unit_test_state *uts)
+{
+ ut_assertok(run_commandf("msr read 200"));
+ ut_assert_nextline("00000000 ffe00006");
+ ut_assert_console_end();
+
+ /* change the first variable msr and see it reflected in the mtrr cmd */
+ ut_assertok(run_commandf("mtrr"));
+ ut_assert_nextline("CPU 65537:");
+ ut_assert_nextlinen("Reg");
+ ut_assert_nextlinen("0 Y Back 00000000ffe00000");
+ ut_assertok(console_record_reset_enable());
+
+ /* change the type from 6 to 5 */
+ ut_assertok(run_commandf("msr write 200 0 ffe00005"));
+ ut_assert_console_end();
+
+ /* Now it shows 'Protect' */
+ ut_assertok(run_commandf("mtrr"));
+ ut_assert_nextline("CPU 65537:");
+ ut_assert_nextlinen("Reg");
+ ut_assert_nextlinen("0 Y Protect 00000000ffe00000");
+ ut_assertok(console_record_reset_enable());
+
+ return 0;
+}
+CMD_TEST(cmd_test_msr, UTF_CONSOLE);
diff --git a/test/dm/Makefile b/test/dm/Makefile
index 6c9ebb8d07c..bcb52ef1067 100644
--- a/test/dm/Makefile
+++ b/test/dm/Makefile
@@ -48,7 +48,9 @@ obj-$(CONFIG_VIDEO_MIPI_DSI) += dsi_host.o
obj-$(CONFIG_DM_DSA) += dsa.o
obj-$(CONFIG_ECDSA_VERIFY) += ecdsa.o
obj-$(CONFIG_EFI_MEDIA_SANDBOX) += efi_media.o
+ifdef CONFIG_NET
obj-$(CONFIG_DM_ETH) += eth.o
+endif
obj-$(CONFIG_EXTCON) += extcon.o
ifneq ($(CONFIG_EFI_PARTITION),)
obj-$(CONFIG_FASTBOOT_FLASH_MMC) += fastboot.o
diff --git a/test/dm/acpi.c b/test/dm/acpi.c
index 7ccd7f8d20a..39a26bbb492 100644
--- a/test/dm/acpi.c
+++ b/test/dm/acpi.c
@@ -95,6 +95,21 @@ static int testacpi_get_name(const struct udevice *dev, char *out_name)
return acpi_copy_name(out_name, ACPI_TEST_DEV_NAME);
}
+static int testacpi_fill_madt(const struct udevice *dev, struct acpi_ctx *ctx)
+{
+ u64 *data = ctx->current;
+
+ /* Only fill madt once */
+ if (device_get_uclass_id(dev->parent) != UCLASS_TEST_ACPI)
+ return 0;
+
+ *data = 0xdeadbeef;
+
+ acpi_inc(ctx, sizeof(u64));
+
+ return 0;
+}
+
static int testacpi_fill_ssdt(const struct udevice *dev, struct acpi_ctx *ctx)
{
const char *data;
@@ -124,6 +139,7 @@ static int testacpi_inject_dsdt(const struct udevice *dev, struct acpi_ctx *ctx)
struct acpi_ops testacpi_ops = {
.get_name = testacpi_get_name,
.write_tables = testacpi_write_tables,
+ .fill_madt = testacpi_fill_madt,
.fill_ssdt = testacpi_fill_ssdt,
.inject_dsdt = testacpi_inject_dsdt,
};
@@ -527,6 +543,33 @@ static int dm_test_acpi_fill_ssdt(struct unit_test_state *uts)
}
DM_TEST(dm_test_acpi_fill_ssdt, UTF_SCAN_PDATA | UTF_SCAN_FDT);
+/* Test acpi_fill_madt() */
+static int dm_test_acpi_fill_madt(struct unit_test_state *uts)
+{
+ struct acpi_ctx ctx;
+ u64 *buf;
+
+ buf = malloc(BUF_SIZE);
+ ut_assertnonnull(buf);
+
+ acpi_reset_items();
+ ctx.current = buf;
+ buf[1] = 'z'; /* sentinel */
+ ut_assertok(acpi_fill_madt_subtbl(&ctx));
+
+ /*
+ * These values come from acpi-test2's acpi-ssdt-test-data property.
+ * This device comes first because of u-boot,acpi-ssdt-order
+ */
+ ut_asserteq(0xdeadbeef, buf[0]);
+
+ ut_asserteq('z', buf[1]);
+
+ return 0;
+}
+
+DM_TEST(dm_test_acpi_fill_madt, UTF_SCAN_PDATA | UTF_SCAN_FDT);
+
/* Test acpi_inject_dsdt() */
static int dm_test_acpi_inject_dsdt(struct unit_test_state *uts)
{
diff --git a/test/dm/core.c b/test/dm/core.c
index e0c5b9e0017..7371d3ff426 100644
--- a/test/dm/core.c
+++ b/test/dm/core.c
@@ -1351,3 +1351,25 @@ static int dm_test_dev_get_mem(struct unit_test_state *uts)
return 0;
}
DM_TEST(dm_test_dev_get_mem, UTF_SCAN_FDT);
+
+/* Test uclass_try_first_device() */
+static int dm_test_try_first_device(struct unit_test_state *uts)
+{
+ struct udevice *dev;
+
+ /* Check that it doesn't create a device or uclass */
+ ut_assertnull(uclass_find(UCLASS_TEST));
+ ut_assertnull(uclass_try_first_device(UCLASS_TEST));
+ ut_assertnull(uclass_try_first_device(UCLASS_TEST));
+ ut_assertnull(uclass_find(UCLASS_TEST));
+
+ /* Create a test device */
+ ut_assertok(device_bind_by_name(uts->root, false, &driver_info_manual,
+ &dev));
+ dev = uclass_try_first_device(UCLASS_TEST);
+ ut_assertnonnull(dev);
+ ut_asserteq(UCLASS_TEST, device_get_uclass_id(dev));
+
+ return 0;
+}
+DM_TEST(dm_test_try_first_device, 0);
diff --git a/test/dm/irq.c b/test/dm/irq.c
index 836f2d82e71..ca3e1880656 100644
--- a/test/dm/irq.c
+++ b/test/dm/irq.c
@@ -76,6 +76,21 @@ static int dm_test_request(struct unit_test_state *uts)
}
DM_TEST(dm_test_request, UTF_SCAN_PDATA | UTF_SCAN_FDT);
+/* Test of irq_get_by_index() */
+static int dm_test_irq_get_by_index(struct unit_test_state *uts)
+{
+ struct udevice *dev;
+ struct irq irq;
+
+ ut_assertok(uclass_get_device_by_name(UCLASS_TEST_FDT, "f-test",
+ &dev));
+ ut_assertok(irq_get_by_index(dev, 0, &irq));
+ ut_asserteq(4, irq.id);
+
+ return 0;
+}
+DM_TEST(dm_test_irq_get_by_index, UTF_SCAN_PDATA | UTF_SCAN_FDT);
+
/* Test of irq_get_acpi() */
static int dm_test_irq_get_acpi(struct unit_test_state *uts)
{
diff --git a/test/dm/wdt.c b/test/dm/wdt.c
index 541bcba1b53..bef29591d5a 100644
--- a/test/dm/wdt.c
+++ b/test/dm/wdt.c
@@ -3,7 +3,6 @@
* Copyright 2017 Google, Inc
*/
-#include <cyclic.h>
#include <dm.h>
#include <time.h>
#include <wdt.h>
@@ -14,6 +13,7 @@
#include <test/test.h>
#include <test/ut.h>
#include <linux/delay.h>
+#include <u-boot/schedule.h>
#include <watchdog.h>
/* Test that watchdog driver functions are called */
@@ -71,7 +71,7 @@ static int dm_test_wdt_gpio_toggle(struct unit_test_state *uts)
ut_assertok(wdt_reset(wdt));
ut_asserteq(val, sandbox_gpio_get_value(gpio, offset));
- ut_asserteq(-ENOSYS, wdt_stop(wdt));
+ ut_asserteq(-EOPNOTSUPP, wdt_stop(wdt));
return 0;
}
@@ -103,7 +103,7 @@ static int dm_test_wdt_gpio_level(struct unit_test_state *uts)
ut_assertok(wdt_reset(wdt));
ut_asserteq(val, sandbox_gpio_get_value(gpio, offset));
- ut_asserteq(-ENOSYS, wdt_stop(wdt));
+ ut_asserteq(-EOPNOTSUPP, wdt_stop(wdt));
return 0;
}
@@ -131,7 +131,7 @@ static int dm_test_wdt_watchdog_reset(struct unit_test_state *uts)
/* Neither device should be "started", so watchdog_reset() should be a no-op. */
reset_count = state->wdt.reset_count;
val = sandbox_gpio_get_value(gpio, offset);
- cyclic_run();
+ schedule();
ut_asserteq(reset_count, state->wdt.reset_count);
ut_asserteq(val, sandbox_gpio_get_value(gpio, offset));
@@ -141,19 +141,19 @@ static int dm_test_wdt_watchdog_reset(struct unit_test_state *uts)
/* Make sure both devices have just been pinged. */
timer_test_add_offset(100);
- cyclic_run();
+ schedule();
reset_count = state->wdt.reset_count;
val = sandbox_gpio_get_value(gpio, offset);
/* The gpio watchdog should be pinged, the sandbox one not. */
timer_test_add_offset(30);
- cyclic_run();
+ schedule();
ut_asserteq(reset_count, state->wdt.reset_count);
ut_asserteq(!val, sandbox_gpio_get_value(gpio, offset));
/* After another ~30ms, both devices should get pinged. */
timer_test_add_offset(30);
- cyclic_run();
+ schedule();
ut_asserteq(reset_count + 1, state->wdt.reset_count);
ut_asserteq(val, sandbox_gpio_get_value(gpio, offset));
diff --git a/test/hush/Makefile b/test/hush/Makefile
index a2d98815e50..4c3a0be857a 100644
--- a/test/hush/Makefile
+++ b/test/hush/Makefile
@@ -5,6 +5,8 @@
obj-y += cmd_ut_hush.o
obj-y += if.o
+ifdef CONFIG_CONSOLE_RECORD
obj-y += dollar.o
+endif
obj-y += list.o
obj-y += loop.o
diff --git a/test/lib/alist.c b/test/lib/alist.c
index d41845c7e6c..0bf24578d2e 100644
--- a/test/lib/alist.c
+++ b/test/lib/alist.c
@@ -240,3 +240,256 @@ static int lib_test_alist_add(struct unit_test_state *uts)
return 0;
}
LIB_TEST(lib_test_alist_add, 0);
+
+/* Test alist_next() */
+static int lib_test_alist_next(struct unit_test_state *uts)
+{
+ const struct my_struct *ptr;
+ struct my_struct data, *ptr2;
+ struct alist lst;
+ ulong start;
+
+ start = ut_check_free();
+
+ ut_assert(alist_init_struct(&lst, struct my_struct));
+ data.val = 123;
+ data.other_val = 0;
+ alist_add(&lst, data);
+
+ data.val = 321;
+ alist_add(&lst, data);
+
+ data.val = 789;
+ alist_add(&lst, data);
+
+ ptr = alist_get(&lst, 0, struct my_struct);
+ ut_assertnonnull(ptr);
+ ut_asserteq(123, ptr->val);
+
+ ptr = alist_next(&lst, ptr);
+ ut_assertnonnull(ptr);
+ ut_asserteq(321, ptr->val);
+
+ ptr2 = (struct my_struct *)ptr;
+ ptr2 = alist_nextw(&lst, ptr2);
+ ut_assertnonnull(ptr2);
+
+ ptr = alist_next(&lst, ptr);
+ ut_assertnonnull(ptr);
+ ut_asserteq(789, ptr->val);
+ ut_asserteq_ptr(ptr, ptr2);
+ ptr2->val = 89;
+ ut_asserteq(89, ptr->val);
+
+ ptr = alist_next(&lst, ptr);
+ ut_assertnull(ptr);
+
+ alist_uninit(&lst);
+
+ /* Check for memory leaks */
+ ut_assertok(ut_check_delta(start));
+
+ return 0;
+}
+LIB_TEST(lib_test_alist_next, 0);
+
+/* Test alist_for_each() */
+static int lib_test_alist_for_each(struct unit_test_state *uts)
+{
+ const struct my_struct *ptr;
+ struct my_struct data, *ptr2;
+ struct alist lst;
+ ulong start;
+ int sum;
+
+ start = ut_check_free();
+
+ ut_assert(alist_init_struct(&lst, struct my_struct));
+ ut_asserteq_ptr(NULL, alist_end(&lst, struct my_struct));
+
+ sum = 0;
+ alist_for_each(ptr, &lst)
+ sum++;
+ ut_asserteq(0, sum);
+
+ alist_for_each(ptr, &lst)
+ sum++;
+ ut_asserteq(0, sum);
+
+ /* add three items */
+ data.val = 1;
+ data.other_val = 0;
+ alist_add(&lst, data);
+
+ ptr = lst.data;
+ ut_asserteq_ptr(ptr + 1, alist_end(&lst, struct my_struct));
+
+ data.val = 2;
+ alist_add(&lst, data);
+ ut_asserteq_ptr(ptr + 2, alist_end(&lst, struct my_struct));
+
+ data.val = 3;
+ alist_add(&lst, data);
+ ut_asserteq_ptr(ptr + 3, alist_end(&lst, struct my_struct));
+
+ /* check alist_chk_ptr() */
+ ut_asserteq(true, alist_chk_ptr(&lst, ptr + 2));
+ ut_asserteq(false, alist_chk_ptr(&lst, ptr + 3));
+ ut_asserteq(false, alist_chk_ptr(&lst, ptr + 4));
+ ut_asserteq(true, alist_chk_ptr(&lst, ptr));
+ ut_asserteq(false, alist_chk_ptr(&lst, ptr - 1));
+
+ /* sum all items */
+ sum = 0;
+ alist_for_each(ptr, &lst)
+ sum += ptr->val;
+ ut_asserteq(6, sum);
+
+ /* increment all items */
+ alist_for_each(ptr2, &lst)
+ ptr2->val += 1;
+
+ /* sum all items again */
+ sum = 0;
+ alist_for_each(ptr, &lst)
+ sum += ptr->val;
+ ut_asserteq(9, sum);
+
+ ptr = lst.data;
+ ut_asserteq_ptr(ptr + 3, alist_end(&lst, struct my_struct));
+
+ /* empty the list and try again */
+ alist_empty(&lst);
+ ut_asserteq_ptr(ptr, alist_end(&lst, struct my_struct));
+ ut_assertnull(alist_get(&lst, 0, struct my_struct));
+
+ sum = 0;
+ alist_for_each(ptr, &lst)
+ sum += ptr->val;
+ ut_asserteq(0, sum);
+
+ alist_uninit(&lst);
+
+ /* Check for memory leaks */
+ ut_assertok(ut_check_delta(start));
+
+ return 0;
+}
+LIB_TEST(lib_test_alist_for_each, 0);
+
+/* Test alist_empty() */
+static int lib_test_alist_empty(struct unit_test_state *uts)
+{
+ struct my_struct data;
+ struct alist lst;
+ ulong start;
+
+ start = ut_check_free();
+
+ ut_assert(alist_init_struct(&lst, struct my_struct));
+ ut_asserteq(0, lst.count);
+ data.val = 1;
+ data.other_val = 0;
+ alist_add(&lst, data);
+ ut_asserteq(1, lst.count);
+ ut_asserteq(4, lst.alloc);
+
+ alist_empty(&lst);
+ ut_asserteq(0, lst.count);
+ ut_asserteq(4, lst.alloc);
+ ut_assertnonnull(lst.data);
+ ut_asserteq(sizeof(data), lst.obj_size);
+
+ alist_uninit(&lst);
+
+ /* Check for memory leaks */
+ ut_assertok(ut_check_delta(start));
+
+ return 0;
+}
+LIB_TEST(lib_test_alist_empty, 0);
+
+static int lib_test_alist_filter(struct unit_test_state *uts)
+{
+ struct my_struct *from, *to, *ptr;
+ struct my_struct data;
+ struct alist lst;
+ ulong start;
+ int count;
+
+ start = ut_check_free();
+
+ ut_assert(alist_init_struct(&lst, struct my_struct));
+ data.val = 1;
+ data.other_val = 0;
+ alist_add(&lst, data);
+
+ data.val = 2;
+ alist_add(&lst, data);
+
+ data.val = 3;
+ alist_add(&lst, data);
+ ptr = lst.data;
+
+ /* filter out all values except 2 */
+ alist_for_each_filter(from, to, &lst) {
+ if (from->val != 2)
+ *to++ = *from;
+ }
+ alist_update_end(&lst, to);
+
+ ut_asserteq(2, lst.count);
+ ut_assertnonnull(lst.data);
+
+ ut_asserteq(1, alist_get(&lst, 0, struct my_struct)->val);
+ ut_asserteq(3, alist_get(&lst, 1, struct my_struct)->val);
+ ut_asserteq_ptr(ptr + 3, from);
+ ut_asserteq_ptr(ptr + 2, to);
+
+ /* filter out nothing */
+ alist_for_each_filter(from, to, &lst) {
+ if (from->val != 2)
+ *to++ = *from;
+ }
+ alist_update_end(&lst, to);
+ ut_asserteq_ptr(ptr + 2, from);
+ ut_asserteq_ptr(ptr + 2, to);
+
+ ut_asserteq(2, lst.count);
+ ut_assertnonnull(lst.data);
+
+ ut_asserteq(1, alist_get(&lst, 0, struct my_struct)->val);
+ ut_asserteq(3, alist_get(&lst, 1, struct my_struct)->val);
+
+ /* filter out everything */
+ alist_for_each_filter(from, to, &lst) {
+ if (from->val == 2)
+ *to++ = *from;
+ }
+ alist_update_end(&lst, to);
+ ut_asserteq_ptr(ptr + 2, from);
+ ut_asserteq_ptr(ptr, to);
+
+ /* filter out everything (nop) */
+ count = 0;
+ alist_for_each_filter(from, to, &lst) {
+ if (from->val == 2)
+ *to++ = *from;
+ count++;
+ }
+ alist_update_end(&lst, to);
+ ut_asserteq_ptr(ptr, from);
+ ut_asserteq_ptr(ptr, to);
+ ut_asserteq(0, count);
+
+ ut_asserteq(0, lst.count);
+ ut_assertnonnull(lst.data);
+
+ alist_uninit(&lst);
+
+ /* Check for memory leaks */
+ ut_assertok(ut_check_delta(start));
+
+ return 0;
+}
+LIB_TEST(lib_test_alist_filter, 0);
diff --git a/test/lib/lmb.c b/test/lib/lmb.c
index b2c54fb4bcb..c917115b7b6 100644
--- a/test/lib/lmb.c
+++ b/test/lib/lmb.c
@@ -473,7 +473,7 @@ static int lib_test_lmb_overlapping_reserve(struct unit_test_state *uts)
/* allocate overlapping region should return the coalesced count */
ret = lmb_reserve(0x40011000, 0x10000);
- ut_asserteq(ret, 1);
+ ut_asserteq(ret, 0);
ASSERT_LMB(mem_lst, used_lst, ram, ram_size, 1, 0x40010000, 0x11000,
0, 0, 0, 0);
/* allocate 3nd region */
@@ -748,13 +748,13 @@ static int lib_test_lmb_flags(struct unit_test_state *uts)
/* merge after */
ret = lmb_reserve_flags(0x40020000, 0x10000, LMB_NOMAP);
- ut_asserteq(ret, 1);
+ ut_asserteq(ret, 0);
ASSERT_LMB(mem_lst, used_lst, ram, ram_size, 1, 0x40010000, 0x20000,
0, 0, 0, 0);
/* merge before */
ret = lmb_reserve_flags(0x40000000, 0x10000, LMB_NOMAP);
- ut_asserteq(ret, 1);
+ ut_asserteq(ret, 0);
ASSERT_LMB(mem_lst, used_lst, ram, ram_size, 1, 0x40000000, 0x30000,
0, 0, 0, 0);
@@ -770,7 +770,7 @@ static int lib_test_lmb_flags(struct unit_test_state *uts)
/* test that old API use LMB_NONE */
ret = lmb_reserve(0x40040000, 0x10000);
- ut_asserteq(ret, 1);
+ ut_asserteq(ret, 0);
ASSERT_LMB(mem_lst, used_lst, ram, ram_size, 2, 0x40000000, 0x30000,
0x40030000, 0x20000, 0, 0);
@@ -789,7 +789,7 @@ static int lib_test_lmb_flags(struct unit_test_state *uts)
/* merge with 2 adjacent regions */
ret = lmb_reserve_flags(0x40060000, 0x10000, LMB_NOMAP);
- ut_asserteq(ret, 2);
+ ut_asserteq(ret, 0);
ASSERT_LMB(mem_lst, used_lst, ram, ram_size, 3, 0x40000000, 0x30000,
0x40030000, 0x20000, 0x40050000, 0x30000);
diff --git a/test/py/tests/test_android/test_ab.py b/test/py/tests/test_android/test_ab.py
index c79cb07fda3..9bf1a0eb00a 100644
--- a/test/py/tests/test_android/test_ab.py
+++ b/test/py/tests/test_android/test_ab.py
@@ -54,22 +54,45 @@ def ab_disk_image(u_boot_console):
di = ABTestDiskImage(u_boot_console)
return di
+def ab_dump(u_boot_console, slot_num, crc):
+ output = u_boot_console.run_command('bcb ab_dump host 0#misc')
+ header, slot0, slot1 = output.split('\r\r\n\r\r\n')
+ slots = [slot0, slot1]
+ slot_suffixes = ['_a', '_b']
+
+ header = dict(map(lambda x: map(str.strip, x.split(':')), header.split('\r\r\n')))
+ assert header['Bootloader Control'] == '[misc]'
+ assert header['Active Slot'] == slot_suffixes[slot_num]
+ assert header['Magic Number'] == '0x42414342'
+ assert header['Version'] == '1'
+ assert header['Number of Slots'] == '2'
+ assert header['Recovery Tries Remaining'] == '0'
+ assert header['CRC'] == '{} (Valid)'.format(crc)
+
+ slot = dict(map(lambda x: map(str.strip, x.split(':')), slots[slot_num].split('\r\r\n\t- ')[1:]))
+ assert slot['Priority'] == '15'
+ assert slot['Tries Remaining'] == '6'
+ assert slot['Successful Boot'] == '0'
+ assert slot['Verity Corrupted'] == '0'
+
@pytest.mark.boardspec('sandbox')
@pytest.mark.buildconfigspec('android_ab')
-@pytest.mark.buildconfigspec('cmd_ab_select')
+@pytest.mark.buildconfigspec('cmd_bcb')
@pytest.mark.requiredtool('sgdisk')
def test_ab(ab_disk_image, u_boot_console):
- """Test the 'ab_select' command."""
+ """Test the 'bcb ab_select' command."""
u_boot_console.run_command('host bind 0 ' + ab_disk_image.path)
- output = u_boot_console.run_command('ab_select slot_name host 0#misc')
+ output = u_boot_console.run_command('bcb ab_select slot_name host 0#misc')
assert 're-initializing A/B metadata' in output
assert 'Attempting slot a, tries remaining 7' in output
output = u_boot_console.run_command('printenv slot_name')
assert 'slot_name=a' in output
+ ab_dump(u_boot_console, 0, '0xd438d1b9')
- output = u_boot_console.run_command('ab_select slot_name host 0:1')
+ output = u_boot_console.run_command('bcb ab_select slot_name host 0:1')
assert 'Attempting slot b, tries remaining 7' in output
output = u_boot_console.run_command('printenv slot_name')
assert 'slot_name=b' in output
+ ab_dump(u_boot_console, 1, '0x011ec016')
diff --git a/test/py/tests/test_efi_loader.py b/test/py/tests/test_efi_loader.py
index 707b2c9e795..33434935fe9 100644
--- a/test/py/tests/test_efi_loader.py
+++ b/test/py/tests/test_efi_loader.py
@@ -182,7 +182,7 @@ def test_efi_helloworld_net_tftp(u_boot_console):
do_test_efi_helloworld_net(u_boot_console, PROTO_TFTP);
@pytest.mark.buildconfigspec('of_control')
-@pytest.mark.buildconfigspec('cmd_bootefi_hello_compile')
+@pytest.mark.buildconfigspec('bootefi_hello_compile')
@pytest.mark.buildconfigspec('cmd_wget')
def test_efi_helloworld_net_http(u_boot_console):
"""Run the helloworld.efi binary via HTTP.
diff --git a/test/py/tests/test_eficonfig/test_eficonfig.py b/test/py/tests/test_eficonfig/test_eficonfig.py
index 1d8e033f75d..d98de5249df 100644
--- a/test/py/tests/test_eficonfig/test_eficonfig.py
+++ b/test/py/tests/test_eficonfig/test_eficonfig.py
@@ -117,7 +117,7 @@ def test_efi_eficonfig(u_boot_console, efi_eficonfig_data):
press_up_down_enter_and_wait(0, 0, True, 'Quit')
# Press the enter key to select 'Description:' entry, then enter Description
- press_up_down_enter_and_wait(0, 0, True, 'enter description:')
+ press_up_down_enter_and_wait(0, 0, True, 'Enter description:')
# Send Description user input, press ENTER key to complete
send_user_input_and_wait('test 1', 'Quit')
@@ -166,7 +166,7 @@ def test_efi_eficonfig(u_boot_console, efi_eficonfig_data):
press_up_down_enter_and_wait(0, 0, True, 'Quit')
# Press the enter key to select 'Description:' entry, then enter Description
- press_up_down_enter_and_wait(0, 0, True, 'enter description:')
+ press_up_down_enter_and_wait(0, 0, True, 'Enter description:')
# Send Description user input, press ENTER key to complete
send_user_input_and_wait('test 2', 'Quit')
@@ -278,7 +278,7 @@ def test_efi_eficonfig(u_boot_console, efi_eficonfig_data):
u_boot_console.p.expect([i])
# Press the enter key to select 'Description:' entry, then enter Description
- press_up_down_enter_and_wait(0, 0, True, 'enter description:')
+ press_up_down_enter_and_wait(0, 0, True, 'Enter description:')
# Send Description user input, press ENTER key to complete
send_user_input_and_wait('test 3', 'Quit')
diff --git a/test/py/tests/test_env.py b/test/py/tests/test_env.py
index 00bcccd65ff..4471db7d9cb 100644
--- a/test/py/tests/test_env.py
+++ b/test/py/tests/test_env.py
@@ -488,7 +488,7 @@ def test_env_ext4(state_test_env):
assert 'Loading Environment from EXT4... OK' in response
response = c.run_command('ext4ls host 0:0')
- assert '8192 uboot.env' in response
+ assert '8192 uboot.env' in response
response = c.run_command('env info')
assert 'env_valid = valid' in response
diff --git a/test/py/tests/test_event_dump.py b/test/py/tests/test_event_dump.py
index e282c67335c..45143c1c7d9 100644
--- a/test/py/tests/test_event_dump.py
+++ b/test/py/tests/test_event_dump.py
@@ -18,6 +18,7 @@ def test_event_dump(u_boot_console):
-------------------- ------------------------------ ------------------------------
EVT_FT_FIXUP bootmeth_vbe_ft_fixup .*boot/vbe_request.c:.*
EVT_FT_FIXUP bootmeth_vbe_simple_ft_fixup .*boot/vbe_simple_os.c:.*
+EVT_LAST_STAGE_INIT alloc_write_acpi_tables .*lib/acpi/acpi_table.c:.*
EVT_LAST_STAGE_INIT install_smbios_table .*lib/efi_loader/efi_smbios.c:.*
EVT_MISC_INIT_F sandbox_early_getopt_check .*arch/sandbox/cpu/start.c:.*
EVT_TEST h_adder_simple .*test/common/event.c:'''
diff --git a/test/py/tests/test_fs/test_basic.py b/test/py/tests/test_fs/test_basic.py
index 71f3e86fb18..b5f4704172a 100644
--- a/test/py/tests/test_fs/test_basic.py
+++ b/test/py/tests/test_fs/test_basic.py
@@ -33,10 +33,7 @@ class TestFsBasic(object):
# In addition, test with a nonexistent directory to see if we crash.
output = u_boot_console.run_command(
'%sls host 0:0 invalid_d' % fs_type)
- if fs_type == 'ext4':
- assert('Can not find directory' in output)
- else:
- assert('' == output)
+ assert('' == output)
def test_fs2(self, u_boot_console, fs_obj_basic):
"""
diff --git a/test/py/tests/test_spi.py b/test/py/tests/test_spi.py
index 3160d58540f..caca9303271 100644
--- a/test/py/tests/test_spi.py
+++ b/test/py/tests/test_spi.py
@@ -693,4 +693,16 @@ def test_spi_negative(u_boot_console):
u_boot_console, 'read', offset, size, addr, 1, error_msg, EXPECTED_READ
)
+ # Read to relocation address
+ output = u_boot_console.run_command('bdinfo')
+ m = re.search('relocaddr\s*= (.+)', output)
+ res_area = int(m.group(1), 16)
+
+ start = 0
+ size = 0x2000
+ error_msg = 'ERROR: trying to overwrite reserved memory'
+ flash_ops(
+ u_boot_console, 'read', start, size, res_area, 1, error_msg, EXPECTED_READ
+ )
+
i = i + 1
diff --git a/test/py/tests/test_usb.py b/test/py/tests/test_usb.py
index fb3d20f0826..2397fd3c2e7 100644
--- a/test/py/tests/test_usb.py
+++ b/test/py/tests/test_usb.py
@@ -288,6 +288,47 @@ def test_usb_fatls_fatinfo(u_boot_console):
if not part_detect:
pytest.skip('No %s partition detected' % fs.upper())
+def usb_fatload_fatwrite(u_boot_console, fs, x, part):
+ addr = u_boot_utils.find_ram_base(u_boot_console)
+ size = random.randint(4, 1 * 1024 * 1024)
+ output = u_boot_console.run_command('crc32 %x %x' % (addr, size))
+ m = re.search('==> (.+?)', output)
+ if not m:
+ pytest.fail('CRC32 failed')
+ expected_crc32 = m.group(1)
+
+ file = '%s_%d' % ('uboot_test', size)
+ output = u_boot_console.run_command(
+ '%swrite usb %d:%s %x %s %x' % (fs, x, part, addr, file, size)
+ )
+ assert 'Unable to write' not in output
+ assert 'Error' not in output
+ assert 'overflow' not in output
+ expected_text = '%d bytes written' % size
+ assert expected_text in output
+
+ alignment = int(
+ u_boot_console.config.buildconfig.get(
+ 'config_sys_cacheline_size', 128
+ )
+ )
+ offset = random.randrange(alignment, 1024, alignment)
+ output = u_boot_console.run_command(
+ '%sload usb %d:%s %x %s' % (fs, x, part, addr + offset, file)
+ )
+ assert 'Invalid FAT entry' not in output
+ assert 'Unable to read file' not in output
+ assert 'Misaligned buffer address' not in output
+ expected_text = '%d bytes read' % size
+ assert expected_text in output
+
+ output = u_boot_console.run_command(
+ 'crc32 %x $filesize' % (addr + offset)
+ )
+ assert expected_crc32 in output
+
+ return file, size, expected_crc32
+
@pytest.mark.buildconfigspec('cmd_usb')
@pytest.mark.buildconfigspec('cmd_fat')
@pytest.mark.buildconfigspec('cmd_memory')
@@ -309,49 +350,11 @@ def test_usb_fatload_fatwrite(u_boot_console):
for part in partitions:
part_detect = 1
- addr = u_boot_utils.find_ram_base(u_boot_console)
- size = random.randint(4, 1 * 1024 * 1024)
- output = u_boot_console.run_command('crc32 %x %x' % (addr, size))
- m = re.search('==> (.+?)', output)
- if not m:
- pytest.fail('CRC32 failed')
- expected_crc32 = m.group(1)
-
- file = '%s_%d' % ('uboot_test', size)
- output = u_boot_console.run_command(
- '%swrite usb %d:%s %x %s %x' % (fs, x, part, addr, file, size)
- )
- assert 'Unable to write' not in output
- assert 'Error' not in output
- assert 'overflow' not in output
- expected_text = '%d bytes written' % size
- assert expected_text in output
-
- alignment = int(
- u_boot_console.config.buildconfig.get(
- 'config_sys_cacheline_size', 128
- )
- )
- offset = random.randrange(alignment, 1024, alignment)
- output = u_boot_console.run_command(
- '%sload usb %d:%s %x %s' % (fs, x, part, addr + offset, file)
- )
- assert 'Invalid FAT entry' not in output
- assert 'Unable to read file' not in output
- assert 'Misaligned buffer address' not in output
- expected_text = '%d bytes read' % size
- assert expected_text in output
-
- output = u_boot_console.run_command(
- 'crc32 %x $filesize' % (addr + offset)
- )
- assert expected_crc32 in output
+ usb_fatload_fatwrite(u_boot_console, fs, x, part)
if not part_detect:
pytest.skip('No %s partition detected' % fs.upper())
- return file, size
-
@pytest.mark.buildconfigspec('cmd_usb')
@pytest.mark.buildconfigspec('cmd_ext4')
def test_usb_ext4ls(u_boot_console):
@@ -380,9 +383,42 @@ def test_usb_ext4ls(u_boot_console):
if not part_detect:
pytest.skip('No %s partition detected' % fs.upper())
+def usb_ext4load_ext4write(u_boot_console, fs, x, part):
+ addr = u_boot_utils.find_ram_base(u_boot_console)
+ size = random.randint(4, 1 * 1024 * 1024)
+ output = u_boot_console.run_command('crc32 %x %x' % (addr, size))
+ m = re.search('==> (.+?)', output)
+ if not m:
+ pytest.fail('CRC32 failed')
+ expected_crc32 = m.group(1)
+ file = '%s_%d' % ('uboot_test', size)
+
+ output = u_boot_console.run_command(
+ '%swrite usb %d:%s %x /%s %x' % (fs, x, part, addr, file, size)
+ )
+ assert 'Unable to write' not in output
+ assert 'Error' not in output
+ assert 'overflow' not in output
+ expected_text = '%d bytes written' % size
+ assert expected_text in output
+
+ offset = random.randrange(128, 1024, 128)
+ output = u_boot_console.run_command(
+ '%sload usb %d:%s %x /%s' % (fs, x, part, addr + offset, file)
+ )
+ expected_text = '%d bytes read' % size
+ assert expected_text in output
+
+ output = u_boot_console.run_command(
+ 'crc32 %x $filesize' % (addr + offset)
+ )
+ assert expected_crc32 in output
+
+ return file, size, expected_crc32
+
@pytest.mark.buildconfigspec('cmd_usb')
@pytest.mark.buildconfigspec('cmd_ext4')
-@pytest.mark.buildconfigspec('ext4_write')
+@pytest.mark.buildconfigspec('cmd_ext4_write')
@pytest.mark.buildconfigspec('cmd_memory')
def test_usb_ext4load_ext4write(u_boot_console):
devices, controllers, storage_device = test_usb_part(u_boot_console)
@@ -402,41 +438,11 @@ def test_usb_ext4load_ext4write(u_boot_console):
for part in partitions:
part_detect = 1
- addr = u_boot_utils.find_ram_base(u_boot_console)
- size = random.randint(4, 1 * 1024 * 1024)
- output = u_boot_console.run_command('crc32 %x %x' % (addr, size))
- m = re.search('==> (.+?)', output)
- if not m:
- pytest.fail('CRC32 failed')
- expected_crc32 = m.group(1)
- file = '%s_%d' % ('uboot_test', size)
-
- output = u_boot_console.run_command(
- '%swrite usb %d:%s %x /%s %x' % (fs, x, part, addr, file, size)
- )
- assert 'Unable to write' not in output
- assert 'Error' not in output
- assert 'overflow' not in output
- expected_text = '%d bytes written' % size
- assert expected_text in output
-
- offset = random.randrange(128, 1024, 128)
- output = u_boot_console.run_command(
- '%sload usb %d:%s %x /%s' % (fs, x, part, addr + offset, file)
- )
- expected_text = '%d bytes read' % size
- assert expected_text in output
-
- output = u_boot_console.run_command(
- 'crc32 %x $filesize' % (addr + offset)
- )
- assert expected_crc32 in output
+ usb_ext4load_ext4write(u_boot_console, fs, x, part)
if not part_detect:
pytest.skip('No %s partition detected' % fs.upper())
- return file, size
-
@pytest.mark.buildconfigspec('cmd_usb')
@pytest.mark.buildconfigspec('cmd_ext2')
def test_usb_ext2ls(u_boot_console):
@@ -469,11 +475,10 @@ def test_usb_ext2ls(u_boot_console):
@pytest.mark.buildconfigspec('cmd_usb')
@pytest.mark.buildconfigspec('cmd_ext2')
@pytest.mark.buildconfigspec('cmd_ext4')
-@pytest.mark.buildconfigspec('ext4_write')
+@pytest.mark.buildconfigspec('cmd_ext4_write')
@pytest.mark.buildconfigspec('cmd_memory')
def test_usb_ext2load(u_boot_console):
devices, controllers, storage_device = test_usb_part(u_boot_console)
- file, size = test_usb_ext4load_ext4write(u_boot_console)
if not devices:
pytest.skip('No devices detected')
@@ -491,12 +496,9 @@ def test_usb_ext2load(u_boot_console):
for part in partitions:
part_detect = 1
+ file, size, expected_crc32 = \
+ usb_ext4load_ext4write(u_boot_console, 'ext4', x, part)
addr = u_boot_utils.find_ram_base(u_boot_console)
- output = u_boot_console.run_command('crc32 %x %x' % (addr, size))
- m = re.search('==> (.+?)', output)
- if not m:
- pytest.fail('CRC32 failed')
- expected_crc32 = m.group(1)
offset = random.randrange(128, 1024, 128)
output = u_boot_console.run_command(
@@ -543,6 +545,7 @@ def test_usb_ls(u_boot_console):
pytest.skip('No partition detected')
@pytest.mark.buildconfigspec('cmd_usb')
+@pytest.mark.buildconfigspec('cmd_ext4_write')
@pytest.mark.buildconfigspec('cmd_fs_generic')
def test_usb_load(u_boot_console):
devices, controllers, storage_device = test_usb_part(u_boot_console)
@@ -565,15 +568,11 @@ def test_usb_load(u_boot_console):
addr = u_boot_utils.find_ram_base(u_boot_console)
if fs == 'fat':
- file, size = test_usb_fatload_fatwrite(u_boot_console)
+ file, size, expected_crc32 = \
+ usb_fatload_fatwrite(u_boot_console, fs, x, part)
elif fs == 'ext4':
- file, size = test_usb_ext4load_ext4write(u_boot_console)
-
- output = u_boot_console.run_command('crc32 %x %x' % (addr, size))
- m = re.search('==> (.+?)', output)
- if not m:
- pytest.fail('CRC32 failed')
- expected_crc32 = m.group(1)
+ file, size, expected_crc32 = \
+ usb_ext4load_ext4write(u_boot_console, fs, x, part)
offset = random.randrange(128, 1024, 128)
output = u_boot_console.run_command(
diff --git a/test/py/tests/test_ut.py b/test/py/tests/test_ut.py
index 39aa1035e34..9166c8f6b6e 100644
--- a/test/py/tests/test_ut.py
+++ b/test/py/tests/test_ut.py
@@ -208,8 +208,6 @@ booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
cons, f'echo here {kernel} {symlink}')
os.symlink(kernel, symlink)
- u_boot_utils.run_and_log(
- cons, f'mkimage -C none -A arm -T script -d {cmd_fname} {scr_fname}')
complete = True
except ValueError as exc:
diff --git a/test/test-main.c b/test/test-main.c
index da5b07ce00b..7a1f74a2c84 100644
--- a/test/test-main.c
+++ b/test/test-main.c
@@ -4,6 +4,8 @@
* Written by Simon Glass <sjg@chromium.org>
*/
+#define LOG_CATEGORY LOGC_TEST
+
#include <blk.h>
#include <console.h>
#include <cyclic.h>
@@ -240,15 +242,22 @@ static bool test_matches(const char *prefix, const char *test_name,
* ut_list_has_dm_tests() - Check if a list of tests has driver model ones
*
* @tests: List of tests to run
- * @count: Number of tests to ru
+ * @count: Number of tests to run
+ * @prefix: String prefix for the tests. Any tests that have this prefix will be
+ * printed without the prefix, so that it is easier to see the unique part
+ * of the test name. If NULL, no prefix processing is done
+ * @select_name: Name of a single test being run (from the list provided). If
+ * NULL all tests are being run
* Return: true if any of the tests have the UTF_DM flag
*/
-static bool ut_list_has_dm_tests(struct unit_test *tests, int count)
+static bool ut_list_has_dm_tests(struct unit_test *tests, int count,
+ const char *prefix, const char *select_name)
{
struct unit_test *test;
for (test = tests; test < tests + count; test++) {
- if (test->flags & UTF_DM)
+ if (test_matches(prefix, test->name, select_name) &&
+ (test->flags & UTF_DM))
return true;
}
@@ -379,6 +388,12 @@ static int test_pre_run(struct unit_test_state *uts, struct unit_test *test)
return -EAGAIN;
}
}
+ if (test->flags & UFT_BLOBLIST) {
+ log_debug("save bloblist %p\n", gd_bloblist());
+ uts->old_bloblist = gd_bloblist();
+ gd_set_bloblist(NULL);
+ }
+
ut_silence_console(uts);
return 0;
@@ -402,6 +417,11 @@ static int test_post_run(struct unit_test_state *uts, struct unit_test *test)
free(uts->of_other);
uts->of_other = NULL;
+ if (test->flags & UFT_BLOBLIST) {
+ gd_set_bloblist(uts->old_bloblist);
+ log_debug("restore bloblist %p\n", gd_bloblist());
+ }
+
blkcache_free();
return 0;
@@ -550,6 +570,9 @@ static int ut_run_test_live_flat(struct unit_test_state *uts,
* @count: Number of tests to run
* @select_name: Name of a single test to run (from the list provided). If NULL
* then all tests are run
+ * @test_insert: String describing a test to run after n other tests run, in the
+ * format n:name where n is the number of tests to run before this one and
+ * name is the name of the test to run
* Return: 0 if all tests passed, -ENOENT if test @select_name was not found,
* -EBADF if any failed
*/
@@ -646,7 +669,7 @@ int ut_run_list(const char *category, const char *prefix,
int ret;
if (!CONFIG_IS_ENABLED(OF_PLATDATA) &&
- ut_list_has_dm_tests(tests, count)) {
+ ut_list_has_dm_tests(tests, count, prefix, select_name)) {
has_dm_tests = true;
/*
* If we have no device tree, or it only has a root node, then