[U-Boot] [PATCHv3 11/13] test/py: Update docs, add requirements.txt for pip

Tom Rini trini at konsulko.com
Thu Oct 24 15:59:26 UTC 2019

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 at chromium.org>
Tested-by: Stephen Warren <swarren at nvidia.com>
Tested-by: Simon Glass <sjg at chromium.org> [on sandbox]
Signed-off-by: Tom Rini <trini at konsulko.com>
Changes in v3:
- Drop duplicate openssl entry, clarify that we have a tool list and not
  package list (both from Stephen's feedback).
 test/py/README.md        | 47 ++++++++++++++++++++++------------------
 test/py/requirements.txt | 22 +++++++++++++++++++
 2 files changed, 48 insertions(+), 21 deletions(-)
 create mode 100644 test/py/requirements.txt

diff --git a/test/py/README.md b/test/py/README.md
index 2156661d6c42..3cbe01b73e28 100644
--- a/test/py/README.md
+++ b/test/py/README.md
@@ -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
 the appropriate time.
-On Debian or Debian-like distributions, the following packages are required.
-Some packages are required to execute any test, and others only for specific
-tests. 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-subunit | -                             |
-| gdisk          | 0.8.8-1ubuntu0.1              |
-| dfu-util       | 0.5-1                         |
-| dtc            | 1.4.0+dfsg-1                  |
-| openssl        | 1.0.1f-1ubuntu2.22            |
+In order to run the testsuite at a minimum we require that both python3 and
+pip for python3 be installed.  All of the required python modules are
+described in the requirements.txt file in this directory and can be installed
+with the command ```pip install -r requirements.txt```
+In order to execute certain tests on their supported platforms other tools
+will be required.  The following is an incomplete list:
+| Package        |
+| -------------- |
+| gdisk          |
+| dfu-util       |
+| dtc            |
+| 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:
@@ -45,18 +52,16 @@ The test script supports either:
 ### Using `virtualenv` to provide requirements
-Older distributions (e.g. Ubuntu 10.04) may not provide all the required
-packages, or may provide versions that are too old to run the test suite. One
-can use the Python `virtualenv` script to locally install more up-to-date
-versions of the required packages without interfering with the OS installation.
-For example:
+The recommended way to run the test suite, in order to ensure reproducibility
+is to use `virtualenv` to set up the necessary environment.  This can be done
+via the following commands:
 $ cd /path/to/u-boot
-$ sudo apt-get install python python-virtualenv
-$ virtualenv venv
+$ sudo apt-get install python3 python3-virtualenv
+$ virtualenv -p /usr/bin/python3 venv
 $ . ./venv/bin/activate
-$ pip install pytest
+$ pip install -r test/py/requirements.txt
 ## Testing sandbox
diff --git a/test/py/requirements.txt b/test/py/requirements.txt
new file mode 100644
index 000000000000..cf251186f4b1
--- /dev/null
+++ b/test/py/requirements.txt
@@ -0,0 +1,22 @@

More information about the U-Boot mailing list