blob: ea93061fdfa866c18ee183489ee88a35d206537a [file] [log] [blame]
Sean Anderson439f1c62020-04-06 10:23:09 -04001# SPDX-License-Identifier: GPL-2.0
2# Copyright (C) 2020 Sean Anderson
3
4import pytest
5
6@pytest.mark.buildconfigspec('cmd_dm')
Niel Fourie39832fb2020-03-24 16:17:05 +01007def test_dm_compat(u_boot_console):
8 """Test that each driver in `dm tree` is also listed in `dm compat`."""
Sean Anderson439f1c62020-04-06 10:23:09 -04009 response = u_boot_console.run_command('dm tree')
10 driver_index = response.find('Driver')
11 assert driver_index != -1
12 drivers = (line[driver_index:].split()[0]
13 for line in response[:-1].split('\n')[2:])
14
Niel Fourie39832fb2020-03-24 16:17:05 +010015 response = u_boot_console.run_command('dm compat')
16 for driver in drivers:
17 assert driver in response
18
19@pytest.mark.buildconfigspec('cmd_dm')
20def test_dm_drivers(u_boot_console):
21 """Test that each driver in `dm compat` is also listed in `dm drivers`."""
22 response = u_boot_console.run_command('dm compat')
23 drivers = (line[:20].rstrip() for line in response[:-1].split('\n')[2:])
24 response = u_boot_console.run_command('dm drivers')
25 for driver in drivers:
26 assert driver in response
27
28@pytest.mark.buildconfigspec('cmd_dm')
29def test_dm_static(u_boot_console):
30 """Test that each driver in `dm static` is also listed in `dm drivers`."""
31 response = u_boot_console.run_command('dm static')
32 drivers = (line[:25].rstrip() for line in response[:-1].split('\n')[2:])
Sean Anderson439f1c62020-04-06 10:23:09 -040033 response = u_boot_console.run_command('dm drivers')
34 for driver in drivers:
35 assert driver in response
Michal Simeka5980732022-07-07 12:59:42 +020036
37@pytest.mark.buildconfigspec("cmd_dm")
38def test_dm_uclass(u_boot_console):
39 response = u_boot_console.run_command("dm uclass")
40
41@pytest.mark.buildconfigspec("cmd_dm")
42def test_dm_devres(u_boot_console):
43 response = u_boot_console.run_command("dm devres")