summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSean Anderson <seanga2@gmail.com>2020-04-06 10:23:09 -0400
committerTom Rini <trini@konsulko.com>2020-04-09 09:18:56 -0400
commit97c7ac214e1df5579a1f9f35d36c717e6975619a (patch)
tree8df9f976ce65a3257a7866b0d65fa4c19efa25fb /test
parentdfd5321becc54d7ce9fd564aaaba70a2132c058e (diff)
cmd: Add test and fix bugs for dm drivers
Add a test for the dm drivers command. Also fix a null pointer dereference revealed by said test. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/py/tests/test_dm.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/py/tests/test_dm.py b/test/py/tests/test_dm.py
new file mode 100644
index 0000000000..f6fbf8ba4c
--- /dev/null
+++ b/test/py/tests/test_dm.py
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2020 Sean Anderson
+
+import pytest
+
+@pytest.mark.buildconfigspec('cmd_dm')
+def test_dm_drivers(u_boot_console):
+ """Test that each driver in `dm tree` is also listed in `dm drivers`."""
+ response = u_boot_console.run_command('dm tree')
+ driver_index = response.find('Driver')
+ assert driver_index != -1
+ drivers = (line[driver_index:].split()[0]
+ for line in response[:-1].split('\n')[2:])
+
+ response = u_boot_console.run_command('dm drivers')
+ for driver in drivers:
+ assert driver in response