-
Notifications
You must be signed in to change notification settings - Fork 2
Test Coverage
As of PR #188, TPS can generate coverage metrics for the test suite.
The coverage metrics are generated by gcov and gcovr. gcov is a
standard part of the GCC suite. gcovr is a python package (see
https://gcovr.com/en/stable/ and https://github.com/gcovr/gcovr). It
is included in the TPS test container or can be installed via pip install gcovr for working outside the container.
To generate data for coverage analysis, it is necessary to build using
--coverage. To detect the necessary tools and add this flag, the
--enable-coverage configure option is provided. To generate
coverage information, do the following:
- Configure with
--enable-coverage
$ mkdir build
$ ./bootstrap
$ cd build
$ ../configure CXXFLAGS="-g -O2 -Wall" --enable-coverage
- Build TPS as usual
$ make
- Build the
coveragetarget
$ make coverage
The coverage target will run the test suite (via make check) and
then run gcovr to generate coverage statistics. If you are
interested in examining the coverage from only a subset of the tests,
for example just cyl3d.test, use
$ make coverage TESTS="cyl3d.test"
- Examine the results, which are available as html in
<tps-build-dir>/coverage/html/gcovr-report.html