Skip to content

Commit

Permalink
doc: unittest: add instructions
Browse files Browse the repository at this point in the history
Implemented suggestions from Benjamin Cabé.

Signed-off-by: Nelson Ferragut <nelson_ferragut@whirlpool.com>
  • Loading branch information
NelsonFerragut authored and nashif committed Jun 6, 2024
1 parent 7054d01 commit 0d56a3c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions doc/develop/test/ztest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -351,15 +351,14 @@ efforts into the specific module in question. This will speed up testing since
only the module will have to be compiled in, and the tested functions will be
called directly.

Examples of unit tests can be found in ``tests/unit/``. In the following
example CMakeLists.txt, note the use of ``COMPONENTS unittest`` in the
``find_package()`` command and the use of ``testbinary`` in the
``target_sources()`` command.
Examples of unit tests can be found in the :zephyr_file:`tests/unit/` folder.
In order to declare the unit tests present in a source folder, you need to add
the relevant source files to the ``testbinary`` target from the CMake
:zephyr_file:`unittest <cmake/modules/unittest.cmake>` component. See a minimal
example below:

.. code-block:: cmake
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.20.0)
project(app)
Expand Down

0 comments on commit 0d56a3c

Please sign in to comment.