|
|
@@ -102,41 +102,20 @@ some_dummy_func: Counter = 20
|
|
|
...
|
|
|
```
|
|
|
|
|
|
-### Generating Lcov Report
|
|
|
+### Generating Gcovr Report
|
|
|
|
|
|
-After dumping one or more times, a coverage report can be generated by calling `cmake --build build/ --target lcov-report`. This should result in an HTML code coverage report being generated in the build directory.
|
|
|
+After dumping one or more times, a coverage report can be generated by calling `cmake --build build/ --target gcovr-report`. This should result in an HTML code coverage report being generated in the build directory.
|
|
|
|
|
|
To clean Gcov and report related data from the build directory, call `cmake --build build/ --target cov-data-clean`
|
|
|
|
|
|
-**Note:** Currently, the CMake build system on Windows does not support Lcov. However, Lcov is available in MINGW (installed through package manager). Therefore, if the project is built using the legacy GNU Make build system, call `make lcov-report` or `make cov-data-clean` instead.
|
|
|
-
|
|
|
The following log should be output when generating the coverage report:
|
|
|
|
|
|
```
|
|
|
-[1/1] Generating coverage report in: /home/user/projects/esp/tmp_idf/esp-idf/examples/system/gcov/build/coverage_report
|
|
|
+[1/2] Generating coverage report in: /home/user/esp/esp-idf/examples/system/gcov/build/coverage_report
|
|
|
Using gcov: xtensa-esp32-elf-gcov
|
|
|
-Capturing coverage data from /home/user/projects/esp/tmp_idf/esp-idf/examples/system/gcov/build
|
|
|
-Found gcov version: 8.2.0
|
|
|
-Using intermediate gcov format
|
|
|
-Scanning /home/user/projects/esp/tmp_idf/esp-idf/examples/system/gcov/build for .gcda files ...
|
|
|
-Found 3 data files in /home/user/projects/esp/tmp_idf/esp-idf/examples/system/gcov/build
|
|
|
-Processing sample/CMakeFiles/__idf_sample.dir/some_funcs.c.gcda
|
|
|
-Processing main/CMakeFiles/__idf_main.dir/gcov_example_func.c.gcda
|
|
|
-Processing main/CMakeFiles/__idf_main.dir/gcov_example_main.c.gcda
|
|
|
-Finished .info-file creation
|
|
|
-Reading data file /home/user/projects/esp/tmp_idf/esp-idf/examples/system/gcov/build/coverage_report/gcov_example.info
|
|
|
-Found 4 entries.
|
|
|
-Found common filename prefix "/home/user/projects/esp/tmp_idf/esp-idf/examples/system/gcov"
|
|
|
-Writing .css and .png files.
|
|
|
-Generating output.
|
|
|
-Processing file /home/user/projects/esp/tmp_idf/esp-idf/components/freertos/include/freertos/task.h
|
|
|
-Processing file components/sample/some_funcs.c
|
|
|
-Processing file main/gcov_example_main.c
|
|
|
-Processing file main/gcov_example_func.c
|
|
|
-Writing directory view page.
|
|
|
-Overall coverage rate:
|
|
|
- lines......: 100.0% (28 of 28 lines)
|
|
|
- functions..: 100.0% (4 of 4 functions)
|
|
|
+[2/2] cd /home/user/esp/esp-idf/examples/system/gcov/build && gcovr -r /home/user/esp/esp-idf/examples/system/gcov...a-esp32-elf-gcov -s --html-details /home/user/esp/esp-idf/examples/system/gcov/build/coverage_report/html/index.htm
|
|
|
+lines: 100.0% (27 out of 27)
|
|
|
+branches: 100.0% (2 out of 2)
|
|
|
```
|
|
|
|
|
|
## Troubleshooting
|
|
|
@@ -162,6 +141,10 @@ This issue can be resolved in the following ways:
|
|
|
* Reset the board by issuing the `reset` command via telnet
|
|
|
* Restart OpenOCD
|
|
|
|
|
|
-### Outdated Lcov
|
|
|
+### gcovr not found
|
|
|
+
|
|
|
+gcovr can be installed from the package database of your operating system or directly as a Python package, e.g:
|
|
|
|
|
|
-Due to `lcov` not being part of the GCC bundle, it is possible that the format of the GCOV binary data can change resulting in `lcov` failing to understand it. Therefore, it is always better to use the latest `lcov` version from the [Lcov repo](https://github.com/linux-test-project/lcov).
|
|
|
+```
|
|
|
+ python -m pip install gcovr
|
|
|
+```
|