From 0d56a3c3f4c333b08b0fecde02a9c032ee6c2d2f Mon Sep 17 00:00:00 2001 From: Nelson Ferragut Date: Wed, 15 May 2024 07:53:14 -0400 Subject: [PATCH] doc: unittest: add instructions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implemented suggestions from Benjamin Cabé. Signed-off-by: Nelson Ferragut --- doc/develop/test/ztest.rst | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/doc/develop/test/ztest.rst b/doc/develop/test/ztest.rst index da3f9b209b81..e589bc907f8b 100644 --- a/doc/develop/test/ztest.rst +++ b/doc/develop/test/ztest.rst @@ -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 ` component. See a minimal +example below: .. code-block:: cmake - # SPDX-License-Identifier: Apache-2.0 - cmake_minimum_required(VERSION 3.20.0) project(app)