u-boot/test/py/tests/test_dm.py
Michal Simek 34b01c22cc test/py: Run simple dm commands without checking
Just to make sure that dm commands can operate.
This was the problem on Microblaze in past without fixing manual
relocation.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Link: https://lore.kernel.org/r/e6c4b8b44445c16cee84436627642ccc9886f507.1657191580.git.michal.simek@amd.com
2022-07-26 08:23:54 +02:00

44 lines
1.6 KiB
Python

# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2020 Sean Anderson
import pytest
@pytest.mark.buildconfigspec('cmd_dm')
def test_dm_compat(u_boot_console):
"""Test that each driver in `dm tree` is also listed in `dm compat`."""
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 compat')
for driver in drivers:
assert driver in response
@pytest.mark.buildconfigspec('cmd_dm')
def test_dm_drivers(u_boot_console):
"""Test that each driver in `dm compat` is also listed in `dm drivers`."""
response = u_boot_console.run_command('dm compat')
drivers = (line[:20].rstrip() for line in response[:-1].split('\n')[2:])
response = u_boot_console.run_command('dm drivers')
for driver in drivers:
assert driver in response
@pytest.mark.buildconfigspec('cmd_dm')
def test_dm_static(u_boot_console):
"""Test that each driver in `dm static` is also listed in `dm drivers`."""
response = u_boot_console.run_command('dm static')
drivers = (line[:25].rstrip() for line in response[:-1].split('\n')[2:])
response = u_boot_console.run_command('dm drivers')
for driver in drivers:
assert driver in response
@pytest.mark.buildconfigspec("cmd_dm")
def test_dm_uclass(u_boot_console):
response = u_boot_console.run_command("dm uclass")
@pytest.mark.buildconfigspec("cmd_dm")
def test_dm_devres(u_boot_console):
response = u_boot_console.run_command("dm devres")