Skip to content

Commit

Permalink
Merge "build(coverage): break dependency between 'run-coverage' and '…
Browse files Browse the repository at this point in the history
…run-unittests' rules" into integration
  • Loading branch information
soby-mathew authored and TrustedFirmware Code Review committed Sep 22, 2023
2 parents c6213fa + e965318 commit ade9811
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 11 deletions.
7 changes: 0 additions & 7 deletions cmake/CoverageReport.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,4 @@ if(RMM_COVERAGE)
-x ${COVERAGE_OUTPUT}.xml
${HTML_REPORT}
${CMAKE_BINARY_DIR})
#
# Add dependency on unit test target if being invoked in a
# multi-target build command line.
#
if(RMM_UNITTESTS)
add_dependencies(run-coverage run-unittests)
endif()
endif() # RMM_COVERAGE
39 changes: 35 additions & 4 deletions docs/getting_started/build-options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,23 +164,54 @@ Run checkincludes on entire codebase:
14. Perform unit tests on development host:

Build and run unit tests on host platform. It is recommended to do the Debug
build of RMM.
Build and run unit tests on host platform. It is recommended to enable the
Debug build of RMM.

.. code-block:: bash
cmake -DRMM_CONFIG=host_defcfg -DHOST_VARIANT=host_test -DCMAKE_BUILD_TYPE=Debug -S ${RMM_SOURCE_DIR} -B ${RMM_BUILD_DIR}
cmake --build ${RMM_BUILD_DIR} -- run-unittests
Run coverage analysis on unit tests.
Run unittests for a specific test group(s) (e.g. unittests whose group starts with 'xlat')

.. code-block:: bash
cmake -DRMM_CONFIG=host_defcfg -DHOST_VARIANT=host_test -DCMAKE_BUILD_TYPE=Debug -S ${RMM_SOURCE_DIR} -B ${RMM_BUILD_DIR}
cmake --build ${RMM_BUILD_DIR} -- build -j
${RMM_BUILD_DIR}/Debug/rmm.elf -gxlat -v -r${NUMBER_OF_TEST_ITERATIONS}
15. Generate Coverage Report.

It is possible to generate a coverage report for a last execution of the host
platform (whichever the variant) by using the `run-coverage` build target.

For example, to generate coverate report on the whole set of unittests:

.. code-block:: bash
cmake -DRMM_CONFIG=host_defcfg -DHOST_VARIANT=host_test -DRMM_COVERAGE=ON -DCMAKE_BUILD_TYPE=Debug -S ${RMM_SOURCE_DIR} -B ${RMM_BUILD_DIR}
cmake --build ${RMM_BUILD_DIR} -- run-unittests
cmake --build ${RMM_BUILD_DIR} -- run-coverage
Run coverage analysis on a specific set of unittests (e.g. unittests whose group starts with 'xlat')

.. code-block:: bash
cmake -DRMM_CONFIG=host_defcfg -DHOST_VARIANT=host_test -DRMM_COVERAGE=ON -DCMAKE_BUILD_TYPE=Debug -S ${RMM_SOURCE_DIR} -B ${RMM_BUILD_DIR}
cmake --build ${RMM_BUILD_DIR} -- build -j
${RMM_BUILD_DIR}/Debug/rmm.elf -gxlat
cmake --build ${RMM_BUILD_DIR} -- run-coverage
Run coverage analysis on the `host_build` variant of host platform:

.. code-block:: bash
cmake -DRMM_CONFIG=host_defcfg -DHOST_VARIANT=host_build -DRMM_COVERAGE=ON -DCMAKE_BUILD_TYPE=Debug -S ${RMM_SOURCE_DIR} -B ${RMM_BUILD_DIR}
${RMM_BUILD_DIR}/Debug/rmm.elf
cmake --build ${RMM_BUILD_DIR} -- run-coverage
The above commands will automatically generate the HTML coverage report in folder
`build/Debug/coverage` within build directory. The HTML generation can be
`build/Debug/coverage` within the build directory. The HTML generation can be
disabled by setting `RMM_HTML_COV_REPORT=OFF`.

.. _build_options_table:
Expand Down

0 comments on commit ade9811

Please sign in to comment.