Skip to content
Izaak Beekman edited this page Jun 13, 2016 · 14 revisions

Test coverage

The procedure level test coverage documentation is now automatically generated by Travis-CI, and can be found here.

The code coverage information on that page was automatically generated by the FoBiS.py build tool and gcov for the master branch of json-fortran. This same information is sent to Codecov.io and produces the badge shown on the README.md. Please use Codecov.io to find uncovered hunks, and then add unit tests to test them. This is a good place to start when trying to increase code coverage. Let’s keep the coverage trending upwards over time!

codecov.io

Note: gcov is currently producing erroneous output for the unicode enabled build, which results in wrong unified coverage information, and which we have gone through great pains to correct. If/when the gcov bug is fixed, the work around needs to be removed.

Generating the coverage information

Here is a summary of how to manually reproduce the merged coverage analysis, generated by the build script and uploaded automatically via Travis-CI:

Since Unicode support has been added to json-fortran and the library has undergone some speed optimization certain code paths are only reachable with Unicode enabled or Unicode disabled. Because of this, to get a full picture of the test coverage, coverage reports must be merged from building the library and running the tests with and without Unicode support. To merge gcov results, use gccr (with the -n and -c flags) from: https://github.com/eel3/gccr. Here is the procedure:

./build.sh --coverage # build library & run tests, no Unicode
gcov -o lib src/json_module.F90
mv json_module.F90.gcov json_module-no-unicode.F90.gcov
rm -r lib bin
./build.sh --coverage --enable-unicode # build & test with unicode
gcov -o lib src/json_module.F90
mv json_module.F90.gcov json_module-unicode.F90.gcov
gccr.pl -n -c json_module-no-unicode.F90.gcov no-unicode json_module-unicode.F90.gcov unicode > json_module.F90.gcov
rm json_module-no-unicode.F90.gcov json_module-unicode.F90.gcov # just leave the merged copy
FoBiS.py rule -gcov_analyzer . # produce json_module.F90.gcov.md