1 .. _lcov_code_coverage:
3 Code coverage with lcov
4 =======================
9 The Linux gcov and lcov tools are fussy about gcc / g++ compiler
10 versions. As of this writing, Ubuntu 18.04 gcov / lcov work with these
13 $ gcc –version gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 $ g++ –version
14 g++ (Ubuntu 8.3.0-6ubuntu1~18.04.1) 8.3.0
17 https://askubuntu.com/questions/26498/how-to-choose-the-default-gcc-and-g-version
18 for information on how to install multiple gcc / g++ versions, and
21 You’ll need to install the following additional packages:
23 $ sudo apt-get install gcovr ggcov lcov
25 Compile an instrumented vpp image
26 ---------------------------------
30 $ cd $ make test-gcov $ ## interrupt compilation after building the
33 or $ cd /build-root $ make PLATFORM=vpp TAG=vpp_gcov vpp-install
35 Initialize the lcov database
36 ----------------------------
38 $ cd $ ./extras/lcov/lcov_prep $ make test-gcov or make TEST=my_test
39 test-gcov $ # repeat or vary as desired to increase reported coverage $
40 # Generate the report: $ ./extras/lcov/lcov_post
42 You can run vpp manually, do anything you like. Results are cumulative
43 until you re-run the “prep” script.
48 Point a browser at file:////build-root/html/index.html