From ccf69386b79f6987cfebaeb823b5234a93cb118c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 7 Mar 2021 17:34:38 -0700 Subject: doc: Tidy up testing section Tweak this so the output looks a little better. Signed-off-by: Simon Glass Reviewed-by: Heinrich Schuchardt --- doc/develop/testing.rst | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'doc/develop/testing.rst') diff --git a/doc/develop/testing.rst b/doc/develop/testing.rst index 4bc9ca3a6a..bc74eb53e3 100644 --- a/doc/develop/testing.rst +++ b/doc/develop/testing.rst @@ -8,14 +8,14 @@ tested and what tests you should write when adding a new feature. Running tests ------------- -To run most tests on sandbox, type this: +To run most tests on sandbox, type this:: make check in the U-Boot directory. Note that only the pytest suite is run using this command. -Some tests take ages to run. To run just the quick ones, type this: +Some tests take ages to run. To run just the quick ones, type this:: make qcheck @@ -35,9 +35,9 @@ either on sandbox or on real hardware. It relies on the U-Boot console to inject test commands and check the result. It is slower to run than C code, but provides the ability to unify lots of tests and summarise their results. -You can run the tests on sandbox with: +You can run the tests on sandbox with:: - ./test/py/test.py --bd sandbox --build + ./test/py/test.py --bd sandbox --build This will produce HTML output in build-sandbox/test-log.html @@ -58,10 +58,14 @@ Ad-hoc tests There are several ad-hoc tests which run outside the pytest environment: - test/fs - File system test (shell script) - test/image - FIT and legacy image tests (shell script and Python) - test/stdint - A test that stdint.h can be used in U-Boot (shell script) - trace - Test for the tracing feature (shell script) +test/fs + File system test (shell script) +test/image + FIT and legacy image tests (shell script and Python) +test/stdint + A test that stdint.h can be used in U-Boot (shell script) +trace + Test for the tracing feature (shell script) TODO: Move these into pytest. -- cgit From 8d16ebdf81cda3e07eb76cd7f2efc52cbaf0475b Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 7 Mar 2021 17:34:39 -0700 Subject: doc: Document make tcheck Add a comment about this option in the documentation. Also mention the script that runs these combinations. Signed-off-by: Simon Glass Reviewed-by: Heinrich Schuchardt --- doc/develop/testing.rst | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'doc/develop/testing.rst') diff --git a/doc/develop/testing.rst b/doc/develop/testing.rst index bc74eb53e3..f01ca4dc40 100644 --- a/doc/develop/testing.rst +++ b/doc/develop/testing.rst @@ -15,10 +15,20 @@ To run most tests on sandbox, type this:: in the U-Boot directory. Note that only the pytest suite is run using this command. -Some tests take ages to run. To run just the quick ones, type this:: +Some tests take ages to run and are marked with @pytest.mark.slow. To run just +the quick ones, type this:: make qcheck +It is also possible to run just the tests for tools (patman, binman, etc.). +Such tests are included with those tools, i.e. no actual U-Boot unit tests are +run. Type this:: + + make tcheck + +All of the above use the test/run script with a paremeter to select which tests +are run. + Sandbox ------- -- cgit From 4c8850aafc10d368cef575b31d1b931d3d2ca597 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 7 Mar 2021 17:34:42 -0700 Subject: doc: Explain how to run tests without pytest Add details about how to run a sandbox test directly, without using pytest. This is more convenient for rapid development, since it is faster and allows easier use of a debugger. Also mention sandbox_flattree as an example of the different sandbox builds available. Signed-off-by: Simon Glass --- doc/develop/testing.rst | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'doc/develop/testing.rst') diff --git a/doc/develop/testing.rst b/doc/develop/testing.rst index f01ca4dc40..87c90eee27 100644 --- a/doc/develop/testing.rst +++ b/doc/develop/testing.rst @@ -36,6 +36,7 @@ U-Boot can be built as a user-space application (e.g. for Linux). This allows test to be executed without needing target hardware. The 'sandbox' target provides this feature and it is widely used in tests. +See :doc:`tests_sandbox` for more information. Pytest Suite ------------ @@ -51,8 +52,16 @@ You can run the tests on sandbox with:: This will produce HTML output in build-sandbox/test-log.html +Some tests run with other versions of sandbox. For example sandbox_flattree +runs the tests with livetree (the hierachical devicetree) disabled. You can +also select particular tests with -k:: + + ./test/py/test.py --bd sandbox_flattree --build -k hello + See test/py/README.md for more information about the pytest suite. +See :doc:`tests_sandbox` for how to run tests directly (not through pytest). + tbot ---- -- cgit From e56c09457e07dc32cffeac5b7fdbb06f5a773d16 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 7 Mar 2021 17:34:43 -0700 Subject: doc: Document how sandbox_spl_tests are run Add a few notes about the sandbox_spl tests, since they are special. Signed-off-by: Simon Glass Acked-by: Pratyush Yadav --- doc/develop/testing.rst | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'doc/develop/testing.rst') diff --git a/doc/develop/testing.rst b/doc/develop/testing.rst index 87c90eee27..b181c2e2e4 100644 --- a/doc/develop/testing.rst +++ b/doc/develop/testing.rst @@ -58,6 +58,11 @@ also select particular tests with -k:: ./test/py/test.py --bd sandbox_flattree --build -k hello +There are some special tests that run in SPL. For this you need the sandbox_spl +build:: + + ./test/py/test.py --bd sandbox_spl --build -k test_spl + See test/py/README.md for more information about the pytest suite. See :doc:`tests_sandbox` for how to run tests directly (not through pytest). -- cgit From fc3283314539d6c3fb577359f6cb364c19c13726 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 7 Mar 2021 17:35:17 -0700 Subject: doc: Explain briefly how to write new tests Add a second on writing tests, covering when to use Python and C, where to put the tests, etc. Add a link to the existing Python test documentation. Signed-off-by: Simon Glass --- doc/develop/testing.rst | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/develop/testing.rst') diff --git a/doc/develop/testing.rst b/doc/develop/testing.rst index b181c2e2e4..ced13ac8bb 100644 --- a/doc/develop/testing.rst +++ b/doc/develop/testing.rst @@ -117,6 +117,8 @@ or is covered sparingly. So here are some suggestions: is much easier to add onto a test - writing a new large test can seem daunting to most contributors. +See doc:`tests_writing` for how to write tests. + Future work ----------- -- cgit