[PATCH v2 3/3] cmd: dm: Fixed/Added DM driver listing subcommands

Niel Fourie lusus at denx.de
Fri Mar 20 10:53:26 CET 2020


Hi Sean,

On 3/19/20 7:37 PM, Sean Anderson wrote:
<snip>
>> diff --git a/test/py/tests/test_dm.py b/test/py/tests/test_dm.py
>> index f6fbf8ba4c..97203b536e 100644
>> --- a/test/py/tests/test_dm.py
>> +++ b/test/py/tests/test_dm.py
>> @@ -4,14 +4,32 @@
>>   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`."""
>> +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
>> +
> 
> Why is the above marked as being added? These lines are present in the
> patch which adds the original test.
> 

Well spotted! I had to give it a second look before I grasped what 
happened there... My tests were all based on yours, and it turns out 
that the last 4 lines of my last test, test_dm_static(), exactly matches 
those 4 lines in your original patch. And as I had changed the command 
to run in your test from "dm driver" to "dm compat", git decided to just 
insert all of my changes in one block in the middle of what was 
originally your test. At the bottom of the patch you can still see your 
original code:

+ at 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

Best regards,
Niel Fourie

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-21 Fax: +49-8142-66989-80  Email: lusus at denx.de


More information about the U-Boot mailing list