Sean Anderson | 439f1c6 | 2020-04-06 10:23:09 -0400 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | # Copyright (C) 2020 Sean Anderson |
| 3 | |
| 4 | import pytest |
| 5 | |
| 6 | @pytest.mark.buildconfigspec('cmd_dm') |
Niel Fourie | 39832fb | 2020-03-24 16:17:05 +0100 | [diff] [blame^] | 7 | def test_dm_compat(u_boot_console): |
| 8 | """Test that each driver in `dm tree` is also listed in `dm compat`.""" |
Sean Anderson | 439f1c6 | 2020-04-06 10:23:09 -0400 | [diff] [blame] | 9 | 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 Fourie | 39832fb | 2020-03-24 16:17:05 +0100 | [diff] [blame^] | 15 | 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') |
| 20 | def 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') |
| 29 | def 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 Anderson | 439f1c6 | 2020-04-06 10:23:09 -0400 | [diff] [blame] | 33 | response = u_boot_console.run_command('dm drivers') |
| 34 | for driver in drivers: |
| 35 | assert driver in response |