diff options
author | Michal Simek <michal.simek@xilinx.com> | 2019-01-31 16:31:00 +0100 |
---|---|---|
committer | Heiko Schocher <hs@denx.de> | 2019-02-08 06:25:49 +0100 |
commit | a93eb577b9ae635ef6f631e8509d113c15f53530 (patch) | |
tree | e582a46373e38593414d9944bc082342e71dd6ba /test | |
parent | 83e4c7e9ffa57fe4116967999c223c952a46a78a (diff) | |
download | u-boot-a93eb577b9ae635ef6f631e8509d113c15f53530.tar.gz |
dm: core: Add tests for dev_read_alias_highest_id()
It is checking the highest alias ID for eth, gpio, pci, i2c and error
code on non existing alias.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/dm/test-fdt.c | 23 |
1 files changed, 23 insertions, 0 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; |