How to install LCOV on Windows (in MSYS2)
LCOV is a graphical front-end for GCC code coverage testing tool gcov.
MSYS2 is a newer fork of Cygwin than more widely known MinGW/MSYS. So MSYS and MSYS2 are two different projects.
This note describes how to install LCOV on Windows (in MSYS2) and generate test coverage reports.
Step 1: Install MSYS2
Follow instructions on http://msys2.github.io/
Step 2: Install LCOV
There is a PKGBUILD file (a package-building recipe) for
LCOV on Archlinux.
Fortunately, it works in MSYS2 too. To build a package you may need to install
Download LCOV package source:
curl https://aur.archlinux.org/packages/lc/lcov/lcov.tar.gz | tar zxf - cd lcov/
Read PKGBUILD first, to make sure it does what you want.
Build and install the package
-clean after build,
-sync (install) missing dependencies,
-iinstall the package after successful build.
¹) To install a package
Archlinux MSYS2, run:
pacman -Su whatever
To search for available packages:
pacman -Ss whatever
Step 3: Use LCOV
Just use LCOV normally.
Build your tests with
-g(debug) flags using GCC.
Collect coverage data:
lcov --capture --directory project-dir --output-file coverage.info
Generate HTML report:
genhtml coverage.info --output-directory out