mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-08 22:03:22 +09:00
![Sean Anderson](/assets/img/avatar_default.png)
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>
18 lines
587 B
Python
18 lines
587 B
Python
# 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
|