Add coverage of cpp source files using cpp-coveralls

This commit is contained in:
guillaume 2019-05-20 14:26:15 -04:00
parent b3b021f034
commit e15dfb27ed
4 changed files with 13 additions and 2 deletions

View file

@ -53,4 +53,5 @@ before_script:
script:
- ./tools/ci/travis-script.sh
after_success:
- coveralls
- cpp-coveralls --exclude-pattern "/usr/*" --dump cpp_cov.json
- coveralls --merge=cpp_cov.json

View file

@ -95,6 +95,10 @@ if(optimize)
list(REMOVE_ITEM cxxflags -O2)
list(APPEND cxxflags -O3)
endif()
if(coverage)
list(APPEND cxxflags --coverage)
list(APPEND ldflags --coverage)
endif()
# Show flags being used
message(STATUS "OpenMC C++ flags: ${cxxflags}")

View file

@ -48,6 +48,9 @@ def install(omp=False, mpi=False, phdf5=False, dagmc=False):
if dagmc:
cmake_cmd.append('-Ddagmc=ON')
# Build in coverage mode for coverage testing
cmake_cmd.append('-Dcoverage=on')
# Build and install
cmake_cmd.append('..')
print(' '.join(cmake_cmd))

View file

@ -25,5 +25,8 @@ python tools/ci/travis-install.py
# Install Python API in editable mode
pip install -e .[test,vtk]
# For uploading to coveralls
# For coverage testing of the C++ source files
pip install cpp-coveralls
# For coverage testing of the Python source files
pip install coveralls