aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/boot/bootdev.c1
-rw-r--r--test/boot/bootflow.c68
-rw-r--r--test/cmd/fdt.c8
-rw-r--r--test/cmd/setexpr.c1
-rw-r--r--test/compression.c1
-rw-r--r--test/dm/acpi.c3
-rw-r--r--test/dm/bus.c5
-rw-r--r--test/dm/core.c10
-rw-r--r--test/dm/cpu.c2
-rw-r--r--test/dm/devres.c1
-rw-r--r--test/dm/fwu_mdata.c1
-rw-r--r--test/dm/remoteproc.c1
-rw-r--r--test/dm/spmi.c1
-rw-r--r--test/dm/test-fdt.c5
-rw-r--r--test/dm/usb.c1
-rw-r--r--test/overlay/Makefile4
-rw-r--r--test/overlay/cmd_ut_overlay.c8
-rw-r--r--test/overlay/test-fdt-overlay-stacked.dtso (renamed from test/overlay/test-fdt-overlay-stacked.dts)0
-rw-r--r--test/overlay/test-fdt-overlay.dtso (renamed from test/overlay/test-fdt-overlay.dts)0
-rw-r--r--test/py/requirements.txt6
-rw-r--r--test/py/tests/test_dm.py5
-rw-r--r--test/py/tests/test_efi_capsule/conftest.py6
-rw-r--r--test/py/tests/test_efi_capsule/test_capsule_firmware_raw.py21
-rw-r--r--test/py/tests/test_efi_capsule/version.dtso (renamed from test/py/tests/test_efi_capsule/version.dts)0
-rw-r--r--test/py/tests/test_efi_secboot/conftest.py10
-rw-r--r--test/py/tests/test_efi_secboot/test_authvar.py4
-rw-r--r--test/py/tests/test_efi_secboot/test_signed.py10
-rw-r--r--test/py/tests/test_fpga.py12
-rw-r--r--test/py/tests/test_help.py6
-rw-r--r--test/py/tests/test_log.py11
-rw-r--r--test/py/tests/test_net.py5
-rw-r--r--test/py/tests/test_net_boot.py5
-rw-r--r--test/py/tests/test_trace.py6
-rw-r--r--test/py/tests/test_ut.py80
-rw-r--r--test/py/u_boot_console_sandbox.py2
-rw-r--r--test/py/u_boot_spawn.py10
36 files changed, 247 insertions, 73 deletions
diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c
index 6e94000..1bf5929 100644
--- a/test/boot/bootdev.c
+++ b/test/boot/bootdev.c
@@ -680,7 +680,6 @@ static int bootdev_test_next_label(struct unit_test_state *uts)
BOOTSTD_TEST(bootdev_test_next_label, UT_TESTF_DM | UT_TESTF_SCAN_FDT |
UT_TESTF_ETH_BOOTDEV | UT_TESTF_SF_BOOTDEV);
-
/* Check iterating to the next prioirty in a list */
static int bootdev_test_next_prio(struct unit_test_state *uts)
{
diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c
index 4511cfa..8b46256 100644
--- a/test/boot/bootflow.c
+++ b/test/boot/bootflow.c
@@ -27,6 +27,7 @@
DECLARE_GLOBAL_DATA_PTR;
+extern U_BOOT_DRIVER(bootmeth_android);
extern U_BOOT_DRIVER(bootmeth_cros);
extern U_BOOT_DRIVER(bootmeth_2script);
@@ -518,12 +519,12 @@ BOOTSTD_TEST(bootflow_cmd_boot, UT_TESTF_DM | UT_TESTF_SCAN_FDT);
* @uts: Unit test state
* @mmc_dev: MMC device to use, e.g. "mmc4". Note that this must remain valid
* in the caller until
- * @bind_cros: true to bind the ChromiumOS bootmeth
+ * @bind_cros: true to bind the ChromiumOS and Android bootmeths
* @old_orderp: Returns the original bootdev order, which must be restored
* Returns 0 on success, -ve on failure
*/
static int prep_mmc_bootdev(struct unit_test_state *uts, const char *mmc_dev,
- bool bind_cros, const char ***old_orderp)
+ bool bind_cros_android, const char ***old_orderp)
{
static const char *order[] = {"mmc2", "mmc1", NULL, NULL};
struct udevice *dev, *bootstd;
@@ -545,12 +546,19 @@ static int prep_mmc_bootdev(struct unit_test_state *uts, const char *mmc_dev,
"bootmeth_script", 0, ofnode_null(), &dev));
/* Enable the cros bootmeth if needed */
- if (IS_ENABLED(CONFIG_BOOTMETH_CROS) && bind_cros) {
+ if (IS_ENABLED(CONFIG_BOOTMETH_CROS) && bind_cros_android) {
ut_assertok(uclass_first_device_err(UCLASS_BOOTSTD, &bootstd));
ut_assertok(device_bind(bootstd, DM_DRIVER_REF(bootmeth_cros),
"cros", 0, ofnode_null(), &dev));
}
+ /* Enable the android bootmeths if needed */
+ if (IS_ENABLED(CONFIG_BOOTMETH_ANDROID) && bind_cros_android) {
+ ut_assertok(uclass_first_device_err(UCLASS_BOOTSTD, &bootstd));
+ ut_assertok(device_bind(bootstd, DM_DRIVER_REF(bootmeth_android),
+ "android", 0, ofnode_null(), &dev));
+ }
+
/* Change the order to include the device */
std = dev_get_priv(bootstd);
old_order = std->bootdev_order;
@@ -590,6 +598,37 @@ static int scan_mmc_bootdev(struct unit_test_state *uts, const char *mmc_dev,
}
/**
+ * scan_mmc_android_bootdev() - Set up an mmc bootdev so we can access other
+ * distros. Android bootflow might print "ANDROID:*" while scanning
+ *
+ * @uts: Unit test state
+ * @mmc_dev: MMC device to use, e.g. "mmc4"
+ * Returns 0 on success, -ve on failure
+ */
+static int scan_mmc_android_bootdev(struct unit_test_state *uts, const char *mmc_dev)
+{
+ struct bootstd_priv *std;
+ struct udevice *bootstd;
+ const char **old_order;
+
+ ut_assertok(prep_mmc_bootdev(uts, mmc_dev, true, &old_order));
+
+ console_record_reset_enable();
+ ut_assertok(run_command("bootflow scan", 0));
+ /* Android bootflow might print one or two 'ANDROID:*' logs */
+ ut_check_skipline(uts);
+ ut_check_skipline(uts);
+ ut_assert_console_end();
+
+ /* Restore the order used by the device tree */
+ ut_assertok(uclass_first_device_err(UCLASS_BOOTSTD, &bootstd));
+ std = dev_get_priv(bootstd);
+ std->bootdev_order = old_order;
+
+ return 0;
+}
+
+/**
* scan_mmc4_bootdev() - Set up the mmc4 bootdev so we can access a fake Armbian
*
* @uts: Unit test state
@@ -1160,3 +1199,26 @@ static int bootflow_cros(struct unit_test_state *uts)
return 0;
}
BOOTSTD_TEST(bootflow_cros, 0);
+
+/* Test Android bootmeth */
+static int bootflow_android(struct unit_test_state *uts)
+{
+ if (!IS_ENABLED(CONFIG_BOOTMETH_ANDROID))
+ return -EAGAIN;
+
+ ut_assertok(scan_mmc_android_bootdev(uts, "mmc7"));
+ ut_assertok(run_command("bootflow list", 0));
+
+ ut_assert_nextlinen("Showing all");
+ ut_assert_nextlinen("Seq");
+ ut_assert_nextlinen("---");
+ ut_assert_nextlinen(" 0 extlinux");
+ ut_assert_nextlinen(" 1 android ready mmc 0 mmc7.bootdev.whole ");
+ ut_assert_nextlinen("---");
+ ut_assert_skip_to_line("(2 bootflows, 2 valid)");
+
+ ut_assert_console_end();
+
+ return 0;
+}
+BOOTSTD_TEST(bootflow_android, 0);
diff --git a/test/cmd/fdt.c b/test/cmd/fdt.c
index a0faf5a..e09a929 100644
--- a/test/cmd/fdt.c
+++ b/test/cmd/fdt.c
@@ -1346,6 +1346,10 @@ 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) &&
+ !IS_ENABLED(CONFIG_MEASURED_BOOT) &&
+ !IS_ENABLED(CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT))
+ ut_assert_nextlinen("\tkaslr-seed = ");
ut_assert_nextline("};");
ut_assertok(ut_check_console_end(uts));
@@ -1362,6 +1366,10 @@ 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) &&
+ !IS_ENABLED(CONFIG_MEASURED_BOOT) &&
+ !IS_ENABLED(CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT))
+ ut_assert_nextlinen("\tkaslr-seed = ");
ut_assert_nextline("};");
ut_assertok(ut_check_console_end(uts));
diff --git a/test/cmd/setexpr.c b/test/cmd/setexpr.c
index d50ce58..4c6cc3c 100644
--- a/test/cmd/setexpr.c
+++ b/test/cmd/setexpr.c
@@ -329,7 +329,6 @@ static int setexpr_test_str(struct unit_test_state *uts)
}
SETEXPR_TEST(setexpr_test_str, UT_TESTF_CONSOLE_REC);
-
/* Test 'setexpr' command with concatenating strings */
static int setexpr_test_str_oper(struct unit_test_state *uts)
{
diff --git a/test/compression.c b/test/compression.c
index aa1d38b..618a193 100644
--- a/test/compression.c
+++ b/test/compression.c
@@ -139,7 +139,6 @@ static const char zstd_compressed[] =
"\x01\xe4\xf4\x6e\xfa";
static const unsigned long zstd_compressed_size = sizeof(zstd_compressed) - 1;
-
#define TEST_BUFFER_SIZE 512
typedef int (*mutate_func)(struct unit_test_state *uts, void *, unsigned long,
diff --git a/test/dm/acpi.c b/test/dm/acpi.c
index 4db2171..7da381f 100644
--- a/test/dm/acpi.c
+++ b/test/dm/acpi.c
@@ -236,7 +236,6 @@ static int dm_test_acpi_fill_header(struct unit_test_state *uts)
hdr.length = 0x11;
hdr.revision = 0x22;
hdr.checksum = 0x33;
- hdr.creator_revision = 0x44;
acpi_fill_header(&hdr, "ABCD");
ut_asserteq_mem("ABCD", hdr.signature, sizeof(hdr.signature));
@@ -248,7 +247,7 @@ static int dm_test_acpi_fill_header(struct unit_test_state *uts)
sizeof(hdr.oem_table_id));
ut_asserteq(OEM_REVISION, hdr.oem_revision);
ut_asserteq_mem(ASLC_ID, hdr.creator_id, sizeof(hdr.creator_id));
- ut_asserteq(0x44, hdr.creator_revision);
+ ut_asserteq(ASL_REVISION, hdr.creator_revision);
return 0;
}
diff --git a/test/dm/bus.c b/test/dm/bus.c
index a338c7f..95326f2 100644
--- a/test/dm/bus.c
+++ b/test/dm/bus.c
@@ -14,6 +14,7 @@
#include <dm/test.h>
#include <dm/uclass-internal.h>
#include <dm/util.h>
+#include <linux/list.h>
#include <test/test.h>
#include <test/ut.h>
@@ -27,14 +28,14 @@ static int dm_test_bus_children(struct unit_test_state *uts)
struct uclass *uc;
ut_assertok(uclass_get(UCLASS_TEST_FDT, &uc));
- ut_asserteq(num_devices, list_count_items(&uc->dev_head));
+ ut_asserteq(num_devices, list_count_nodes(&uc->dev_head));
/* Probe the bus, which should yield 3 more devices */
ut_assertok(uclass_get_device(UCLASS_TEST_BUS, 0, &bus));
num_devices += 3;
ut_assertok(uclass_get(UCLASS_TEST_FDT, &uc));
- ut_asserteq(num_devices, list_count_items(&uc->dev_head));
+ ut_asserteq(num_devices, list_count_nodes(&uc->dev_head));
ut_assert(!dm_check_devices(uts, num_devices));
diff --git a/test/dm/core.c b/test/dm/core.c
index 4741c81..5bc5e8e 100644
--- a/test/dm/core.c
+++ b/test/dm/core.c
@@ -16,6 +16,7 @@
#include <dm/util.h>
#include <dm/test.h>
#include <dm/uclass-internal.h>
+#include <linux/list.h>
#include <test/test.h>
#include <test/ut.h>
@@ -123,15 +124,15 @@ static int dm_test_autobind(struct unit_test_state *uts)
* device with no children.
*/
ut_assert(uts->root);
- ut_asserteq(1, list_count_items(gd->uclass_root));
- ut_asserteq(0, list_count_items(&gd->dm_root->child_head));
+ ut_asserteq(1, list_count_nodes(gd->uclass_root));
+ ut_asserteq(0, list_count_nodes(&gd->dm_root->child_head));
ut_asserteq(0, dm_testdrv_op_count[DM_TEST_OP_POST_BIND]);
ut_assertok(dm_scan_plat(false));
/* We should have our test class now at least, plus more children */
- ut_assert(1 < list_count_items(gd->uclass_root));
- ut_assert(0 < list_count_items(&gd->dm_root->child_head));
+ ut_assert(1 < list_count_nodes(gd->uclass_root));
+ ut_assert(0 < list_count_nodes(&gd->dm_root->child_head));
/* Our 3 dm_test_infox children should be bound to the test uclass */
ut_asserteq(3, dm_testdrv_op_count[DM_TEST_OP_POST_BIND]);
@@ -1006,7 +1007,6 @@ static int dm_test_uclass_before_ready(struct unit_test_state *uts)
ut_assertok(uclass_get(UCLASS_TEST, &uc));
gd->dm_root = NULL;
- gd->dm_root_f = NULL;
memset(&gd->uclass_root, '\0', sizeof(gd->uclass_root));
ut_asserteq_ptr(NULL, uclass_find(UCLASS_TEST));
diff --git a/test/dm/cpu.c b/test/dm/cpu.c
index acba810..8af2531 100644
--- a/test/dm/cpu.c
+++ b/test/dm/cpu.c
@@ -43,6 +43,8 @@ static int dm_test_cpu(struct unit_test_state *uts)
ut_assertok(cpu_get_vendor(dev, text, sizeof(text)));
ut_assertok(strcmp(text, "Languid Example Garbage Inc."));
+ ut_assertok(cpu_release_core(dev, 0));
+
return 0;
}
diff --git a/test/dm/devres.c b/test/dm/devres.c
index 95a470b..7a3a669 100644
--- a/test/dm/devres.c
+++ b/test/dm/devres.c
@@ -69,7 +69,6 @@ static int dm_test_devres_free(struct unit_test_state *uts)
}
DM_TEST(dm_test_devres_free, UT_TESTF_SCAN_PDATA);
-
/* Test that kzalloc() returns memory that is zeroed */
static int dm_test_devres_kzalloc(struct unit_test_state *uts)
{
diff --git a/test/dm/fwu_mdata.c b/test/dm/fwu_mdata.c
index 0be7f45..6154480 100644
--- a/test/dm/fwu_mdata.c
+++ b/test/dm/fwu_mdata.c
@@ -129,7 +129,6 @@ static int dm_test_fwu_mdata_write(struct unit_test_state *uts)
*/
event_notify_null(EVT_MAIN_LOOP);
-
ut_assertok(uclass_first_device_err(UCLASS_FWU_MDATA, &dev));
ut_assertok(fwu_init());
diff --git a/test/dm/remoteproc.c b/test/dm/remoteproc.c
index ef9e8e5..444c4dc 100644
--- a/test/dm/remoteproc.c
+++ b/test/dm/remoteproc.c
@@ -28,7 +28,6 @@ static int dm_test_remoteproc_base(struct unit_test_state *uts)
/* Ensure we are initialized */
ut_asserteq(true, rproc_is_initialized());
-
/* platform data device 1 */
ut_assertok(rproc_stop(0));
ut_assertok(rproc_reset(0));
diff --git a/test/dm/spmi.c b/test/dm/spmi.c
index e10ae8d..ee444f3 100644
--- a/test/dm/spmi.c
+++ b/test/dm/spmi.c
@@ -70,7 +70,6 @@ static int dm_test_spmi_access(struct unit_test_state *uts)
}
DM_TEST(dm_test_spmi_access, UT_TESTF_SCAN_FDT);
-
/* Test if it's possible to access GPIO that should be in pmic */
static int dm_test_spmi_access_peripheral(struct unit_test_state *uts)
{
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
index 18c89ee..31effff 100644
--- a/test/dm/test-fdt.c
+++ b/test/dm/test-fdt.c
@@ -19,6 +19,7 @@
#include <dm/util.h>
#include <dm/of_access.h>
#include <linux/ioport.h>
+#include <linux/list.h>
#include <test/test.h>
#include <test/ut.h>
@@ -162,7 +163,7 @@ static int dm_test_fdt(struct unit_test_state *uts)
ut_assert(!ret);
/* These are num_devices compatible root-level device tree nodes */
- ut_asserteq(num_devices, list_count_items(&uc->dev_head));
+ ut_asserteq(num_devices, list_count_nodes(&uc->dev_head));
/* Each should have platform data but no private data */
for (i = 0; i < num_devices; i++) {
@@ -217,7 +218,7 @@ static int dm_test_fdt_pre_reloc(struct unit_test_state *uts)
* one with "bootph-all" property (a-test node), and the other
* one whose driver marked with DM_FLAG_PRE_RELOC flag (h-test node).
*/
- ut_asserteq(2, list_count_items(&uc->dev_head));
+ ut_asserteq(2, list_count_nodes(&uc->dev_head));
return 0;
}
diff --git a/test/dm/usb.c b/test/dm/usb.c
index 9a57193..0bbea21 100644
--- a/test/dm/usb.c
+++ b/test/dm/usb.c
@@ -423,7 +423,6 @@ static int dm_test_usb_keyb(struct unit_test_state *uts)
{0x00, 0x00, "\0"}
};
-
state_set_skip_delays(true);
ut_assertok(usb_init());
diff --git a/test/overlay/Makefile b/test/overlay/Makefile
index 2deec92..47937e3 100644
--- a/test/overlay/Makefile
+++ b/test/overlay/Makefile
@@ -10,5 +10,5 @@ DTC_FLAGS += -@
# DT overlays
obj-y += test-fdt-base.dtb.o
-obj-y += test-fdt-overlay.dtb.o
-obj-y += test-fdt-overlay-stacked.dtb.o
+obj-y += test-fdt-overlay.dtbo.o
+obj-y += test-fdt-overlay-stacked.dtbo.o
diff --git a/test/overlay/cmd_ut_overlay.c b/test/overlay/cmd_ut_overlay.c
index bcb29a2..256afd1 100644
--- a/test/overlay/cmd_ut_overlay.c
+++ b/test/overlay/cmd_ut_overlay.c
@@ -21,8 +21,8 @@
#define FDT_COPY_SIZE (4 * SZ_1K)
extern u32 __dtb_test_fdt_base_begin;
-extern u32 __dtb_test_fdt_overlay_begin;
-extern u32 __dtb_test_fdt_overlay_stacked_begin;
+extern u32 __dtbo_test_fdt_overlay_begin;
+extern u32 __dtbo_test_fdt_overlay_stacked_begin;
static void *fdt;
@@ -216,8 +216,8 @@ int do_ut_overlay(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
const int n_ents = UNIT_TEST_SUITE_COUNT(overlay_test);
struct unit_test_state *uts;
void *fdt_base = &__dtb_test_fdt_base_begin;
- void *fdt_overlay = &__dtb_test_fdt_overlay_begin;
- void *fdt_overlay_stacked = &__dtb_test_fdt_overlay_stacked_begin;
+ void *fdt_overlay = &__dtbo_test_fdt_overlay_begin;
+ void *fdt_overlay_stacked = &__dtbo_test_fdt_overlay_stacked_begin;
void *fdt_overlay_copy, *fdt_overlay_stacked_copy;
int ret = -ENOMEM;
diff --git a/test/overlay/test-fdt-overlay-stacked.dts b/test/overlay/test-fdt-overlay-stacked.dtso
index 6411ade..6411ade 100644
--- a/test/overlay/test-fdt-overlay-stacked.dts
+++ b/test/overlay/test-fdt-overlay-stacked.dtso
diff --git a/test/overlay/test-fdt-overlay.dts b/test/overlay/test-fdt-overlay.dtso
index 5a21b34..5a21b34 100644
--- a/test/overlay/test-fdt-overlay.dts
+++ b/test/overlay/test-fdt-overlay.dtso
diff --git a/test/py/requirements.txt b/test/py/requirements.txt
index 0f67c3c..2b14898 100644
--- a/test/py/requirements.txt
+++ b/test/py/requirements.txt
@@ -20,11 +20,11 @@ pytest==6.2.5
pytest-xdist==2.5.0
python-mimeparse==1.6.0
python-subunit==1.3.0
-requests==2.31.0
-setuptools==65.5.1
+requests==2.32.2
+setuptools==70.3.0
six==1.16.0
testtools==2.3.0
traceback2==1.4.0
unittest2==1.1.0
wcwidth==0.1.7
-zipp==0.6.0
+zipp==3.19.2
diff --git a/test/py/tests/test_dm.py b/test/py/tests/test_dm.py
index 68d4ea1..be94971 100644
--- a/test/py/tests/test_dm.py
+++ b/test/py/tests/test_dm.py
@@ -13,8 +13,11 @@ def test_dm_compat(u_boot_console):
for line in response[:-1].split('\n')[2:])
response = u_boot_console.run_command('dm compat')
+ bad_drivers = set()
for driver in drivers:
- assert driver in response
+ if not driver in response:
+ bad_drivers.add(driver)
+ assert not bad_drivers
# check sorting - output looks something like this:
# testacpi 0 [ ] testacpi_drv |-- acpi-test
diff --git a/test/py/tests/test_efi_capsule/conftest.py b/test/py/tests/test_efi_capsule/conftest.py
index 80b1297..61eab51 100644
--- a/test/py/tests/test_efi_capsule/conftest.py
+++ b/test/py/tests/test_efi_capsule/conftest.py
@@ -53,7 +53,7 @@ def efi_capsule_data(request, u_boot_config):
# Update dtb to add the version information
check_call('cd %s; '
- 'cp %s/test/py/tests/test_efi_capsule/version.dts .'
+ 'cp %s/test/py/tests/test_efi_capsule/version.dtso .'
% (data_dir, u_boot_config.source_dir), shell=True)
if capsule_auth_enabled:
@@ -61,13 +61,13 @@ def efi_capsule_data(request, u_boot_config):
'cp %s/arch/sandbox/dts/test.dtb test_sig.dtb'
% (data_dir, u_boot_config.build_dir), shell=True)
check_call('cd %s; '
- 'dtc -@ -I dts -O dtb -o version.dtbo version.dts; '
+ 'dtc -@ -I dts -O dtb -o version.dtbo version.dtso; '
'fdtoverlay -i test_sig.dtb '
'-o test_ver.dtb version.dtbo'
% (data_dir), shell=True)
else:
check_call('cd %s; '
- 'dtc -@ -I dts -O dtb -o version.dtbo version.dts; '
+ 'dtc -@ -I dts -O dtb -o version.dtbo version.dtso; '
'fdtoverlay -i %s/arch/sandbox/dts/test.dtb '
'-o test_ver.dtb version.dtbo'
% (data_dir, u_boot_config.build_dir), shell=True)
diff --git a/test/py/tests/test_efi_capsule/test_capsule_firmware_raw.py b/test/py/tests/test_efi_capsule/test_capsule_firmware_raw.py
index a5b5c8a..f3a2dff 100644
--- a/test/py/tests/test_efi_capsule/test_capsule_firmware_raw.py
+++ b/test/py/tests/test_efi_capsule/test_capsule_firmware_raw.py
@@ -76,7 +76,7 @@ class TestEfiCapsuleFirmwareRaw:
self, u_boot_config, u_boot_console, efi_capsule_data):
""" Test Case 2
Update U-Boot and U-Boot environment on SPI Flash but with OsIndications unset
- No update should happen
+ No update should happen unless CONFIG_EFI_IGNORE_OSINDICATIONS is set
0x100000-0x150000: U-Boot binary (but dummy)
0x150000-0x200000: U-Boot environment (but dummy)
"""
@@ -91,16 +91,27 @@ class TestEfiCapsuleFirmwareRaw:
# reboot
u_boot_console.restart_uboot()
+ ignore_os_indications = u_boot_config.buildconfig.get(
+ 'config_efi_ignore_osindications')
+ need_reboot = True if ignore_os_indications else False
+
+ capsule_auth = u_boot_config.buildconfig.get(
+ 'config_efi_capsule_authenticate')
+
capsule_early = u_boot_config.buildconfig.get(
'config_efi_capsule_on_disk_early')
with u_boot_console.log.section('Test Case 2-b, after reboot'):
if not capsule_early:
- exec_manual_update(u_boot_console, disk_img, capsule_files, False)
+ exec_manual_update(u_boot_console, disk_img, capsule_files, need_reboot)
- check_file_exist(u_boot_console, disk_img, capsule_files)
+ if not ignore_os_indications:
+ check_file_exist(u_boot_console, disk_img, capsule_files)
- verify_content(u_boot_console, '100000', 'u-boot:Old')
- verify_content(u_boot_console, '150000', 'u-boot-env:Old')
+ expected = 'u-boot:New' if (ignore_os_indications and not capsule_auth) else 'u-boot:Old'
+ verify_content(u_boot_console, '100000', expected)
+
+ expected = 'u-boot-env:New' if (ignore_os_indications and not capsule_auth) else 'u-boot-env:Old'
+ verify_content(u_boot_console, '150000', expected)
def test_efi_capsule_fw3(
self, u_boot_config, u_boot_console, efi_capsule_data):
diff --git a/test/py/tests/test_efi_capsule/version.dts b/test/py/tests/test_efi_capsule/version.dtso
index 07850cc..07850cc 100644
--- a/test/py/tests/test_efi_capsule/version.dts
+++ b/test/py/tests/test_efi_capsule/version.dtso
diff --git a/test/py/tests/test_efi_secboot/conftest.py b/test/py/tests/test_efi_secboot/conftest.py
index ff7ac7c..0fa0747 100644
--- a/test/py/tests/test_efi_secboot/conftest.py
+++ b/test/py/tests/test_efi_secboot/conftest.py
@@ -64,6 +64,12 @@ def efi_boot_env(request, u_boot_config):
check_call('cd %s; %scert-to-efi-sig-list -g %s db1.crt db1.esl; %ssign-efi-sig-list -t "2020-04-05" -c KEK.crt -k KEK.key db db1.esl db1.auth'
% (mnt_point, EFITOOLS_PATH, GUID, EFITOOLS_PATH),
shell=True)
+ # db2 (APPEND_WRITE)
+ check_call('cd %s; openssl req -x509 -sha256 -newkey rsa:2048 -subj /CN=TEST_db2/ -keyout db2.key -out db2.crt -nodes -days 365'
+ % mnt_point, shell=True)
+ check_call('cd %s; %scert-to-efi-sig-list -g %s db2.crt db2.esl; %ssign-efi-sig-list -a -c KEK.crt -k KEK.key db db2.esl db2.auth'
+ % (mnt_point, EFITOOLS_PATH, GUID, EFITOOLS_PATH),
+ shell=True)
# dbx (TEST_dbx certificate)
check_call('cd %s; openssl req -x509 -sha256 -newkey rsa:2048 -subj /CN=TEST_dbx/ -keyout dbx.key -out dbx.crt -nodes -days 365'
% mnt_point, shell=True)
@@ -84,6 +90,10 @@ def efi_boot_env(request, u_boot_config):
check_call('cd %s; %scert-to-efi-hash-list -g %s -s 256 db1.crt dbx_hash1.crl; %ssign-efi-sig-list -t "2020-04-06" -c KEK.crt -k KEK.key dbx dbx_hash1.crl dbx_hash1.auth'
% (mnt_point, EFITOOLS_PATH, GUID, EFITOOLS_PATH),
shell=True)
+ # dbx_hash2 (digest of TEST_db2 certificate, with APPEND_WRITE)
+ check_call('cd %s; %scert-to-efi-hash-list -g %s -s 256 db2.crt dbx_hash2.crl; %ssign-efi-sig-list -a -c KEK.crt -k KEK.key dbx dbx_hash2.crl dbx_hash2.auth'
+ % (mnt_point, EFITOOLS_PATH, GUID, EFITOOLS_PATH),
+ shell=True)
# dbx_db (with TEST_db certificate)
check_call('cd %s; %ssign-efi-sig-list -t "2020-04-05" -c KEK.crt -k KEK.key dbx db.esl dbx_db.auth'
% (mnt_point, EFITOOLS_PATH),
diff --git a/test/py/tests/test_efi_secboot/test_authvar.py b/test/py/tests/test_efi_secboot/test_authvar.py
index f99b827..d5aeb65 100644
--- a/test/py/tests/test_efi_secboot/test_authvar.py
+++ b/test/py/tests/test_efi_secboot/test_authvar.py
@@ -183,7 +183,7 @@ class TestEfiAuthVar(object):
assert 'db:' in ''.join(output)
output = u_boot_console.run_command_list([
- 'fatload host 0:1 4000000 db1.auth',
+ 'fatload host 0:1 4000000 db2.auth',
'setenv -e -nv -bs -rt -a -i 4000000:$filesize db'])
assert 'Failed to set EFI variable' in ''.join(output)
@@ -197,7 +197,7 @@ class TestEfiAuthVar(object):
with u_boot_console.log.section('Test Case 3c'):
# Test Case 3c, update with correct signature
output = u_boot_console.run_command_list([
- 'fatload host 0:1 4000000 db1.auth',
+ 'fatload host 0:1 4000000 db2.auth',
'setenv -e -nv -bs -rt -at -a -i 4000000:$filesize db',
'printenv -e -n -guid d719b2cb-3d3a-4596-a3bc-dad00e67656f db'])
assert 'Failed to set EFI variable' not in ''.join(output)
diff --git a/test/py/tests/test_efi_secboot/test_signed.py b/test/py/tests/test_efi_secboot/test_signed.py
index 5000a4a..f604138 100644
--- a/test/py/tests/test_efi_secboot/test_signed.py
+++ b/test/py/tests/test_efi_secboot/test_signed.py
@@ -177,7 +177,7 @@ class TestEfiSignedImage(object):
with u_boot_console.log.section('Test Case 5b'):
# Test Case 5b, authenticated if both signatures are verified
output = u_boot_console.run_command_list([
- 'fatload host 0:1 4000000 db1.auth',
+ 'fatload host 0:1 4000000 db2.auth',
'setenv -e -nv -bs -rt -at -a -i 4000000:$filesize db'])
assert 'Failed to set EFI variable' not in ''.join(output)
output = u_boot_console.run_command_list([
@@ -201,7 +201,7 @@ class TestEfiSignedImage(object):
with u_boot_console.log.section('Test Case 5d'):
# Test Case 5d, rejected if both of signatures are revoked
output = u_boot_console.run_command_list([
- 'fatload host 0:1 4000000 dbx_hash1.auth',
+ 'fatload host 0:1 4000000 dbx_hash2.auth',
'setenv -e -nv -bs -rt -at -a -i 4000000:$filesize dbx'])
assert 'Failed to set EFI variable' not in ''.join(output)
output = u_boot_console.run_command_list([
@@ -223,7 +223,7 @@ class TestEfiSignedImage(object):
'setenv -e -nv -bs -rt -at -i 4000000:$filesize KEK',
'fatload host 0:1 4000000 PK.auth',
'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK',
- 'fatload host 0:1 4000000 db1.auth',
+ 'fatload host 0:1 4000000 db2.auth',
'setenv -e -nv -bs -rt -at -a -i 4000000:$filesize db',
'fatload host 0:1 4000000 dbx_hash1.auth',
'setenv -e -nv -bs -rt -at -i 4000000:$filesize dbx'])
@@ -300,7 +300,7 @@ class TestEfiSignedImage(object):
'setenv -e -nv -bs -rt -at -i 4000000:$filesize KEK',
'fatload host 0:1 4000000 PK.auth',
'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK',
- 'fatload host 0:1 4000000 db1.auth',
+ 'fatload host 0:1 4000000 db2.auth',
'setenv -e -nv -bs -rt -at -a -i 4000000:$filesize db',
'fatload host 0:1 4000000 dbx_hash384.auth',
'setenv -e -nv -bs -rt -at -i 4000000:$filesize dbx'])
@@ -323,7 +323,7 @@ class TestEfiSignedImage(object):
'setenv -e -nv -bs -rt -at -i 4000000:$filesize KEK',
'fatload host 0:1 4000000 PK.auth',
'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK',
- 'fatload host 0:1 4000000 db1.auth',
+ 'fatload host 0:1 4000000 db2.auth',
'setenv -e -nv -bs -rt -at -a -i 4000000:$filesize db',
'fatload host 0:1 4000000 dbx_hash512.auth',
'setenv -e -nv -bs -rt -at -i 4000000:$filesize dbx'])
diff --git a/test/py/tests/test_fpga.py b/test/py/tests/test_fpga.py
index ca7ef8e..460ff22 100644
--- a/test/py/tests/test_fpga.py
+++ b/test/py/tests/test_fpga.py
@@ -256,7 +256,7 @@ def test_fpga_loadbp(u_boot_console):
@pytest.mark.buildconfigspec('cmd_fpga')
@pytest.mark.buildconfigspec('cmd_fpga_loadmk')
@pytest.mark.buildconfigspec('cmd_echo')
-@pytest.mark.buildconfigspec('image_format_legacy')
+@pytest.mark.buildconfigspec('legacy_image_format')
def test_fpga_loadmk_fail(u_boot_console):
f, dev, addr, bit, bit_size = load_file_from_var(u_boot_console, 'mkimage_legacy')
@@ -275,7 +275,7 @@ def test_fpga_loadmk_fail(u_boot_console):
@pytest.mark.buildconfigspec('cmd_fpga')
@pytest.mark.buildconfigspec('cmd_fpga_loadmk')
@pytest.mark.buildconfigspec('cmd_echo')
-@pytest.mark.buildconfigspec('image_format_legacy')
+@pytest.mark.buildconfigspec('legacy_image_format')
def test_fpga_loadmk_legacy(u_boot_console):
f, dev, addr, bit, bit_size = load_file_from_var(u_boot_console, 'mkimage_legacy')
@@ -289,7 +289,7 @@ def test_fpga_loadmk_legacy(u_boot_console):
@pytest.mark.buildconfigspec('cmd_fpga')
@pytest.mark.buildconfigspec('cmd_fpga_loadmk')
@pytest.mark.buildconfigspec('cmd_echo')
-@pytest.mark.buildconfigspec('image_format_legacy')
+@pytest.mark.buildconfigspec('legacy_image_format')
def test_fpga_loadmk_legacy_variable_fpga(u_boot_console):
f, dev, addr, bit, bit_size = load_file_from_var(u_boot_console, 'mkimage_legacy')
@@ -306,7 +306,7 @@ def test_fpga_loadmk_legacy_variable_fpga(u_boot_console):
@pytest.mark.buildconfigspec('cmd_fpga')
@pytest.mark.buildconfigspec('cmd_fpga_loadmk')
@pytest.mark.buildconfigspec('cmd_echo')
-@pytest.mark.buildconfigspec('image_format_legacy')
+@pytest.mark.buildconfigspec('legacy_image_format')
def test_fpga_loadmk_legacy_variable_fpgadata(u_boot_console):
f, dev, addr, bit, bit_size = load_file_from_var(u_boot_console, 'mkimage_legacy')
@@ -323,7 +323,7 @@ def test_fpga_loadmk_legacy_variable_fpgadata(u_boot_console):
@pytest.mark.buildconfigspec('cmd_fpga')
@pytest.mark.buildconfigspec('cmd_fpga_loadmk')
@pytest.mark.buildconfigspec('cmd_echo')
-@pytest.mark.buildconfigspec('image_format_legacy')
+@pytest.mark.buildconfigspec('legacy_image_format')
def test_fpga_loadmk_legacy_variable(u_boot_console):
f, dev, addr, bit, bit_size = load_file_from_var(u_boot_console, 'mkimage_legacy')
@@ -342,7 +342,7 @@ def test_fpga_loadmk_legacy_variable(u_boot_console):
@pytest.mark.buildconfigspec('cmd_fpga')
@pytest.mark.buildconfigspec('cmd_fpga_loadmk')
@pytest.mark.buildconfigspec('cmd_echo')
-@pytest.mark.buildconfigspec('image_format_legacy')
+@pytest.mark.buildconfigspec('legacy_image_format')
@pytest.mark.buildconfigspec('gzip')
def test_fpga_loadmk_legacy_gz(u_boot_console):
f, dev, addr, bit, bit_size = load_file_from_var(u_boot_console, 'mkimage_legacy_gz')
diff --git a/test/py/tests/test_help.py b/test/py/tests/test_help.py
index 153133c..2325ff6 100644
--- a/test/py/tests/test_help.py
+++ b/test/py/tests/test_help.py
@@ -7,7 +7,11 @@ import pytest
def test_help(u_boot_console):
"""Test that the "help" command can be executed."""
- u_boot_console.run_command('help')
+ lines = u_boot_console.run_command('help')
+ if u_boot_console.config.buildconfig.get('config_cmd_2048', 'n') == 'y':
+ assert lines.splitlines()[0] == "2048 - The 2048 game"
+ else:
+ assert lines.splitlines()[0] == "? - alias for 'help'"
@pytest.mark.boardspec('sandbox')
def test_help_no_devicetree(u_boot_console):
diff --git a/test/py/tests/test_log.py b/test/py/tests/test_log.py
index 140dcb9..7980867 100644
--- a/test/py/tests/test_log.py
+++ b/test/py/tests/test_log.py
@@ -27,13 +27,16 @@ def test_log_format(u_boot_console):
cons = u_boot_console
with cons.log.section('format'):
- run_with_format('all', 'NOTICE.arch,file.c:123-func() msg')
+ pad = int(u_boot_console.config.buildconfig.get('config_logf_func_pad'))
+ padding = ' ' * (pad - len('func'))
+
+ run_with_format('all', f'NOTICE.arch,file.c:123-{padding}func() msg')
output = cons.run_command('log format')
assert output == 'Log format: clFLfm'
- run_with_format('fm', 'func() msg')
- run_with_format('clfm', 'NOTICE.arch,func() msg')
- run_with_format('FLfm', 'file.c:123-func() msg')
+ run_with_format('fm', f'{padding}func() msg')
+ run_with_format('clfm', f'NOTICE.arch,{padding}func() msg')
+ run_with_format('FLfm', f'file.c:123-{padding}func() msg')
run_with_format('lm', 'NOTICE. msg')
run_with_format('m', 'msg')
diff --git a/test/py/tests/test_net.py b/test/py/tests/test_net.py
index 038a473..ad143c1 100644
--- a/test/py/tests/test_net.py
+++ b/test/py/tests/test_net.py
@@ -254,7 +254,7 @@ def test_net_network_discovery(u_boot_console):
assert 'Set gatewayip6:' in output
assert '0000:0000:0000:0000:0000:0000:0000:0000' not in output
-@pytest.mark.buildconfigspec('cmd_net')
+@pytest.mark.buildconfigspec('cmd_tftpboot')
def test_net_tftpboot(u_boot_console):
"""Test the tftpboot command.
@@ -335,7 +335,6 @@ def test_net_nfs(u_boot_console):
output = u_boot_console.run_command('crc32 %x $filesize' % addr)
assert expected_crc in output
-@pytest.mark.buildconfigspec("cmd_net")
@pytest.mark.buildconfigspec("cmd_pxe")
def test_net_pxe_get(u_boot_console):
"""Test the pxe get command.
@@ -391,7 +390,7 @@ def test_net_pxe_get(u_boot_console):
assert "Config file 'default.boot' found" in output
@pytest.mark.buildconfigspec("cmd_crc32")
-@pytest.mark.buildconfigspec("cmd_net")
+@pytest.mark.buildconfigspec("cmd_tftpboot")
@pytest.mark.buildconfigspec("cmd_tftpput")
def test_net_tftpput(u_boot_console):
"""Test the tftpput command.
diff --git a/test/py/tests/test_net_boot.py b/test/py/tests/test_net_boot.py
index 4729ccf..63309fe 100644
--- a/test/py/tests/test_net_boot.py
+++ b/test/py/tests/test_net_boot.py
@@ -156,7 +156,7 @@ def setup_tftpboot_boot(u_boot_console):
return addr, timeout, pattern, chk_type, chk_pattern, config
-@pytest.mark.buildconfigspec('cmd_net')
+@pytest.mark.buildconfigspec('cmd_tftpboot')
def test_net_tftpboot_boot(u_boot_console):
"""Boot the loaded image
@@ -209,7 +209,6 @@ def setup_pxe_boot(u_boot_console):
return f, bootfile
-@pytest.mark.buildconfigspec('cmd_net')
@pytest.mark.buildconfigspec('cmd_pxe')
def test_net_pxe_boot(u_boot_console):
"""Test the pxe boot command.
@@ -261,7 +260,6 @@ def test_net_pxe_boot(u_boot_console):
u_boot_console.drain_console()
u_boot_console.cleanup_spawn()
-@pytest.mark.buildconfigspec('cmd_net')
@pytest.mark.buildconfigspec('cmd_pxe')
def test_net_pxe_boot_config(u_boot_console):
"""Test the pxe boot command by selecting different combination of labels
@@ -341,7 +339,6 @@ def test_net_pxe_boot_config(u_boot_console):
u_boot_console.drain_console()
u_boot_console.cleanup_spawn()
-@pytest.mark.buildconfigspec('cmd_net')
@pytest.mark.buildconfigspec('cmd_pxe')
def test_net_pxe_boot_config_invalid(u_boot_console):
"""Test the pxe boot command by selecting invalid label
diff --git a/test/py/tests/test_trace.py b/test/py/tests/test_trace.py
index 7c5696c..ec1e624 100644
--- a/test/py/tests/test_trace.py
+++ b/test/py/tests/test_trace.py
@@ -12,7 +12,7 @@ import u_boot_utils as util
TMPDIR = '/tmp/test_trace'
# Decode a function-graph line
-RE_LINE = re.compile(r'.*0\.\.\.\.\. \s*([0-9.]*): func.*[|](\s*)(\S.*)?([{};])$')
+RE_LINE = re.compile(r'.*0\.\.\.\.\.? \s*([0-9.]*): func.*[|](\s*)(\S.*)?([{};])$')
def collect_trace(cons):
@@ -175,7 +175,7 @@ def check_funcgraph(cons, fname, proftool, map_fname, trace_dat):
# Then look for this:
# u-boot-1 0..... 282.101375: funcgraph_exit: 0.006 us | }
# Then check for this:
- # u-boot-1 0..... 282.101375: funcgraph_entry: 0.000 us | initcall_is_event();
+ # u-boot-1 0..... 282.101375: funcgraph_entry: 0.000 us | calc_reloc_ofs();
expected_indent = None
found_start = False
@@ -199,7 +199,7 @@ def check_funcgraph(cons, fname, proftool, map_fname, trace_dat):
# The next function after initf_bootstage() exits should be
# initcall_is_event()
- assert upto == 'initcall_is_event()'
+ assert upto == 'calc_reloc_ofs()'
# Now look for initf_dm() and dm_timer_init() so we can check the bootstage
# time
diff --git a/test/py/tests/test_ut.py b/test/py/tests/test_ut.py
index c169c83..05e1583 100644
--- a/test/py/tests/test_ut.py
+++ b/test/py/tests/test_ut.py
@@ -11,6 +11,7 @@ import pytest
import u_boot_utils
# pylint: disable=E0611
from tests import fs_helper
+from test_android import test_abootimg
def mkdir_cond(dirname):
"""Create a directory if it doesn't already exist
@@ -423,6 +424,83 @@ def setup_cros_image(cons):
return fname
+def setup_android_image(cons):
+ """Create a 20MB disk image with Android partitions"""
+ Partition = collections.namedtuple('part', 'start,size,name')
+ parts = {}
+ disk_data = None
+
+ def set_part_data(partnum, data):
+ """Set the contents of a disk partition
+
+ This updates disk_data by putting data in the right place
+
+ Args:
+ partnum (int): Partition number to set
+ data (bytes): Data for that partition
+ """
+ nonlocal disk_data
+
+ start = parts[partnum].start * sect_size
+ disk_data = disk_data[:start] + data + disk_data[start + len(data):]
+
+ mmc_dev = 7
+ fname = os.path.join(cons.config.source_dir, f'mmc{mmc_dev}.img')
+ u_boot_utils.run_and_log(cons, 'qemu-img create %s 20M' % fname)
+ u_boot_utils.run_and_log(cons, f'cgpt create {fname}')
+
+ ptr = 40
+
+ # Number of sectors in 1MB
+ sect_size = 512
+ sect_1mb = (1 << 20) // sect_size
+
+ required_parts = [
+ {'num': 1, 'label':'misc', 'size': '1M'},
+ {'num': 2, 'label':'boot_a', 'size': '4M'},
+ {'num': 3, 'label':'boot_b', 'size': '4M'},
+ {'num': 4, 'label':'vendor_boot_a', 'size': '4M'},
+ {'num': 5, 'label':'vendor_boot_b', 'size': '4M'},
+ ]
+
+ for part in required_parts:
+ size_str = part['size']
+ if 'M' in size_str:
+ size = int(size_str[:-1]) * sect_1mb
+ else:
+ size = int(size_str)
+ u_boot_utils.run_and_log(
+ cons,
+ f"cgpt add -i {part['num']} -b {ptr} -s {size} -l {part['label']} -t basicdata {fname}")
+ ptr += size
+
+ u_boot_utils.run_and_log(cons, f'cgpt boot -p {fname}')
+ out = u_boot_utils.run_and_log(cons, f'cgpt show -q {fname}')
+
+ # Create a dict (indexed by partition number) containing the above info
+ for line in out.splitlines():
+ start, size, num, name = line.split(maxsplit=3)
+ parts[int(num)] = Partition(int(start), int(size), name)
+
+ with open(fname, 'rb') as inf:
+ disk_data = inf.read()
+
+ test_abootimg.AbootimgTestDiskImage(cons, 'bootv4.img', test_abootimg.boot_img_hex)
+ boot_img = os.path.join(cons.config.result_dir, 'bootv4.img')
+ with open(boot_img, 'rb') as inf:
+ set_part_data(2, inf.read())
+
+ test_abootimg.AbootimgTestDiskImage(cons, 'vendor_boot.img', test_abootimg.vboot_img_hex)
+ vendor_boot_img = os.path.join(cons.config.result_dir, 'vendor_boot.img')
+ with open(vendor_boot_img, 'rb') as inf:
+ set_part_data(4, inf.read())
+
+ with open(fname, 'wb') as outf:
+ outf.write(disk_data)
+
+ print('wrote to {}'.format(fname))
+
+ return fname
def setup_cedit_file(cons):
infname = os.path.join(cons.config.source_dir,
@@ -470,6 +548,7 @@ def test_ut_dm_init(u_boot_console):
fh.write(data)
@pytest.mark.buildconfigspec('cmd_bootflow')
+@pytest.mark.buildconfigspec('sandbox')
def test_ut_dm_init_bootstd(u_boot_console):
"""Initialise data for bootflow tests"""
@@ -477,6 +556,7 @@ def test_ut_dm_init_bootstd(u_boot_console):
setup_bootmenu_image(u_boot_console)
setup_cedit_file(u_boot_console)
setup_cros_image(u_boot_console)
+ setup_android_image(u_boot_console)
# Restart so that the new mmc1.img is picked up
u_boot_console.restart_uboot()
diff --git a/test/py/u_boot_console_sandbox.py b/test/py/u_boot_console_sandbox.py
index 27c6db8..7bc44c7 100644
--- a/test/py/u_boot_console_sandbox.py
+++ b/test/py/u_boot_console_sandbox.py
@@ -58,7 +58,7 @@ class ConsoleSandbox(ConsoleBase):
if self.use_dtb:
cmd += ['-d', self.config.dtb]
cmd += self.sandbox_flags
- return Spawn(cmd, cwd=self.config.source_dir)
+ return Spawn(cmd, cwd=self.config.source_dir, decode_signal=True)
def restart_uboot_with_flags(self, flags, expect_reset=False, use_dtb=True):
"""Run U-Boot with the given command-line flags
diff --git a/test/py/u_boot_spawn.py b/test/py/u_boot_spawn.py
index 7c48d96..97e95e0 100644
--- a/test/py/u_boot_spawn.py
+++ b/test/py/u_boot_spawn.py
@@ -24,18 +24,20 @@ class Spawn:
output: accumulated output from expect()
"""
- def __init__(self, args, cwd=None):
+ def __init__(self, args, cwd=None, decode_signal=False):
"""Spawn (fork/exec) the sub-process.
Args:
args: array of processs arguments. argv[0] is the command to
execute.
cwd: the directory to run the process in, or None for no change.
+ decode_signal (bool): True to indicate the exception number when
+ something goes wrong
Returns:
Nothing.
"""
-
+ self.decode_signal = decode_signal
self.waited = False
self.exit_code = 0
self.exit_info = ''
@@ -197,12 +199,12 @@ class Spawn:
# With sandbox, try to detect when U-Boot exits when it
# shouldn't and explain why. This is much more friendly than
# just dying with an I/O error
- if err.errno == 5: # Input/output error
+ if self.decode_signal and err.errno == 5: # I/O error
alive, _, info = self.checkalive()
if alive:
raise err
raise ValueError('U-Boot exited with %s' % info)
- raise err
+ raise
if self.logfile_read:
self.logfile_read.write(c)
self.buf += c