1 # Code coverage analysis with lcov {#lcov_code_coverage}
5 The Linux gcov and lcov tools are fussy about gcc / g++ compiler
6 versions. As of this writing, Ubuntu 18.04 gcov / lcov work with
7 these toolchain versions:
10 gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
12 g++ (Ubuntu 8.3.0-6ubuntu1~18.04.1) 8.3.0
15 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
18 You'll need to install the following additional packages:
20 $ sudo apt-get install gcovr ggcov lcov
22 ## Compile an instrumented vpp image
28 $ ## interrupt compilation after building the image
31 $ cd <workspace-root>/build-root
32 $ make PLATFORM=vpp TAG=vpp_gcov vpp-install
34 ## Initialize the lcov database
37 $ ./extras/lcov/lcov_prep
38 $ make test-gcov or make TEST=my_test test-gcov
39 $ # repeat or vary as desired to increase reported coverage
40 $ # Generate the report:
41 $ ./extras/lcov/lcov_post
43 You can run vpp manually, do anything you like. Results are cumulative
44 until you re-run the "prep" script.
46 ## Look at the results
48 Point a browser at file:///<workspace-root>/build-root/html/index.html