summaryrefslogtreecommitdiff
path: root/doc/develop
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-08-07 02:51:59 +0300
committerTom Rini <trini@konsulko.com>2022-09-13 01:06:36 +0300
commitd1962ac7978559735ce172dc2d1822952d89e0a8 (patch)
tree121f5bce95b938bd352f65549c224b6c1bd69036 /doc/develop
parente1c0811114ea383e8f0cdd1e3535a25421f2619b (diff)
downloadu-boot-d1962ac7978559735ce172dc2d1822952d89e0a8.tar.xz
Makefile: Add a pcheck option to run tests in parallel
Running tests in parallel is much faster, e.g. 15 seconds to run the tests on sandbox (only), instead of 100 seconds (on a 16-core machine). Add a 'make pcheck' option to access this feature. Note that the tools/ tests still run each tool's tests once after the other, although within that, they do run in parallel. So for example, the buildman tests run in parallel, then the binman tests run in parallel. There would be a signiificant advantage to running them all in parallel together, but that would require a large amount of refactoring, e.g. with more use of pytest fixtures. Update the documentation to represent the current state. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'doc/develop')
-rw-r--r--doc/develop/py_testing.rst37
-rw-r--r--doc/develop/testing.rst6
2 files changed, 26 insertions, 17 deletions
diff --git a/doc/develop/py_testing.rst b/doc/develop/py_testing.rst
index 06f919609b..92fbd22721 100644
--- a/doc/develop/py_testing.rst
+++ b/doc/develop/py_testing.rst
@@ -121,31 +121,36 @@ more options.
Running tests in parallel
~~~~~~~~~~~~~~~~~~~~~~~~~
-Note: This does not fully work yet and is documented only so you can try to
-fix the problems.
+Note: Not all tests can run in parallel at present, so the usual approach is
+to just run those that can.
First install support for parallel tests::
+ sudo apt install python3-pytest-xdist
+
+or:::
+
pip3 install pytest-xdist
-Then build sandbox in a suitable build directory. It is not possible to use
-the --build flag with xdist.
+Then run the tests in parallel using the -n flag::
-Finally, run the tests in parallel using the -n flag::
+ test/py/test.py -B sandbox --build --build-dir /tmp/b/sandbox -q -k \
+ 'not slow and not bootstd and not spi_flash' -n16
- # build sandbox first, in a suitable build directory. It is not possible
- # to use the --build flag with -n
- test/py/test.py -B sandbox --build-dir /tmp/b/sandbox -q -k 'not slow' -n32
+You can also use `make pcheck` to run all tests in parallel. This uses a maximum
+of 16 threads, since the setup time is significant and there are under 1000
+tests.
-At least the following non-slow tests are known to fail:
+Note that the `test-log.html` output does not work correctly at present with
+parallel testing. All the threads write to it at once, so it is garbled.
-- test_fit_ecdsa
-- test_bind_unbind_with_uclass
-- ut_dm_spi_flash
-- test_gpt_rename_partition
-- test_gpt_swap_partitions
-- test_pinmux_status
-- test_sqfs_load
+Note that the `tools/` tests still run each tool's tests once after the other,
+although within that, they do run in parallel. So for example, the buildman
+tests run in parallel, then the binman tests run in parallel. There would be a
+significant advantage to running them all in parallel together, but that would
+require a large amount of refactoring, e.g. with more use of pytest fixtures.
+The code-coverage tests are omitted since they cannot run in parallel due to a
+Python limitation.
Testing under a debugger
diff --git a/doc/develop/testing.rst b/doc/develop/testing.rst
index 1abe4d7f0f..5afeb42f69 100644
--- a/doc/develop/testing.rst
+++ b/doc/develop/testing.rst
@@ -28,8 +28,12 @@ run. Type this::
make tcheck
+You can also run a selection tests in parallel with::
+
+ make pcheck
+
All of the above use the test/run script with a paremeter to select which tests
-are run.
+are run. See :doc:`py_testing` for more information.
Sandbox