aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/dm/test-fdt.c23
-rw-r--r--test/py/tests/test_net.py9
-rw-r--r--test/unicode_ut.c23
3 files changed, 51 insertions, 4 deletions
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
index 984b80c02c..be16c99e17 100644
--- a/test/dm/test-fdt.c
+++ b/test/dm/test-fdt.c
@@ -219,6 +219,29 @@ static int dm_test_fdt(struct unit_test_state *uts)
}
DM_TEST(dm_test_fdt, 0);
+static int dm_test_alias_highest_id(struct unit_test_state *uts)
+{
+ int ret;
+
+ ret = dev_read_alias_highest_id("eth");
+ ut_asserteq(5, ret);
+
+ ret = dev_read_alias_highest_id("gpio");
+ ut_asserteq(2, ret);
+
+ ret = dev_read_alias_highest_id("pci");
+ ut_asserteq(2, ret);
+
+ ret = dev_read_alias_highest_id("i2c");
+ ut_asserteq(0, ret);
+
+ ret = dev_read_alias_highest_id("deadbeef");
+ ut_asserteq(-1, ret);
+
+ return 0;
+}
+DM_TEST(dm_test_alias_highest_id, 0);
+
static int dm_test_fdt_pre_reloc(struct unit_test_state *uts)
{
struct uclass *uc;
diff --git a/test/py/tests/test_net.py b/test/py/tests/test_net.py
index 9c395e69fa..9ca6743afd 100644
--- a/test/py/tests/test_net.py
+++ b/test/py/tests/test_net.py
@@ -145,11 +145,12 @@ def test_net_tftpboot(u_boot_console):
pytest.skip('No TFTP readable file to read')
addr = f.get('addr', None)
- if not addr:
- addr = u_boot_utils.find_ram_base(u_boot_console)
fn = f['fn']
- output = u_boot_console.run_command('tftpboot %x %s' % (addr, fn))
+ if not addr:
+ output = u_boot_console.run_command('tftpboot %s' % (fn))
+ else:
+ output = u_boot_console.run_command('tftpboot %x %s' % (addr, fn))
expected_text = 'Bytes transferred = '
sz = f.get('size', None)
if sz:
@@ -163,7 +164,7 @@ def test_net_tftpboot(u_boot_console):
if u_boot_console.config.buildconfig.get('config_cmd_crc32', 'n') != 'y':
return
- output = u_boot_console.run_command('crc32 %x $filesize' % addr)
+ output = u_boot_console.run_command('crc32 $fileaddr $filesize')
assert expected_crc in output
@pytest.mark.buildconfigspec('cmd_nfs')
diff --git a/test/unicode_ut.c b/test/unicode_ut.c
index b115d18afd..84fc9a3b53 100644
--- a/test/unicode_ut.c
+++ b/test/unicode_ut.c
@@ -50,6 +50,29 @@ static const char j1[] = {0x6a, 0x31, 0xa1, 0x6c, 0x00};
static const char j2[] = {0x6a, 0x32, 0xc3, 0xc3, 0x6c, 0x00};
static const char j3[] = {0x6a, 0x33, 0xf0, 0x90, 0xf0, 0x00};
+static int ut_u16_strdup(struct unit_test_state *uts)
+{
+ u16 *copy = u16_strdup(c4);
+
+ ut_assert(copy != c4);
+ ut_assert(!memcmp(copy, c4, sizeof(c4)));
+ free(copy);
+ return 0;
+}
+UNICODE_TEST(ut_u16_strdup);
+
+static int ut_u16_strcpy(struct unit_test_state *uts)
+{
+ u16 *r;
+ u16 copy[10];
+
+ r = u16_strcpy(copy, c1);
+ ut_assert(r == copy);
+ ut_assert(!memcmp(copy, c1, sizeof(c1)));
+ return 0;
+}
+UNICODE_TEST(ut_u16_strcpy);
+
/* U-Boot uses UTF-16 strings in the EFI context only. */
#if CONFIG_IS_ENABLED(EFI_LOADER) && !defined(API_BUILD)
static int ut_string16(struct unit_test_state *uts)