Skip to content

Commit

Permalink
Coverage (SimVascular#42)
Browse files Browse the repository at this point in the history
* add coverage

* fix indent

* install lcov

* fix install

* fix paths

* upgrade python

* change directories

* remove --ignore-errors inconsistent

* remove --ignore-errors unmapped

* double quotes

* double asterik

* exclude usr

* too much exclude

* explucde instead of remove

* change back " to '

* build twice

* use tempdir

* remove unused helper functions

* test mean output

* test io derivative

* test io mean derivative

* add mean variable (doesn't run yet)

* add missing assert

* split test files

* delete overlap

* add variable derivative

* add tests

* format and simplify
  • Loading branch information
mrp089 authored Sep 21, 2023
1 parent 7d8afbf commit 06d92ed
Show file tree
Hide file tree
Showing 23 changed files with 2,202 additions and 258 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codechecks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
clang-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt install clang-format
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
documentation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Make build directory
run: mkdir docs/build
- name: Build doxygen documentation
Expand Down
28 changes: 22 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ jobs:
os: [ubuntu-20.04, ubuntu-22.04, macos-11, macos-12]
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install ubuntu dependencies
if: ${{ matrix.os == 'ubuntu-*' }}
run: sudo apt update && sudo apt install build-essential cmake
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt update && sudo apt install build-essential cmake lcov
- name: Install svZeroDPlus
run: |
conda create -n zerod python=3.9
conda create -n zerod python=3.11.4
conda run -n zerod pip install -e ".[dev]"
- name: Test the build
run: |
cd tests
conda run -n zerod pytest
conda run -n zerod pytest -v --durations=0
- name: Build using CMake
run: |
mkdir Release
Expand All @@ -38,4 +38,20 @@ jobs:
cd test_01
./svZeroD_interface_test01 ../../../../Release ../../test_01/svzerod_3Dcoupling.json
cd ../test_02
./svZeroD_interface_test02 ../../../../Release ../../test_02/svzerod_tuned.json
./svZeroD_interface_test02 ../../../../Release ../../test_02/svzerod_tuned.json
- name: Generate code coverage
if: startsWith(matrix.os, 'ubuntu-22.04')
run: |
cd Release
cmake -DENABLE_COVERAGE=ON ..
cmake --build .
cd ../tests
conda run -n zerod pytest -v --durations=0 --coverage
cd ../Release
make coverage
- name: Save coverage report
if: startsWith(matrix.os, 'ubuntu-22.04')
uses: actions/upload-artifact@v3
with:
name: coverage_report
path: Release/coverage
22 changes: 22 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,28 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
project(svZeroDSolver)
include(FetchContent)

# -----------------------------------------------------------------------------
# Enable code coverage
# -----------------------------------------------------------------------------
set(ENABLE_COVERAGE OFF CACHE BOOL "Enable code coverage")
# coverage
if(ENABLE_COVERAGE)
# set compiler flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -coverage -g")

# find required tools
find_program(LCOV lcov REQUIRED)
find_program(GENHTML genhtml REQUIRED)

# add coverage target
add_custom_target(coverage
# gather data
COMMAND ${LCOV} --directory . --capture --output-file coverage.info --ignore-errors gcov --exclude '/usr/include/*' --exclude '/usr/lib/*' --exclude '*/_deps/*'
# generate report
COMMAND ${GENHTML} --demangle-cpp -o coverage coverage.info
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
endif()

# -----------------------------------------------------------------------------
# Fetch Eigen
# -----------------------------------------------------------------------------
Expand Down
57 changes: 0 additions & 57 deletions src/helpers/endswith.hpp

This file was deleted.

53 changes: 0 additions & 53 deletions src/helpers/startswith.hpp

This file was deleted.

1 change: 0 additions & 1 deletion src/interface/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "algebra/sparsesystem.hpp"
#include "algebra/state.hpp"
#include "helpers/debug.hpp"
#include "helpers/endswith.hpp"
#include "io/configreader.hpp"
#include "io/csvwriter.hpp"
#include "model/model.hpp"
Expand Down
1 change: 0 additions & 1 deletion src/io/configreader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#include <string>

#include "../helpers/debug.hpp"
#include "../helpers/startswith.hpp"
#include "../model/model.hpp"

namespace IO {
Expand Down
1 change: 0 additions & 1 deletion src/io/csvwriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include <vector>

#include "../algebra/state.hpp"
#include "../helpers/startswith.hpp"
#include "../model/model.hpp"

namespace IO {
Expand Down
1 change: 0 additions & 1 deletion src/optimize/calibrate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#include <nlohmann/json.hpp>

#include "helpers/debug.hpp"
#include "helpers/endswith.hpp"
#include "levenbergmarquardtoptimizer.hpp"
#include "model/model.hpp"

Expand Down
1 change: 0 additions & 1 deletion src/solve/solver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include "algebra/integrator.hpp"
#include "algebra/state.hpp"
#include "helpers/debug.hpp"
#include "helpers/endswith.hpp"
#include "io/configreader.hpp"
#include "io/csvwriter.hpp"
#include "model/model.hpp"
Expand Down
Loading

0 comments on commit 06d92ed

Please sign in to comment.