4dafcc9·Author: Joseph Parker·Closed by: Joseph Parker·2018-10-30
Description
This adds gcov coverage measurements for tests, producing annotated source code showing which lines are touched in executing the code.
There are two ways to invoke coverage in this branch:
Using Makefiles
Cleanly build everything with the flag USE_GCOV=on, run tests, and execute `gcov` on the source files. This is done by the makefile target tests_coverage:
make distclean
make tests_coverage USE_GCOV=on
After this, the annotated source files are put in the directory coverage.
Using build_gs2
Run the desired build command with the additional flag -g:
./build_gs2 -o <command> -g
This writes annotated source code to the directory 'coverage_<command>'. This allows us to determine the coverage of individual test suites, e.g.
This PR now uses makefile flags to remove the target tests_coverageif either (1) USE_GCOV is undefined, or (2) the compiler used does not support `gcov`. Respectively, the expected behaviour is
$ make tests_coverage USE_GCOV=
make: *** No rule to make target 'tests_coverage'. Stop.
$ make tests_coverage USE_GCOV=yes
Makefile.intel:126: The compiler family in use does not support USE_GCOV=(undefined))
make: *** No rule to make target 'tests_coverage'. Stop.
This adds gcov coverage measurements for tests, producing annotated source code showing which lines are touched in executing the code.
There are two ways to invoke coverage in this branch:
Using Makefiles
Cleanly build everything with the flag
USE_GCOV=on
, run tests, and execute `gcov` on the source files. This is done by the makefile targettests_coverage
:make distclean make tests_coverage USE_GCOV=on
After this, the annotated source files are put in the directory
coverage
.Using build_gs2
Run the desired build command with the additional flag
-g
:./build_gs2 -o <command> -g
This writes annotated source code to the directory 'coverage_<command>'. This allows us to determine the coverage of individual test suites, e.g.
./build_gs2 -o linear_tests -g ./build_gs2 -o nonlinear_tests -g
would write different annotated source code to
coverage_linear_tests
andcoverage_nonlinear_tests
respectively.Addresses #21
Â
UPDATE:
This PR now uses makefile flags to remove the target
tests_coverage
if either (1)USE_GCOV
is undefined, or (2) the compiler used does not support `gcov`. Respectively, the expected behaviour is$ make tests_coverage USE_GCOV= make: *** No rule to make target 'tests_coverage'. Stop. $ make tests_coverage USE_GCOV=yes Makefile.intel:126: The compiler family in use does not support USE_GCOV=(undefined)) make: *** No rule to make target 'tests_coverage'. Stop.