Table of Contents
IMPORTANT WARNING
This Page is obsolete. Please refer to www.abinit.org!
Code Coverage
Motivations
In computer science, code coverage is a measure used to describe the degree to which the source code of a program is tested by a particular test suite. A program with high code coverage has been more thoroughly tested and has a lower chance of containing software bugs than a program with low code coverage. Many different metrics can be used to calculate code coverage; some of the most basic are the percent of program subroutines and the percent of program statements called during execution of the test suite.[ 1 ]
We aim that the test suite covers all the functionalities of ABINIT.
How does it work?
ABINIT is built with special options such that every function that is exercised (executed) in the program(s) is mapped back to the function points in the source code.
A .gcno file is generated when the source file is compiled with the GCC -ftest-coverage option. It contains information to reconstruct the basic block graphs and assign source line numbers to blocks.[ 2 ]
A .gcda file is generated when a program containing object files built with the GCC -fprofile-arcs option is executed. A separate .gcda file is created for each object file compiled with this option. It contains arc transition counts, and some summary information[ 2 ].
We use lcov to analyze the .gcda files for generating a html report (http://ltp.sourceforge.net/coverage/lcov.php)
How to trigger a coverage report ?
There is one slave dedicated to “on-demand” execution of branches by the developers, that produces a code coverage report, at present, higgs_gnu_7.5_cov. It can be launched by the general “on-demand” interface (see Use of buildbot for ABINIT, contact Jean-Michel or Xavier if you do not yet have access to it).
Code coverage reports from recent runs of the tests are available here
If you see parts of the code which are not well tested, please contribute to improving coverage by writing new tests !
References
[ 1 ] http://en.wikipedia.org/wiki/Code_coverage
[ 2 ] http://gcc.gnu.org/onlinedocs/gcc-4.2.4/gcc/index.html#toc_Gcov