aboutsummaryrefslogtreecommitdiffstats
path: root/docs/developer/build-run-debug/code_coverage.rst
diff options
context:
space:
mode:
authorDave Wallace <dwallacelf@gmail.com>2023-06-21 23:14:38 -0400
committerAndrew Yourtchenko <ayourtch@gmail.com>2023-06-22 13:35:28 +0000
commit1c95e12b0dd2b4902a289328e8e54fde6eed0623 (patch)
treeda7dd11cd7fc638f1189238bf2180aa6ce3f987a /docs/developer/build-run-debug/code_coverage.rst
parentfdf6fbe2e771d88beddb6ca8d8bbd39599beeb9c (diff)
tests docs: fix lcov code coverage report generation
- Updated/rebased version of https://gerrit.fd.io/r/c/vpp/+/34199 Type: test Change-Id: I43913ecfd11a4578bdb10c4be76253fe38d57976 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com> Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Diffstat (limited to 'docs/developer/build-run-debug/code_coverage.rst')
-rw-r--r--docs/developer/build-run-debug/code_coverage.rst45
1 files changed, 45 insertions, 0 deletions
diff --git a/docs/developer/build-run-debug/code_coverage.rst b/docs/developer/build-run-debug/code_coverage.rst
new file mode 100644
index 00000000000..efe750cda21
--- /dev/null
+++ b/docs/developer/build-run-debug/code_coverage.rst
@@ -0,0 +1,45 @@
+.. _lcov_code_coverage:
+
+Code coverage with lcov
+=======================
+
+Prerequisites
+-------------
+
+Ensure required packages are installed:
+
+::
+
+ $ make install-deps
+
+The Linux gcov and lcov tools can be fussy about gcc / g++ compiler
+versions. As of this writing, Ubuntu 22.04 gcov / lcov works with
+the latest gcc version (``11.3.0``).
+
+Generate coverage for a test case
+---------------------------------
+
+As a first run, in order to generate the coverage report of
+a specific plugin or test, run for example
+
+::
+
+ $ make test-cov TEST=fib
+
+Then open the file ``.build-root/test-coverage/html/index.html`` in a Chrome browser.
+
+Improving test coverage
+-----------------------
+
+When doing modifications on the test cases, you can run
+
+::
+
+ # This will run the test & report the result in the coverage data
+ $ make test-cov-build TEST=fib
+
+ # This will generate the html report with the current coverage data
+ $ make test-cov-post
+
+ # To reset the coverage data use
+ $ make test-cov-prep