[U-Boot] [PATCH V2 6/7] test/py: test the shell if command

Stephen Warren swarren at wwwdotorg.org
Mon Jan 4 22:18:31 CET 2016


On 12/19/2015 03:24 PM, Simon Glass wrote:
> Hi Stephen,
>
> On 2 December 2015 at 15:18, Stephen Warren <swarren at wwwdotorg.org> wrote:
>> From: Stephen Warren <swarren at nvidia.com>
>>
>> Migrate all most tests from command_ut.c into the Python test system.
>> This allows the tests to be run against any U-Boot binary that supports
>> the if command (i.e. where hush is enabled) without requiring that
>> binary to be permanently bloated with the code from command_ut.
>>
>> Some tests in command_ut.c can only be executed from C code, since they
>> test internal (more unit-level) features of various U-Boot APIs. The
>> migrated tests can all operate directly from the U-Boot console.
>
> This seems to migrate more than just the 'if' tests suggested by the
> commit subject. Perhaps it should be split into two?
>
> Is there any point in running these tests on real hardware? It takes
> forever due to needing to reset each time. Do we need to reset?

No, that should no be needed.

> They fail on my board due I think to a problem with the printenv parsing:
>
> Section: test_env_echo_exists
> Stream: console
> => printenv
...
> othbootargs=acpi=off

Yes, I hadn't tested with variable values that contained an =. Michal 
found this already. The following patch to test/py/test_env.py class 
StateTestEnv function get_env() should fix this:

- (var, value) = l.strip().split("=")
+ (var, value) = l.strip().split("=", 1)

...
> Also how will we run the existing command unit tests? There should
> definitely be a way to do that.

We could add a test that runs "ut xxx" very easily. Of course, the 
result would only be an aggregate of "all unit tests passed" vs "some 
unit test failed" at present. Perhaps that could be improved later though.


More information about the U-Boot mailing list