[PATCH v4 41/42] test: sandbox: Move sandbox test docs into doc/develop
sjg at chromium.org
Thu Mar 4 14:51:17 CET 2021
At present some of the documentation about running sandbox tests is in the
sandbox docs. It makes more sense to put it in with the other testing
docs, with a link there from sandbox. Update the documentation
Also add a paragraph explaining why sandbox exists and the test philosophy
that it uses.
Signed-off-by: Simon Glass <sjg at chromium.org>
(no changes since v1)
doc/arch/sandbox.rst | 44 +++++++----------------------------
doc/develop/tests_sandbox.rst | 44 +++++++++++++++++++++++++++++++++--
2 files changed, 51 insertions(+), 37 deletions(-)
diff --git a/doc/arch/sandbox.rst b/doc/arch/sandbox.rst
index 1ccb5344ac6..1638b050002 100644
@@ -17,6 +17,12 @@ of the sandbox U-Boot. The purpose of running U-Boot under Linux is to test
all the generic code, not specific to any one architecture. The idea is to
create unit tests which we can run to test this upper level code.
+Sandbox allows development of many types of new features in a traditional way,
+rather than needing to test each iteration on real hardware. Many U-Boot
+features were developed on sandbox, including the core driver model, most
+uclasses, verified boot, bloblist, logging and dozens of others. Sandbox has
+enabled many large-scale code refactors as well.
CONFIG_SANDBOX is defined when building a native board.
The board name is 'sandbox' but the vendor name is unset, so there is a
@@ -486,42 +492,10 @@ Testing
U-Boot sandbox can be used to run various tests, mostly in the test/
-directory. These include:
- Unit tests for command parsing and handling
- Unit tests for U-Boot's compression algorithms, useful for
- security checking. It supports gzip, bzip2, lzma and lzo.
- Run this pytest::
- ./test/py/test.py --bd sandbox --build -k ut_dm -v
- Unit tests for images:
- test/image/test-imagetools.sh - multi-file images
- test/image/test-fit.py - FIT images
- test/trace/test-trace.sh tests the tracing system (see README.trace)
- See test/vboot/vboot_test.sh for this
-If you change or enhance any of the above subsystems, you shold write or
-expand a test and include it with your patch series submission. Test
-coverage in U-Boot is limited, as we need to work to improve it.
-Note that many of these tests are implemented as commands which you can
-run natively on your board if desired (and enabled).
-To run all tests use "make check".
-To run a single test in an existing sandbox build, you can use -T to use the
-test device tree, and -c to select the test:
- /tmp/b/sandbox/u-boot -T -c "ut dm pci_busdev"
-This runs dm_test_pci_busdev() which is in test/dm/pci.c
+See :doc:`../develop/tests_sandbox` for more information and
+:doc:`../develop/testing` for information about testing generally.
diff --git a/doc/develop/tests_sandbox.rst b/doc/develop/tests_sandbox.rst
index daf87e53a99..8c2eac4c5f4 100644
@@ -1,7 +1,47 @@
.. SPDX-License-Identifier: GPL-2.0+
-Tests Under the Hood
+Most uclasses and many functions of U-Boot have sandbox tests. This allows much
+of the code to be checked in an developer-friendly environment.
+Sandbox provides a way to write and run unit tests. The traditional approach to
+unit tests is to build lots of little executables, one for each test or
+category of tests. With sandbox, so far as possible, all the tests share a
+small number of executables (e.g. 'u-boot' for sandbox, 'u-boot-spl' and
+'u-boot' for sandbox_spl) and can be run very quickly. The vast majority of
+tests can run on the 'sandbox' build,
+Some of the available tests are:
+ - command_ut: Unit tests for command parsing and handling
+ - compression: Unit tests for U-Boot's compression algorithms, useful for
+ security checking. It supports gzip, bzip2, lzma and lzo.
+ - image: Unit tests for images:
+ - test/image/test-imagetools.sh - multi-file images
+ - test/py/tests/test-fit.py - FIT images
+ - tracing: test/trace/test-trace.sh tests the tracing system (see
+ - verified boot: test/py/tests/test_vboot.py
+If you change or enhance any U-Boot subsystem, you should write or expand a
+test and include it with your patch series submission. Test coverage in some
+older areas of U-Boot is still somewhat limited and we need to work to improve
+Note that many of these tests are implemented as commands which you can
+run natively on your board if desired (and enabled).
+To run all tests, use 'make check'.
Running sandbox tests directly
More information about the U-Boot