summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/cmd/wget.c12
-rw-r--r--test/common/print.c8
-rw-r--r--test/dm/led.c18
-rw-r--r--test/dm/ofnode.c136
-rw-r--r--test/lib/lmb.c22
-rw-r--r--test/py/tests/test_zynqmp_rpu.py84
-rw-r--r--test/py/u_boot_console_base.py7
7 files changed, 218 insertions, 69 deletions
diff --git a/test/cmd/wget.c b/test/cmd/wget.c
index fe26fee54c9..7570c065a10 100644
--- a/test/cmd/wget.c
+++ b/test/cmd/wget.c
@@ -19,7 +19,7 @@
#include <dm/test.h>
#include <dm/device-internal.h>
#include <dm/uclass-internal.h>
-#include <test/lib.h>
+#include <test/cmd.h>
#include <test/test.h>
#include <test/ut.h>
@@ -206,6 +206,10 @@ static int sb_http_handler(struct udevice *dev, void *packet,
static int net_test_wget(struct unit_test_state *uts)
{
+ char *prev_ethact = env_get("ethact");
+ char *prev_ethrotate = env_get("ethrotate");
+ char *prev_loadaddr = env_get("loadaddr");
+
sandbox_eth_set_tx_handler(0, sb_http_handler);
sandbox_eth_set_priv(0, uts);
@@ -223,6 +227,10 @@ static int net_test_wget(struct unit_test_state *uts)
ut_assert_nextline("md5 for 00020000 ... 0002001f ==> 234af48e94b0085060249ecb5942ab57");
ut_assert_console_end();
+ env_set("ethact", prev_ethact);
+ env_set("ethrotate", prev_ethrotate);
+ env_set("loadaddr", prev_loadaddr);
+
return 0;
}
-LIB_TEST(net_test_wget, UTF_CONSOLE);
+CMD_TEST(net_test_wget, UTF_CONSOLE);
diff --git a/test/common/print.c b/test/common/print.c
index 464e425edee..e3711b10809 100644
--- a/test/common/print.c
+++ b/test/common/print.c
@@ -241,7 +241,7 @@ COMMON_TEST(print_display_buffer, UTF_CONSOLE);
static int print_hexdump_line(struct unit_test_state *uts)
{
- char *linebuf;
+ u8 *linebuf;
u8 *buf;
int i;
@@ -254,10 +254,10 @@ static int print_hexdump_line(struct unit_test_state *uts)
linebuf = map_sysmem(0x400, BUF_SIZE);
memset(linebuf, '\xff', BUF_SIZE);
ut_asserteq(-ENOSPC, hexdump_line(0, buf, 1, 0x10, 0, linebuf, 75));
- ut_asserteq(-1, linebuf[0]);
+ ut_asserteq(0xff, linebuf[0]);
ut_asserteq(0x10, hexdump_line(0, buf, 1, 0x10, 0, linebuf, 76));
- ut_asserteq(0, linebuf[75]);
- ut_asserteq(-1, linebuf[76]);
+ ut_asserteq('\0', linebuf[75]);
+ ut_asserteq(0xff, linebuf[76]);
unmap_sysmem(buf);
diff --git a/test/dm/led.c b/test/dm/led.c
index 884f6410b70..e5b86326c3a 100644
--- a/test/dm/led.c
+++ b/test/dm/led.c
@@ -144,7 +144,7 @@ static int dm_test_led_boot(struct unit_test_state *uts)
{
struct udevice *dev
- /* options/u-boot/boot-led is set to "sandbox:green" */
+ /* options/u-boot/boot-led is set to phandle to "sandbox:green" */
ut_assertok(led_get_by_label("sandbox:green", &dev));
ut_asserteq(LEDST_OFF, led_get_state(dev));
ut_assertok(led_boot_on());
@@ -154,14 +154,15 @@ static int dm_test_led_boot(struct unit_test_state *uts)
return 0;
}
+DM_TEST(dm_test_led_boot, UTF_SCAN_PDATA | UTF_SCAN_FDT);
/* Test LED boot blink fallback */
#ifndef CONFIG_LED_BLINK
-static int dm_test_led_boot(struct unit_test_state *uts)
+static int dm_test_led_boot_blink(struct unit_test_state *uts)
{
struct udevice *dev
- /* options/u-boot/boot-led is set to "sandbox:green" */
+ /* options/u-boot/boot-led is set to phandle to "sandbox:green" */
ut_assertok(led_get_by_label("sandbox:green", &dev));
ut_asserteq(LEDST_OFF, led_get_state(dev));
ut_assertok(led_boot_blink());
@@ -171,16 +172,17 @@ static int dm_test_led_boot(struct unit_test_state *uts)
return 0;
}
+DM_TEST(dm_test_led_boot_blink, UTF_SCAN_PDATA | UTF_SCAN_FDT);
#endif
#endif
/* Test LED activity */
#ifdef CONFIG_LED_ACTIVITY
-static int dm_test_led_boot(struct unit_test_state *uts)
+static int dm_test_led_activity(struct unit_test_state *uts)
{
struct udevice *dev
- /* options/u-boot/activity-led is set to "sandbox:red" */
+ /* options/u-boot/activity-led is set to phandle to "sandbox:red" */
ut_assertok(led_get_by_label("sandbox:red", &dev));
ut_asserteq(LEDST_OFF, led_get_state(dev));
ut_assertok(led_activity_on());
@@ -190,14 +192,15 @@ static int dm_test_led_boot(struct unit_test_state *uts)
return 0;
}
+DM_TEST(dm_test_led_activity, UTF_SCAN_PDATA | UTF_SCAN_FDT);
/* Test LED activity blink fallback */
#ifndef CONFIG_LED_BLINK
-static int dm_test_led_boot(struct unit_test_state *uts)
+static int dm_test_led_activityt_blink(struct unit_test_state *uts)
{
struct udevice *dev
- /* options/u-boot/activity-led is set to "sandbox:red" */
+ /* options/u-boot/activity-led is set to phandle to "sandbox:red" */
ut_assertok(led_get_by_label("sandbox:red", &dev));
ut_asserteq(LEDST_OFF, led_get_state(dev));
ut_assertok(led_activity_blink());
@@ -207,5 +210,6 @@ static int dm_test_led_boot(struct unit_test_state *uts)
return 0;
}
+DM_TEST(dm_test_led_activityt_blink, UTF_SCAN_PDATA | UTF_SCAN_FDT);
#endif
#endif
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index ce996567c3c..f16b643fa3f 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -141,9 +141,16 @@ static int dm_test_ofnode_get_by_phandle_ot(struct unit_test_state *uts)
{
oftree otree = get_other_oftree(uts);
ofnode node;
+ u32 idx;
+ int ret;
- ut_assert(ofnode_valid(oftree_get_by_phandle(oftree_default(), 1)));
- node = oftree_get_by_phandle(otree, 1);
+ node = oftree_path(otree, "/node");
+ ut_assert(ofnode_valid(node));
+
+ ret = ofnode_read_u32(node, "other-phandle", &idx);
+ ut_assertok(ret);
+
+ node = oftree_get_by_phandle(otree, idx);
ut_assert(ofnode_valid(node));
ut_asserteq_str("target", ofnode_get_name(node));
@@ -273,15 +280,16 @@ static int dm_test_ofnode_read_ot(struct unit_test_state *uts)
}
DM_TEST(dm_test_ofnode_read_ot, UTF_SCAN_FDT | UTF_OTHER_FDT);
-/* test ofnode_count_/parse_phandle_with_args() */
+/* test ofnode_count_/parse/_phandle_with_args() */
static int dm_test_ofnode_phandle(struct unit_test_state *uts)
{
struct ofnode_phandle_args args;
- ofnode node;
+ ofnode node, phandle, target;
int ret;
const char prop[] = "test-gpios";
const char cell[] = "#gpio-cells";
const char prop2[] = "phandle-value";
+ const char prop3[] = "phandle-nodes";
node = ofnode_path("/a-test");
ut_assert(ofnode_valid(node));
@@ -345,34 +353,117 @@ static int dm_test_ofnode_phandle(struct unit_test_state *uts)
ret = ofnode_parse_phandle_with_args(node, prop2, NULL, 1, 3, &args);
ut_asserteq(-ENOENT, ret);
+ /* Test ofnode_parse_phandle */
+ phandle = ofnode_parse_phandle(node, "missing", 0);
+ ut_assert(ofnode_equal(ofnode_null(), phandle));
+
+ target = ofnode_path("/phandle-node-1");
+ ut_assert(ofnode_valid(target));
+ phandle = ofnode_parse_phandle(node, prop3, 0);
+ ut_assert(ofnode_equal(target, phandle));
+
+ target = ofnode_path("/phandle-node-2");
+ ut_assert(ofnode_valid(target));
+ phandle = ofnode_parse_phandle(node, prop3, 1);
+ ut_assert(ofnode_equal(target, phandle));
+
+ phandle = ofnode_parse_phandle(node, prop3, 3);
+ ut_assert(ofnode_equal(ofnode_null(), phandle));
+
return 0;
}
DM_TEST(dm_test_ofnode_phandle, UTF_SCAN_PDATA | UTF_SCAN_FDT);
-/* test ofnode_count_/parse_phandle_with_args() with 'other' tree */
+/* test oftree_count_/parse/_phandle_with_args() with 'other' tree */
static int dm_test_ofnode_phandle_ot(struct unit_test_state *uts)
{
oftree otree = get_other_oftree(uts);
struct ofnode_phandle_args args;
- ofnode node;
+ ofnode node, phandle, target;
int ret;
+ const char prop[] = "other-test-gpios";
+ const char cell[] = "#gpio-cells";
+ const char prop2[] = "other-phandle-value";
+ const char prop3[] = "other-phandle-nodes";
- node = oftree_path(otree, "/node");
+ node = oftree_path(otree, "/other-a-test");
+ ut_assert(ofnode_valid(node));
- /* Test ofnode_count_phandle_with_args with cell name */
- ret = ofnode_count_phandle_with_args(node, "missing", "#gpio-cells", 0);
+ /* Test oftree_count_phandle_with_args with cell name */
+ ret = oftree_count_phandle_with_args(otree, node, "missing", cell, 0);
+ ut_asserteq(-ENOENT, ret);
+ ret = oftree_count_phandle_with_args(otree, node, prop, "#invalid", 0);
+ ut_asserteq(-EINVAL, ret);
+ ret = oftree_count_phandle_with_args(otree, node, prop, cell, 0);
+ ut_asserteq(5, ret);
+
+ /* Test oftree_parse_phandle_with_args with cell name */
+ ret = oftree_parse_phandle_with_args(otree, node, "missing", cell, 0, 0,
+ &args);
ut_asserteq(-ENOENT, ret);
- ret = ofnode_count_phandle_with_args(node, "target", "#invalid", 0);
+ ret = oftree_parse_phandle_with_args(otree, node, prop, "#invalid", 0, 0,
+ &args);
ut_asserteq(-EINVAL, ret);
- ret = ofnode_count_phandle_with_args(node, "target", "#gpio-cells", 0);
- ut_asserteq(1, ret);
+ ret = oftree_parse_phandle_with_args(otree, node, prop, cell, 0, 0, &args);
+ ut_assertok(ret);
+ ut_asserteq(1, args.args_count);
+ ut_asserteq(1, args.args[0]);
+ ret = oftree_parse_phandle_with_args(otree, node, prop, cell, 0, 1, &args);
+ ut_assertok(ret);
+ ut_asserteq(1, args.args_count);
+ ut_asserteq(4, args.args[0]);
+ ret = oftree_parse_phandle_with_args(otree, node, prop, cell, 0, 2, &args);
+ ut_assertok(ret);
+ ut_asserteq(5, args.args_count);
+ ut_asserteq(5, args.args[0]);
+ ut_asserteq(1, args.args[4]);
+ ret = oftree_parse_phandle_with_args(otree, node, prop, cell, 0, 3, &args);
+ ut_asserteq(-ENOENT, ret);
+ ret = oftree_parse_phandle_with_args(otree, node, prop, cell, 0, 4, &args);
+ ut_assertok(ret);
+ ut_asserteq(1, args.args_count);
+ ut_asserteq(12, args.args[0]);
+ ret = oftree_parse_phandle_with_args(otree, node, prop, cell, 0, 5, &args);
+ ut_asserteq(-ENOENT, ret);
+
+ /* Test oftree_count_phandle_with_args with cell count */
+ ret = oftree_count_phandle_with_args(otree, node, "missing", NULL, 2);
+ ut_asserteq(-ENOENT, ret);
+ ret = oftree_count_phandle_with_args(otree, node, prop2, NULL, 1);
+ ut_asserteq(3, ret);
- ret = ofnode_parse_phandle_with_args(node, "target", "#gpio-cells", 0,
- 0, &args);
+ /* Test oftree_parse_phandle_with_args with cell count */
+ ret = oftree_parse_phandle_with_args(otree, node, prop2, NULL, 1, 0, &args);
ut_assertok(ret);
- ut_asserteq(2, args.args_count);
- ut_asserteq(3, args.args[0]);
- ut_asserteq(4, args.args[1]);
+ ut_asserteq(1, ofnode_valid(args.node));
+ ut_asserteq(1, args.args_count);
+ ut_asserteq(10, args.args[0]);
+ ret = oftree_parse_phandle_with_args(otree, node, prop2, NULL, 1, 1, &args);
+ ut_asserteq(-EINVAL, ret);
+ ret = oftree_parse_phandle_with_args(otree, node, prop2, NULL, 1, 2, &args);
+ ut_assertok(ret);
+ ut_asserteq(1, ofnode_valid(args.node));
+ ut_asserteq(1, args.args_count);
+ ut_asserteq(30, args.args[0]);
+ ret = oftree_parse_phandle_with_args(otree, node, prop2, NULL, 1, 3, &args);
+ ut_asserteq(-ENOENT, ret);
+
+ /* Test oftree_parse_phandle */
+ phandle = oftree_parse_phandle(otree, node, "missing", 0);
+ ut_assert(ofnode_equal(ofnode_null(), phandle));
+
+ target = oftree_path(otree, "/other-phandle-node-1");
+ ut_assert(ofnode_valid(target));
+ phandle = oftree_parse_phandle(otree, node, prop3, 0);
+ ut_assert(ofnode_equal(target, phandle));
+
+ target = oftree_path(otree, "/other-phandle-node-2");
+ ut_assert(ofnode_valid(target));
+ phandle = oftree_parse_phandle(otree, node, prop3, 1);
+ ut_assert(ofnode_equal(target, phandle));
+
+ phandle = oftree_parse_phandle(otree, node, prop3, 3);
+ ut_assert(ofnode_equal(ofnode_null(), phandle));
return 0;
}
@@ -613,6 +704,10 @@ static int dm_test_ofnode_options(struct unit_test_state *uts)
{
u64 bootscr_address, bootscr_offset;
u64 bootscr_flash_offset, bootscr_flash_size;
+ ofnode node, phandle_node, target;
+
+ node = ofnode_path("/options/u-boot");
+ ut_assert(ofnode_valid(node));
ut_assert(!ofnode_options_read_bool("missing"));
ut_assert(ofnode_options_read_bool("testing-bool"));
@@ -623,6 +718,13 @@ static int dm_test_ofnode_options(struct unit_test_state *uts)
ut_assertnull(ofnode_options_read_str("missing"));
ut_asserteq_str("testing", ofnode_options_read_str("testing-str"));
+ ut_asserteq(-EINVAL, ofnode_options_get_by_phandle("missing", &phandle_node));
+
+ target = ofnode_path("/phandle-node-1");
+ ut_assert(ofnode_valid(target));
+ ut_assertok(ofnode_options_get_by_phandle("testing-phandle", &phandle_node));
+ ut_assert(ofnode_equal(target, phandle_node));
+
ut_assertok(ofnode_read_bootscript_address(&bootscr_address,
&bootscr_offset));
ut_asserteq_64(0, bootscr_address);
diff --git a/test/lib/lmb.c b/test/lib/lmb.c
index c917115b7b6..0bd29e2a4fe 100644
--- a/test/lib/lmb.c
+++ b/test/lib/lmb.c
@@ -529,6 +529,26 @@ static int test_alloc_addr(struct unit_test_state *uts, const phys_addr_t ram)
ret = lmb_add(ram, ram_size);
ut_asserteq(ret, 0);
+ /* Try to allocate a page twice */
+ b = lmb_alloc_addr_flags(alloc_addr_a, 0x1000, LMB_NONE);
+ ut_asserteq(b, alloc_addr_a);
+ b = lmb_alloc_addr_flags(alloc_addr_a, 0x1000, LMB_NOOVERWRITE);
+ ut_asserteq(b, 0);
+ b = lmb_alloc_addr_flags(alloc_addr_a, 0x1000, LMB_NONE);
+ ut_asserteq(b, alloc_addr_a);
+ b = lmb_alloc_addr_flags(alloc_addr_a, 0x2000, LMB_NONE);
+ ut_asserteq(b, alloc_addr_a);
+ ret = lmb_free(alloc_addr_a, 0x2000);
+ ut_asserteq(ret, 0);
+ b = lmb_alloc_addr_flags(alloc_addr_a, 0x1000, LMB_NOOVERWRITE);
+ ut_asserteq(b, alloc_addr_a);
+ b = lmb_alloc_addr_flags(alloc_addr_a, 0x1000, LMB_NONE);
+ ut_asserteq(b, 0);
+ b = lmb_alloc_addr_flags(alloc_addr_a, 0x1000, LMB_NOOVERWRITE);
+ ut_asserteq(b, 0);
+ ret = lmb_free(alloc_addr_a, 0x1000);
+ ut_asserteq(ret, 0);
+
/* reserve 3 blocks */
ret = lmb_reserve(alloc_addr_a, 0x10000);
ut_asserteq(ret, 0);
@@ -734,7 +754,7 @@ static int lib_test_lmb_flags(struct unit_test_state *uts)
/* reserve again, same flag */
ret = lmb_reserve_flags(0x40010000, 0x10000, LMB_NOMAP);
- ut_asserteq(ret, 0);
+ ut_asserteq(ret, -1L);
ASSERT_LMB(mem_lst, used_lst, ram, ram_size, 1, 0x40010000, 0x10000,
0, 0, 0, 0);
diff --git a/test/py/tests/test_zynqmp_rpu.py b/test/py/tests/test_zynqmp_rpu.py
index 479a612b4ec..22f687dd6d3 100644
--- a/test/py/tests/test_zynqmp_rpu.py
+++ b/test/py/tests/test_zynqmp_rpu.py
@@ -70,7 +70,7 @@ def ret_code(u_boot_console):
# Initialize tcm
def tcminit(u_boot_console, rpu_mode):
- output = u_boot_console.run_command('zynqmp tcminit %s' % rpu_mode)
+ output = u_boot_console.run_command(f'zynqmp tcminit {rpu_mode}')
assert 'Initializing TCM overwrites TCM content' in output
return ret_code(u_boot_console)
@@ -89,6 +89,13 @@ def disable_cpus(u_boot_console, cpu_nums):
for num in cpu_nums:
u_boot_console.run_command(f'cpu {num} disable')
+# Get random RPU mode between string and integer
+def get_rpu_mode(rpu_mode):
+ if rpu_mode == 0 or rpu_mode == 'lockstep':
+ return random.choice(['lockstep', 0])
+ elif rpu_mode == 1 or rpu_mode == 'split':
+ return random.choice(['split', 1])
+
# Load apps on RPU cores
def rpu_apps_load(u_boot_console, rpu_mode):
apps, procs, cpu_nums, addrs, outputs, tftp_addrs = get_rpu_apps_env(
@@ -98,20 +105,20 @@ def rpu_apps_load(u_boot_console, rpu_mode):
test_net.test_net_setup_static(u_boot_console)
try:
- assert tcminit(u_boot_console, rpu_mode).endswith('0')
+ assert tcminit(u_boot_console, get_rpu_mode(rpu_mode)).endswith('0')
for i in range(len(apps)):
if rpu_mode == 'lockstep' and procs[i] != 'rpu0':
continue
load_app_ddr(u_boot_console, tftp_addrs[i], apps[i])
- rel_addr = int(addrs[i] + 0x3C)
+ rel_addr = hex(int(addrs[i] + 0x3C))
# Release cpu at app load address
cpu_num = cpu_nums[i]
- cmd = 'cpu %d release %x %s' % (cpu_num, rel_addr, rpu_mode)
+ cmd = f'cpu {cpu_num} release {rel_addr} {rpu_mode}'
output = u_boot_console.run_command(cmd)
- exp_op = f'Using TCM jump trampoline for address {hex(rel_addr)}'
+ exp_op = f'Using TCM jump trampoline for address {rel_addr}'
assert exp_op in output
assert f'R5 {rpu_mode} mode' in output
u_boot_console.wait_for(outputs[i])
@@ -133,16 +140,13 @@ def test_zynqmp_rpu_app_load_negative(u_boot_console):
u_boot_console)
# Invalid commands
- u_boot_console.run_command('zynqmp tcminit mode')
- assert ret_code(u_boot_console).endswith('1')
-
rand_str = ''.join(random.choices(string.ascii_lowercase, k=4))
- u_boot_console.run_command('zynqmp tcminit %s' % rand_str)
- assert ret_code(u_boot_console).endswith('1')
-
rand_num = random.randint(2, 100)
- u_boot_console.run_command('zynqmp tcminit %d' % rand_num)
- assert ret_code(u_boot_console).endswith('1')
+ inv_modes = ['mode', rand_str, rand_num, 'splittt', 'locksteppp', '00', 11]
+
+ for mode in inv_modes:
+ u_boot_console.run_command(f'zynqmp tcminit {mode}')
+ assert ret_code(u_boot_console).endswith('1')
test_net.test_net_dhcp(u_boot_console)
if not test_net.net_set_up:
@@ -150,56 +154,66 @@ def test_zynqmp_rpu_app_load_negative(u_boot_console):
try:
rpu_mode = 'split'
- assert tcminit(u_boot_console, rpu_mode).endswith('0')
+ assert tcminit(u_boot_console, get_rpu_mode(rpu_mode)).endswith('0')
+ inv_modes += [0, 1]
for i in range(len(apps)):
load_app_ddr(u_boot_console, tftp_addrs[i], apps[i])
# Run in split mode at different load address
- rel_addr = int(addrs[i]) + random.randint(200, 1000)
+ rel_addr = hex(int(addrs[i]) + random.randint(200, 1000))
cpu_num = cpu_nums[i]
- cmd = 'cpu %d release %x %s' % (cpu_num, rel_addr, rpu_mode)
+ cmd = f'cpu {cpu_num} release {rel_addr} {rpu_mode}'
output = u_boot_console.run_command(cmd)
- exp_op = f'Using TCM jump trampoline for address {hex(rel_addr)}'
+ exp_op = f'Using TCM jump trampoline for address {rel_addr}'
assert exp_op in output
assert f'R5 {rpu_mode} mode' in output
assert not outputs[i] in output
# Invalid rpu mode
- rand_str = ''.join(random.choices(string.ascii_lowercase, k=4))
- cmd = 'cpu %d release %x %s' % (cpu_num, rel_addr, rand_str)
- output = u_boot_console.run_command(cmd)
- assert exp_op in output
- assert f'Unsupported mode' in output
- assert not ret_code(u_boot_console).endswith('0')
+ for mode in inv_modes:
+ cmd = f'cpu {cpu_num} release {rel_addr} {mode}'
+ output = u_boot_console.run_command(cmd)
+ assert exp_op in output
+ assert f'Unsupported mode' in output
+ assert not ret_code(u_boot_console).endswith('0')
# Switch to lockstep mode, without disabling CPUs
rpu_mode = 'lockstep'
- u_boot_console.run_command('zynqmp tcminit %s' % rpu_mode)
- assert not ret_code(u_boot_console).endswith('0')
+ output = u_boot_console.run_command(
+ f'zynqmp tcminit {get_rpu_mode(rpu_mode)}'
+ )
+ assert 'ERROR: ' in output
# Disable cpus
disable_cpus(u_boot_console, cpu_nums)
# Switch to lockstep mode, after disabling CPUs
- output = u_boot_console.run_command('zynqmp tcminit %s' % rpu_mode)
+ output = u_boot_console.run_command(
+ f'zynqmp tcminit {get_rpu_mode(rpu_mode)}'
+ )
assert 'Initializing TCM overwrites TCM content' in output
assert ret_code(u_boot_console).endswith('0')
- # Run lockstep mode for RPU1
+ # Run lockstep mode for RPU1/RPU0
for i in range(len(apps)):
- if procs[i] == 'rpu0':
- continue
-
load_app_ddr(u_boot_console, tftp_addrs[i], apps[i])
- rel_addr = int(addrs[i] + 0x3C)
+ rel_addr = hex(int(addrs[i] + 0x3C))
cpu_num = cpu_nums[i]
- cmd = 'cpu %d release %x %s' % (cpu_num, rel_addr, rpu_mode)
+ cmd = f'cpu {cpu_num} release {rel_addr} {rpu_mode}'
output = u_boot_console.run_command(cmd)
- exp_op = f'Using TCM jump trampoline for address {hex(rel_addr)}'
+ exp_op = f'Using TCM jump trampoline for address {rel_addr}'
assert exp_op in output
- assert f'R5 {rpu_mode} mode' in output
- assert u_boot_console.p.expect([outputs[i]])
+
+ if procs[i] == 'rpu1':
+ assert 'Lockstep mode should run on ZYNQMP_CORE_RPU0' in output
+ assert not ret_code(u_boot_console).endswith('0')
+ elif procs[i] == 'rpu0':
+ assert f'R5 {rpu_mode} mode' in output
+ u_boot_console.wait_for(outputs[i])
+ assert ret_code(u_boot_console).endswith('0')
+ else:
+ assert False, 'ERROR: Invalid processor!'
finally:
disable_cpus(u_boot_console, cpu_nums)
# This forces the console object to be shutdown, so any subsequent test
diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py
index fa9cd57b04b..7eaceb39d9d 100644
--- a/test/py/u_boot_console_base.py
+++ b/test/py/u_boot_console_base.py
@@ -342,11 +342,12 @@ class ConsoleBase(object):
# indentation.
return self.p.before.strip('\r\n')
except Timeout as exc:
- handle_exception(self.config, self, self.log, exc, 'Lab failure',
- True)
+ handle_exception(self.config, self, self.log, exc,
+ f"Lab failure: Timeout executing '{cmd}'", True)
raise
except BootFail as exc:
- handle_exception(self.config, self, self.log, exc, 'Boot fail',
+ handle_exception(self.config, self, self.log, exc,
+ f"'Boot fail '{cmd}'",
True, self.get_spawn_output())
raise
finally: