From 8e3a3b484521d3feaf4be52b4841006d5f89f538 Mon Sep 17 00:00:00 2001 From: Dmitrii Golovanov Date: Wed, 20 Dec 2023 16:34:37 +0100 Subject: [PATCH] twister: coverage: GCOVR as defautlt coverage reporting tool Twister now uses GCOVR by default as the more reliable code coverage reporting tool instead of LCOV. Signed-off-by: Dmitrii Golovanov --- doc/develop/test/coverage.rst | 6 +++++- scripts/pylib/twister/twisterlib/environment.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/develop/test/coverage.rst b/doc/develop/test/coverage.rst index 84eadad1a21..60faffa1a90 100644 --- a/doc/develop/test/coverage.rst +++ b/doc/develop/test/coverage.rst @@ -142,7 +142,11 @@ or:: $ twister --coverage -p native_sim -T tests/bluetooth -which will produce ``twister-out/coverage/index.html`` with the report. +which will produce ``twister-out/coverage/index.html`` report as well as +the coverage data collected by ``gcovr`` tool in ``twister-out/coverage.json``. + +Other reports might be chosen with ``--coverage-tool`` and ``--coverage-formats`` +command line options. The process differs for unit tests, which are built with the host toolchain and require a different board:: diff --git a/scripts/pylib/twister/twisterlib/environment.py b/scripts/pylib/twister/twisterlib/environment.py index 03ac103b894..b2b00296ff8 100644 --- a/scripts/pylib/twister/twisterlib/environment.py +++ b/scripts/pylib/twister/twisterlib/environment.py @@ -305,7 +305,7 @@ structure in the main Zephyr tree: boards///""") "This option may be used multiple times. " "Default to what was selected with --platform.") - parser.add_argument("--coverage-tool", choices=['lcov', 'gcovr'], default='lcov', + parser.add_argument("--coverage-tool", choices=['lcov', 'gcovr'], default='gcovr', help="Tool to use to generate coverage report.") parser.add_argument("--coverage-formats", action="store", default=None, # default behavior is set in run_coverage