blob: 97203b536e172326aa8aa2819ff305c157af0f28 [file] [log] [blame]
Sean Anderson97c7ac22020-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 Fourie2e488362020-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 Anderson97c7ac22020-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 Fourie2e488362020-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 Anderson97c7ac22020-04-06 10:23:09 -040033 response = u_boot_console.run_command('dm drivers')
34 for driver in drivers:
35 assert driver in response