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

Stephen Warren swarren at wwwdotorg.org
Tue Nov 24 00:55:49 CET 2015


On 11/23/2015 04:44 PM, Tom Rini wrote:
> On Thu, Nov 19, 2015 at 10:00:32AM -0700, Stephen Warren wrote:
...
>> See the following in test/py/README.md:
>>
>>> ## Requirements
>>>
>>> The test suite is implemented using pytest. Interaction with the U-Boot
>>> console uses pexpect. Interaction with real hardware uses the tools of your
>>> choice; you get to implement various "hook" scripts that are called by the
>>> test suite at the appropriate time.
>>>
>>> On Debian or Debian-like distributions, the following packages are required.
>>> Similar package names should exist in other distributions.
>>>
>>> | Package        | Version tested (Ubuntu 14.04) |
>>> | -------------- | ----------------------------- |
>>> | python         | 2.7.5-5ubuntu3                |
>>> | python-pytest  | 2.5.1-1                       |
>>> | python-pexpect | 3.1-1ubuntu0.1                |
>>
>> In the main Python code, I trapped at least one exception location
>> and 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.
>
> Isn't there some way to inject the local to U-Boot copy of the libraries
> in?  I swear I've done something like that before in python..

It would certainly be possible to either check in the required Python 
libraries in the U-Boot source tree, or include instructions for people 
to manually create a "virtualenv" (or perhaps even automatically do this 
from test.py). However, I was hoping to avoid the need to for that since 
those options are a bit more complex than "just install these 3 packages 
and run the script". (And in fact I've already mentioned 
virtualenv-based setup instructions in the README for people which 
archaic distros).

Still, if we find that varying versions of pytest/pexpect don't work 
well, we could certainly choose one of those options.

BTW, I've created a ton of patches on top of all these that I haven't 
posted yet. See:

git://github.com/swarren/u-boot.git tegra_dev

I'm not sure if I should squash all that into a V2 of this patch, or 
just post them all as incremental fixes/enhancements?


More information about the U-Boot mailing list