ztest: expand ztest functionality.

Expanding the ZTEST shell to include a command that
accepts additional parameters, such as ztest run_testcase
<suite:test> -p any_value.

Adding the new ZTEST_P macro, to create the
parameterized test.

Signed-off-by: Arkadiusz Cholewinski <arkadiuszx.cholewinski@intel.com>
This commit is contained in:
Arkadiusz Cholewinski 2024-08-13 12:14:52 +02:00 committed by Fabio Baltieri
commit f58a4c4b1c
3 changed files with 52 additions and 18 deletions

View file

@ -46,10 +46,13 @@ Below is an example of a test suite using a predicate:
Adding tests to a suite
***********************
There are 4 macros used to add a test to a suite, they are:
There are 5 macros used to add a test to a suite, they are:
* :c:macro:`ZTEST` ``(suite_name, test_name)`` - Which can be used to add a test by ``test_name`` to a
given suite by ``suite_name``.
* :c:macro:`ZTEST_P` ``(suite_name, test_name)`` - Add a parameterized test to a given suite by specifying
the ``suite_name`` and ``test_name``. You can then access the passed parameter within
the body of the test using the ``data`` pointer.
* :c:macro:`ZTEST_USER` ``(suite_name, test_name)`` - Which behaves the same as :c:macro:`ZTEST`, only
that when :kconfig:option:`CONFIG_USERSPACE` is enabled, then the test will be run in a userspace
thread.