From a2c9509a4ab22380937a2b613fcc518da22f5166 Mon Sep 17 00:00:00 2001 From: Nathan Skrzypczak Date: Fri, 8 Oct 2021 14:05:58 +0200 Subject: docs: convert extras doc md->rst Type: improvement Change-Id: Ie3b25a86b99098d2b3a21a11fc73234c8ed589d6 Signed-off-by: Nathan Skrzypczak --- extras/lcov/README.rst | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 extras/lcov/README.rst (limited to 'extras/lcov/README.rst') diff --git a/extras/lcov/README.rst b/extras/lcov/README.rst new file mode 100644 index 00000000000..3dab9510215 --- /dev/null +++ b/extras/lcov/README.rst @@ -0,0 +1,48 @@ +.. _lcov_code_coverage: + +Code coverage with lcov +======================= + +Prerequisites +------------- + +The Linux gcov and lcov tools are fussy about gcc / g++ compiler +versions. As of this writing, Ubuntu 18.04 gcov / lcov work with these +toolchain versions: + +$ gcc –version gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 $ g++ –version +g++ (Ubuntu 8.3.0-6ubuntu1~18.04.1) 8.3.0 + +Refer to +https://askubuntu.com/questions/26498/how-to-choose-the-default-gcc-and-g-version +for information on how to install multiple gcc / g++ versions, and +switch between them. + +You’ll need to install the following additional packages: + +$ sudo apt-get install gcovr ggcov lcov + +Compile an instrumented vpp image +--------------------------------- + +Two ways: + +$ cd $ make test-gcov $ ## interrupt compilation after building the +image + +or $ cd /build-root $ make PLATFORM=vpp TAG=vpp_gcov vpp-install + +Initialize the lcov database +---------------------------- + +$ cd $ ./extras/lcov/lcov_prep $ make test-gcov or make TEST=my_test +test-gcov $ # repeat or vary as desired to increase reported coverage $ +# Generate the report: $ ./extras/lcov/lcov_post + +You can run vpp manually, do anything you like. Results are cumulative +until you re-run the “prep” script. + +Look at the results +------------------- + +Point a browser at file:////build-root/html/index.html -- cgit 1.2.3-korg