[U-Boot] [PATCH] Implement pytest-based test infrastructure

Simon Glass sjg at chromium.org
Sat Nov 21 17:49:30 CET 2015


Hi Stephen,

On 19 November 2015 at 12:09, Stephen Warren <swarren at wwwdotorg.org> wrote:
>
> On 11/19/2015 10:00 AM, Stephen Warren wrote:
>>
>> On 11/19/2015 07:45 AM, Simon Glass wrote:
>>>
>>> Hi Stephen,
>>>
>>> On 14 November 2015 at 23:53, Stephen Warren <swarren at wwwdotorg.org>
>>> wrote:
>>>>
>>>> This tool aims to test U-Boot by executing U-Boot shell commands
>>>> using the
>>>> console interface. A single top-level script exists to execute or attach
>>>> to the U-Boot console, run the entire script of tests against it, and
>>>> summarize the results. Advantages of this approach are:
>>>>
>>>> - Testing is performed in the same way a user or script would interact
>>>>    with U-Boot; there can be no disconnect.
>>>> - There is no need to write or embed test-related code into U-Boot
>>>> itself.
>>>>    It is asserted that writing test-related code in Python is simpler
>>>> and
>>>>    more flexible that writing it all in C.
>>>> - It is reasonably simple to interact with U-Boot in this way.
>>>>
>>>> A few simple tests are provided as examples. Soon, we should convert as
>>>> many as possible of the other tests in test/* and test/cmd_ut.c too.
>>>
>>>
>>> It's great to see this and thank you for putting in the effort!
>>>
>>> It looks like a good way of doing functional tests. I still see a role
>>> for unit tests and things like test/dm. But if we can arrange to call
>>> all U-Boot tests (unit and functional) from one 'test.py' command that
>>> would be a win.
>>>
>>> I'll look more when I can get it to work - see below.
>
> ...
>>
>> made it print a message about checking the docs for missing
>> requirements. I can probably patch the top-level test.py to do the same.
>
>
> I've pushed such a patch to:
>
> git://github.com/swarren/u-boot.git tegra_dev
> (the separate pytests branch has now been deleted)
>
> There are also a variety of other patches there related to this testing infra-structure. I guess I'll hold off sending them to the list until there's been some general feedback on the patches I've already posted, but feel free to pull the branch down and play with it. Note that it's likely to get rebased as I work.

OK I got it working thank you. It is horribly slow though - do you
know what is holding it up? For me to takes 12 seconds to run the
(very basic) tests.

Also please see dm_test_usb_tree() which uses a console buffer to
check command output. I wonder if we should use something like that
for simple unit tests, and use python for the more complicated
functional tests?

Regards,
Simon


More information about the U-Boot mailing list