tcp: options support into pg
[vpp.git] / extras / lcov / README.rst
1 .. _lcov_code_coverage:
2
3 Code coverage with lcov
4 =======================
5
6 Prerequisites
7 -------------
8
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
11 toolchain versions:
12
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
15
16 Refer to
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
19 switch between them.
20
21 You’ll need to install the following additional packages:
22
23 $ sudo apt-get install gcovr ggcov lcov
24
25 Compile an instrumented vpp image
26 ---------------------------------
27
28 Two ways:
29
30 $ cd $ make test-gcov $ ## interrupt compilation after building the
31 image
32
33 or $ cd /build-root $ make PLATFORM=vpp TAG=vpp_gcov vpp-install
34
35 Initialize the lcov database
36 ----------------------------
37
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
41
42 You can run vpp manually, do anything you like. Results are cumulative
43 until you re-run the “prep” script.
44
45 Look at the results
46 -------------------
47
48 Point a browser at file:////build-root/html/index.html