diff options
author | Mario Six <mario.six@gdsys.cc> | 2018-06-26 08:46:51 +0200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2018-09-29 11:49:35 -0600 |
commit | 172942a4a0afe12a603470db7728f3871a81de01 (patch) | |
tree | 80dfebc497ad9e470c87530c0bacbf8131f2cead /test/dm/test-fdt.c | |
parent | e4c98a59db99e6bfba74d27cc571d59213acb64e (diff) | |
download | u-boot-172942a4a0afe12a603470db7728f3871a81de01.tar.gz |
test: Add tests for dev_{enable, disable}_by_path
Add tests for the dev_{enable,disable}_by_path functions.
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Diffstat (limited to 'test/dm/test-fdt.c')
-rw-r--r-- | test/dm/test-fdt.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c index efe5342b07..79b1f1de45 100644 --- a/test/dm/test-fdt.c +++ b/test/dm/test-fdt.c @@ -557,3 +557,31 @@ static int dm_test_fdt_livetree_writing(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_fdt_livetree_writing, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + +static int dm_test_fdt_disable_enable_by_path(struct unit_test_state *uts) +{ + ofnode node; + + if (!of_live_active()) { + printf("Live tree not active; ignore test\n"); + return 0; + } + + node = ofnode_path("/usb@2"); + + /* Test enabling devices */ + + ut_assert(!of_device_is_available(ofnode_to_np(node))); + dev_enable_by_path("/usb@2"); + ut_assert(of_device_is_available(ofnode_to_np(node))); + + /* Test disabling devices */ + + ut_assert(of_device_is_available(ofnode_to_np(node))); + dev_disable_by_path("/usb@2"); + ut_assert(!of_device_is_available(ofnode_to_np(node))); + + return 0; +} +DM_TEST(dm_test_fdt_disable_enable_by_path, DM_TESTF_SCAN_PDATA | + DM_TESTF_SCAN_FDT); |