diff options
author | Dave Barach <dave@barachs.net> | 2019-11-06 16:58:48 -0500 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2019-11-06 23:58:23 +0000 |
commit | 8d74caa0a2e5e991908238a75651e4710764745f (patch) | |
tree | 61be455b2064138d856d2e4a06b7e9385fccc26f | |
parent | c96d618a5dd96e3a40d59860d2cdb9d5c6b71d11 (diff) |
misc: add lcov scripts, README.md
See extras/lcov
Type: feature
Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: Id229436bd94cd18bcd0f3a3d938eae2b28d5b1f5
-rw-r--r-- | extras/lcov/README.md | 46 | ||||
-rwxr-xr-x | extras/lcov/lcov_post | 9 | ||||
-rwxr-xr-x | extras/lcov/lcov_prep | 7 |
3 files changed, 62 insertions, 0 deletions
diff --git a/extras/lcov/README.md b/extras/lcov/README.md new file mode 100644 index 00000000000..ff0e7bd5e1b --- /dev/null +++ b/extras/lcov/README.md @@ -0,0 +1,46 @@ +## 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 <workspace-root> + $ make test-gcov + $ ## interrupt compilation after building the image + +or + $ cd <workspace-root>/build-root + $ make PLATFORM=vpp TAG=vpp_gcov vpp-install + +## Initialize the lcov database + + $ cd <workspace-root> + $ ./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:///<workspace-root>/build-root/html/index.html diff --git a/extras/lcov/lcov_post b/extras/lcov/lcov_post new file mode 100755 index 00000000000..f439796cbf3 --- /dev/null +++ b/extras/lcov/lcov_post @@ -0,0 +1,9 @@ +#!/bin/bash + +set -e + +cd build-root +rm -rf html +mkdir html +lcov --no-checksum --directory . --capture --output-file out.info +genhtml out.info -o html diff --git a/extras/lcov/lcov_prep b/extras/lcov/lcov_prep new file mode 100755 index 00000000000..1212d0470a2 --- /dev/null +++ b/extras/lcov/lcov_prep @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +cd build-root +rm -rf html +lcov --capture --initial --directory . --output-file lcov.out |