From 86a030a7ae2a46b527bd706087c8f968df6b9f5d Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Mon, 26 Jul 2021 22:52:38 +0000 Subject: [PATCH] Unit tests: running them on the host _is_ possible. ... and now even CI does it since https://github.com/thesofproject/sof/pull/4543 Also mention run-cmocks.sh Signed-off-by: Marc Herbert --- developer_guides/unit_tests.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/developer_guides/unit_tests.rst b/developer_guides/unit_tests.rst index 86e6581c..3b1008dd 100644 --- a/developer_guides/unit_tests.rst +++ b/developer_guides/unit_tests.rst @@ -54,15 +54,17 @@ Additional unit tests options can be found in :ref:`cmake`. Compiling unit tests without a cross-compilation toolchain ========================================================== -You can also compile the unit tests with your native compiler. You won't -be able to _run_ the tests but this can be convenient to test -compilation issues quickly: +You can also compile and run unit tests with your native compiler: .. code-block:: bash - cmake -B build_ut -DBUILD_UNIT_TESTS_HOST=yes -DTOOLCHAIN=gcc \ + rm -rf build_ut/ + cmake -B build_ut/ -DBUILD_UNIT_TESTS_HOST=yes \ -DBUILD_UNIT_TESTS=ON -DINIT_CONFIG=something_defconfig + make -C build_ut/ -j8 && make -C build_ut/ test +The ``scripts/run-cmocks.sh`` script does all that and can also run unit +tests with valgrind. Wrapping objects for unit tests *******************************