From e15dfb27ede96775ab384a423cc801154ff4f361 Mon Sep 17 00:00:00 2001 From: guillaume Date: Mon, 20 May 2019 14:26:15 -0400 Subject: [PATCH 1/3] Add coverage of cpp source files using cpp-coveralls --- .travis.yml | 3 ++- CMakeLists.txt | 4 ++++ tools/ci/travis-install.py | 3 +++ tools/ci/travis-install.sh | 5 ++++- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ade182788d..9e51a70eb1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 4033d2466d..fea014f12d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}") diff --git a/tools/ci/travis-install.py b/tools/ci/travis-install.py index 9c12387fed..9a9b06dae1 100644 --- a/tools/ci/travis-install.py +++ b/tools/ci/travis-install.py @@ -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)) diff --git a/tools/ci/travis-install.sh b/tools/ci/travis-install.sh index 2bca50e4b4..4e32f31cc0 100755 --- a/tools/ci/travis-install.sh +++ b/tools/ci/travis-install.sh @@ -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 From 8ce7a63a045a69908920a33d91df981ccc03c3c8 Mon Sep 17 00:00:00 2001 From: Giud Date: Tue, 21 May 2019 23:05:23 -0400 Subject: [PATCH 2/3] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9e51a70eb1..d0b3de9640 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,5 +53,5 @@ before_script: script: - ./tools/ci/travis-script.sh after_success: - - cpp-coveralls --exclude-pattern "/usr/*" --dump cpp_cov.json + - cpp-coveralls --exclude-pattern "/usr/*" -e "build" --dump cpp_cov.json - coveralls --merge=cpp_cov.json From 55b9db9c446b7082bb11ad8041b10700fc7bc11d Mon Sep 17 00:00:00 2001 From: Giud Date: Wed, 22 May 2019 12:27:46 -0400 Subject: [PATCH 3/3] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d0b3de9640..096459b00a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,5 +53,5 @@ before_script: script: - ./tools/ci/travis-script.sh after_success: - - cpp-coveralls --exclude-pattern "/usr/*" -e "build" --dump cpp_cov.json + - cpp-coveralls -i src -i include --exclude-pattern "/usr/*" --dump cpp_cov.json - coveralls --merge=cpp_cov.json