Skip to content

Commit

Permalink
Merge pull request #3 from wgyang/main
Browse files Browse the repository at this point in the history
Fix integration test errors
  • Loading branch information
ktbolt authored Apr 16, 2024
2 parents 614de21 + 6541336 commit 5673d26
Show file tree
Hide file tree
Showing 24 changed files with 391 additions and 94 deletions.
58 changes: 0 additions & 58 deletions .github/workflows/test.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/test_macos12.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: macOS 12
on: [push, pull_request]
jobs:
test:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- name: Install MacOS dependencies
run: |
brew reinstall -v gcc
brew install -v cmake vtk openblas lapack mesa open-mpi qt
brew install lcov
sudo ln -s /usr/local/opt/qt5/mkspecs /usr/local/mkspecs
sudo ln -s /usr/local/opt/qt5/plugins /usr/local/plugins
- name: Build svFSIplus
run: |
mkdir build
cd build
cmake -DENABLE_COVERAGE=ON -DENABLE_ARRAY_INDEX_CHECKING=ON -DENABLE_UNIT_TEST=ON ..
make -j2
- name: Install test dependencies
run: |
conda create -n svfsiplus python=3.9
conda run -n svfsiplus pip install pytest pytest-cov pytest-mock numpy meshio pandas
- name: Run integration tests
run: |
git lfs pull
cd tests
conda run -n svfsiplus pytest -rPv --durations=0
- name: Run unit tests
run: |
cd build/svFSI-build/Source/svFSI
ctest --verbose
25 changes: 25 additions & 0 deletions .github/workflows/test_ubuntu20.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Ubuntu 20.04
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-20.04
container: msalvad/ubuntu20_vtk9:v1
steps:
- uses: actions/checkout@v3
- name: Build svFSIplus
run: |
mkdir build
cd build
cmake -DENABLE_COVERAGE=ON -DENABLE_ARRAY_INDEX_CHECKING=ON -DENABLE_UNIT_TEST=ON ..
make -j2
cd ..
- name: Run integration tests
run: |
git config --global --add safe.directory /__w/svFSIplus/svFSIplus
git lfs pull
cd tests
conda run -n svfsiplus pytest -rPv --durations=0
- name: Run unit tests
run: |
cd build/svFSI-build/Source/svFSI
ctest --verbose
38 changes: 38 additions & 0 deletions .github/workflows/test_ubuntu22.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Ubuntu 22.04
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-22.04
container: msalvad/ubuntu22_vtk9:v1
steps:
- uses: actions/checkout@v3
- name: Build svFSIplus
run: |
mkdir build
cd build
cmake -DENABLE_COVERAGE=ON -DENABLE_ARRAY_INDEX_CHECKING=ON -DENABLE_UNIT_TEST=ON ..
make -j2
cd ..
- name: Run integration tests
run: |
git config --global --add safe.directory /__w/svFSIplus/svFSIplus
git lfs pull
cd tests
conda run -n svfsiplus pytest -rPv --durations=0
- name: Run unit tests
run: |
cd build/svFSI-build/Source/svFSI
ctest --verbose
- name: Generate code coverage
run: |
cd build/svFSI-build
make coverage
- name: Save coverage report
uses: actions/upload-artifact@v3
with:
name: coverage_report
path: build/svFSI-build/coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ set(SV_PETSC_DIR "" CACHE STRING "Path to a local install of the PETSc linear al
set(ENABLE_COVERAGE OFF CACHE BOOL "Enable code coverage")
set(ENABLE_ARRAY_INDEX_CHECKING OFF CACHE BOOL "Enable Array index checking")
set(SV_LOCAL_VTK_PATH "" CACHE STRING "Path to a local build of VTK.")
set(ENABLE_UNIT_TEST OFF CACHE BOOL "Enable Unit Test by Google Test")

#-----------------------------------------------------------------------------
# RPATH handling
Expand Down Expand Up @@ -147,6 +148,7 @@ ExternalProject_Add(svFSI
#-DSV_USE_PETSC:BOOL=${SV_USE_PETSC}
-DSV_PETSC_DIR:STRING=${SV_PETSC_DIR}
-DENABLE_COVERAGE:BOOL=${ENABLE_COVERAGE}
-DENABLE_UNIT_TEST:BOOL=${ENABLE_UNIT_TEST}
-DENABLE_ARRAY_INDEX_CHECKING:BOOL=${ENABLE_ARRAY_INDEX_CHECKING}
-DSV_LOCAL_VTK_PATH:STRING=${SV_LOCAL_VTK_PATH}
${SV_APPLE_CMAKE_ARGS}
Expand Down
52 changes: 52 additions & 0 deletions Code/Source/svFSI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -260,4 +260,56 @@ if(ENABLE_COVERAGE)
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
endif()

# unit tests and Google Test
if(ENABLE_UNIT_TEST)

# link pthread on ubuntu20
find_package(Threads REQUIRED)

# install Google Test
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
)
FetchContent_MakeAvailable(googletest)
enable_testing()
include(GoogleTest)

# add test.cpp for unit test

# remove the main.cpp and add test.cpp
list(APPEND CSRCS "../../../tests/unitTests/test.cpp")
list(REMOVE_ITEM CSRCS "main.cpp")

# include source files (same as what svFSI does except for main.cpp)
add_executable(run_all_unit_tests ${CSRCS})

# libraries
target_link_libraries(run_all_unit_tests
${GLOBAL_LIBRARIES}
${INTELRUNTIME_LIBRARIES}
${ZLIB_LIBRARY}
${BLAS_LIBRARIES}
${LAPACK_LIBRARIES}
${METIS_SVFSI_LIBRARY_NAME}
${PARMETIS_SVFSI_LIBRARY_NAME}
${TETGEN_LIBRARY_NAME}
${TINYXML_LIBRARY_NAME}
${SV_LIB_SVFSILS_NAME}${SV_MPI_NAME_EXT}
${VTK_LIBRARIES}
)

# link Google Test
target_link_libraries(
run_all_unit_tests
gtest
GTest::gtest_main
pthread # link pthread on ubuntu20
)

# gtest_discover_tests(runUnitTest)
add_test(NAME all_unit_tests COMMAND run_all_unit_tests)

endif()

4 changes: 2 additions & 2 deletions tests/cases/cep/cable_TTP_1d/result_001.vtu
Git LFS file not shown
6 changes: 3 additions & 3 deletions tests/cases/cep/cable_TTP_1d/svFSI.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
<Add_equation type="CEP" >
<Coupled> true </Coupled>
<Min_iterations> 1 </Min_iterations>
<Max_iterations> 5 </Max_iterations>
<Tolerance> 1e-6 </Tolerance>
<Max_iterations> 2 </Max_iterations>
<Tolerance> 1e-12 </Tolerance>

<Domain id="1" >
<Electrophysiology_model> TTP </Electrophysiology_model>
Expand All @@ -58,7 +58,7 @@

<LS type="GMRES" >
<Max_iterations> 100 </Max_iterations>
<Tolerance> 1e-6 </Tolerance>
<Tolerance> 1e-12 </Tolerance>
<Krylov_space_dimension> 50 </Krylov_space_dimension>
</LS>

Expand Down
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<Coupled> true </Coupled>
<Min_iterations> 1 </Min_iterations>
<Max_iterations> 1 </Max_iterations>
<Tolerance> 1e-6 </Tolerance>
<Tolerance> 1e-12 </Tolerance>

<Domain id="1" >
<Electrophysiology_model> BO </Electrophysiology_model>
Expand Down Expand Up @@ -105,7 +105,7 @@

<LS type="BICG" >
<Max_iterations> 100 </Max_iterations>
<Tolerance> 1e-6 </Tolerance>
<Tolerance> 1e-12 </Tolerance>
</LS>

<ECGLeads>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<Coupled> true </Coupled>
<Min_iterations> 1 </Min_iterations>
<Max_iterations> 1 </Max_iterations>
<Tolerance> 1e-6 </Tolerance>
<Tolerance> 1e-12 </Tolerance>

<Domain id="1" >
<Electrophysiology_model> BO </Electrophysiology_model>
Expand Down Expand Up @@ -105,7 +105,7 @@

<LS type="CG" >
<Preconditioner> svfsi </Preconditioner>
<Tolerance> 1e-6 </Tolerance>
<Tolerance> 1e-12 </Tolerance>
</LS>

<ECGLeads>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<Coupled> true </Coupled>
<Min_iterations> 1 </Min_iterations>
<Max_iterations> 1 </Max_iterations>
<Tolerance> 1e-6 </Tolerance>
<Tolerance> 1e-12 </Tolerance>

<Domain id="1" >
<Electrophysiology_model> TTP </Electrophysiology_model>
Expand Down Expand Up @@ -117,7 +117,7 @@

<LS type="GMRES" >
<Max_iterations> 100 </Max_iterations>
<Tolerance> 1e-6 </Tolerance>
<Tolerance> 1e-12 </Tolerance>
<Krylov_space_dimension> 50 </Krylov_space_dimension>
</LS>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<Coupled> true </Coupled>
<Min_iterations> 1 </Min_iterations>
<Max_iterations> 1 </Max_iterations>
<Tolerance> 1e-6 </Tolerance>
<Tolerance> 1e-12 </Tolerance>

<Domain id="1" >
<Electrophysiology_model> AP </Electrophysiology_model>
Expand Down Expand Up @@ -105,7 +105,7 @@

<LS type="GMRES" >
<Max_iterations> 100 </Max_iterations>
<Tolerance> 1e-6 </Tolerance>
<Tolerance> 1e-12 </Tolerance>
<Krylov_space_dimension> 50 </Krylov_space_dimension>
</LS>

Expand Down
4 changes: 2 additions & 2 deletions tests/cases/cep/purkinje/result_001.vtu
Git LFS file not shown
6 changes: 3 additions & 3 deletions tests/cases/cep/purkinje/svFSI.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
<Add_equation type="CEP" >
<Coupled> true </Coupled>
<Min_iterations> 1 </Min_iterations>
<Max_iterations> 3 </Max_iterations>
<Tolerance> 1e-6 </Tolerance>
<Max_iterations> 2 </Max_iterations>
<Tolerance> 1e-12 </Tolerance>

<Domain id="1" >
<Electrophysiology_model> TTP </Electrophysiology_model>
Expand Down Expand Up @@ -68,7 +68,7 @@

<LS type="GMRES" >
<Max_iterations> 100 </Max_iterations>
<Tolerance> 1e-6 </Tolerance>
<Tolerance> 1e-12 </Tolerance>
<Krylov_space_dimension> 50 </Krylov_space_dimension>
</LS>

Expand Down
4 changes: 2 additions & 2 deletions tests/cases/cep/spiral_BO_2d/result_001.vtu
Git LFS file not shown
Loading

0 comments on commit 5673d26

Please sign in to comment.