test/py: Update docs, add requirements.txt for pip

To be more closely aligned with Python community best practices, we need
to better document our usage of pip and make use of a requirements.txt
file that shows the versions of the tools that we are using.  This will
aide in ensuring reproducibility of our tests as well.

Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Simon Glass <sjg@chromium.org> [on sandbox]
Signed-off-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
Tom Rini 2019-10-24 11:59:26 -04:00
parent 8add4fa417
commit ddaa8bed3d
2 changed files with 47 additions and 20 deletions

View File

@ -21,19 +21,26 @@ involves executing some binary and interacting with its stdin/stdout. You will
need to implement various "hook" scripts that are called by the test suite at need to implement various "hook" scripts that are called by the test suite at
the appropriate time. the appropriate time.
On Debian or Debian-like distributions, the following packages are required. In order to run the testsuite at a minimum we require that both python3 and
Some packages are required to execute any test, and others only for specific pip for python3 be installed. All of the required python modules are
tests. Similar package names should exist in other distributions. described in the requirements.txt file in this directory and can be installed
with the command ```pip install -r requirements.txt```
| Package | Version tested (Ubuntu 14.04) | In order to execute certain tests on their supported platforms other tools
| -------------- | ----------------------------- | will be required. The following is an incomplete list:
| python | 2.7.5-5ubuntu3 |
| python-pytest | 2.5.1-1 | | Package |
| python-subunit | - | | -------------- |
| gdisk | 0.8.8-1ubuntu0.1 | | gdisk |
| dfu-util | 0.5-1 | | dfu-util |
| dtc | 1.4.0+dfsg-1 | | dtc |
| openssl | 1.0.1f-1ubuntu2.22 | | openssl |
| sudo OR guestmount |
| e2fsprogs |
| dosfstools |
Please use the apporirate commands for your distribution to match these tools
up with the package that provides them.
The test script supports either: The test script supports either:
@ -45,18 +52,16 @@ The test script supports either:
### Using `virtualenv` to provide requirements ### Using `virtualenv` to provide requirements
Older distributions (e.g. Ubuntu 10.04) may not provide all the required The recommended way to run the test suite, in order to ensure reproducibility
packages, or may provide versions that are too old to run the test suite. One is to use `virtualenv` to set up the necessary environment. This can be done
can use the Python `virtualenv` script to locally install more up-to-date via the following commands:
versions of the required packages without interfering with the OS installation.
For example:
```bash ```bash
$ cd /path/to/u-boot $ cd /path/to/u-boot
$ sudo apt-get install python python-virtualenv $ sudo apt-get install python3 python3-virtualenv
$ virtualenv venv $ virtualenv -p /usr/bin/python3 venv
$ . ./venv/bin/activate $ . ./venv/bin/activate
$ pip install pytest $ pip install -r test/py/requirements.txt
``` ```
## Testing sandbox ## Testing sandbox

22
test/py/requirements.txt Normal file
View File

@ -0,0 +1,22 @@
atomicwrites==1.3.0
attrs==19.3.0
coverage==4.5.4
extras==1.0.0
fixtures==3.0.0
importlib-metadata==0.23
linecache2==1.0.0
more-itertools==7.2.0
packaging==19.2
pbr==5.4.3
pluggy==0.13.0
py==1.8.0
pyparsing==2.4.2
pytest==5.2.1
python-mimeparse==1.6.0
python-subunit==1.3.0
six==1.12.0
testtools==2.3.0
traceback2==1.4.0
unittest2==1.1.0
wcwidth==0.1.7
zipp==0.6.0