Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,12 @@ jobs:
cmake --build .
sudo cmake --install .

- name: Run tests (C++)
- name: Run tests via target (C++, serial)
working-directory: cpp/build
run: cmake --build . --target test
run: mpirun -np 1 cmake --build . --target test
- name: Run tests via target (C++, MPI, np=3)
working-directory: cpp/build
run: mpirun -np 3 cmake --build . --target test

- name: Build Python interface
run: |
Expand All @@ -147,11 +150,12 @@ jobs:
run: |
pip install pytest-xdist
python -m pytest -n auto -m serial --durations=10 python/demo/test.py
- name: Run demos (Python, MPI (np=3))
- name: Run demos (Python, MPI, np=3)
run: python -m pytest -m mpi --num-proc=3 python/demo/test.py
- name: Run unit tests

- name: Run tests (Python, serial)
run: python -m pytest -n auto -m "not petsc4py and not adios2" python/test/unit
- name: Run unit tests (MPI, np=3)
- name: Run tests (Python, MPI, np=3)
run: mpirun -np 3 python -m pytest -m "not petsc4py and not adios2" python/test/unit

build-with-petsc:
Expand Down Expand Up @@ -209,9 +213,12 @@ jobs:
working-directory: cpp/build
run: cmake --build . --target install

- name: Run tests (C++)
- name: Run tests (C++, serial)
working-directory: cpp/build
run: mpiexec -np 1 ctest -V --output-on-failure -R unittests
- name: Run tests (C++, MPI, np=3)
working-directory: cpp/build
run: ctest -V --output-on-failure -R unittests
run: mpiexec -np 3 ctest -V --output-on-failure -R unittests

- name: Build and run C++ regression tests (serial and MPI (np=2))
run: |
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/ci-spack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,21 @@ jobs:
. ./spack-src/share/spack/setup-env.sh
spack env activate .
cmake -Werror=dev --warn-uninitialized -G Ninja -DBUILD_TESTING=true -DCMAKE_BUILD_TYPE=Developer -B build -S dolfinx-src/cpp/
cmake --build build --target install
cmake --build build

- name: Run tests (C++)
- name: Run tests without install (C++, serial and MPI np=2)
run: |
. ./spack-src/share/spack/setup-env.sh
spack env activate .
cd build
ctest -V --output-on-failure -R unittests
mpirun -np 1 ctest -V --output-on-failure -R unittests
mpirun -np 2 ctest -V --output-on-failure -R unittests

- name: Install C++
run: |
. ./spack-src/share/spack/setup-env.sh
spack env activate .
cmake --build build --target install

- name: Build and run C++ regression tests (serial and MPI (np=2))
run: |
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,12 @@ jobs:
cmake --build .
sudo cmake --install .

- name: Run tests (C++)
- name: Run tests (C++, serial)
working-directory: cpp/build
run: ctest -V --output-on-failure -R unittests
run: mpiexec -np 1 ctest -V --output-on-failure -R unittests
- name: Run tests (C++, MPI, np=3)
working-directory: cpp/build
run: mpiexec -np 3 ctest -V --output-on-failure -R unittests

- name: Build and install DOLFINx Python interface
run: |
Expand All @@ -106,10 +109,10 @@ jobs:
mpiexec -np 1 python -c "import dolfinx; from mpi4py import MPI; dolfinx.mesh.create_rectangle(comm=MPI.COMM_WORLD, points=((0, 0), (2, 1)), n=(32, 16))"
mpiexec -np 2 python -c "import dolfinx; from mpi4py import MPI; dolfinx.mesh.create_rectangle(comm=MPI.COMM_WORLD, points=((0, 0), (2, 1)), n=(32, 16))"

- name: Run Python unit tests (serial)
- name: Run tests (Python, serial)
run: |
python -m pip install pytest-xdist
mpiexec -np 1 python3 -m pytest -n=auto --durations=50 python/test/unit/
- name: Run Python unit tests (MPI, np=3)
- name: Run tests (Python, MPI, np=3)
run: |
mpiexec -np 3 python3 -m pytest python/test/unit/
3 changes: 1 addition & 2 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,7 @@ add_subdirectory(dolfinx)

# ------------------------------------------------------------------------------
# Unit testing
option(BUILD_TESTING "Build DOLFINx unit tests." OFF)
set(DOLFINX_TEST_MPI_PROCESSES "1;3" CACHE STRING "List of process counts to run tests with.")
option(BUILD_TESTING "Build DOLFINx unit tests and create test target." OFF)
include(CTest)
if (BUILD_TESTING)
add_subdirectory(test)
Expand Down
12 changes: 5 additions & 7 deletions cpp/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ if(WIN32)
target_link_libraries(unittests PRIVATE bcrypt)
endif()

# Required to find FFCx generated headers.
target_include_directories(
unittests PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
)
# makes version.h accessible
# Required to find version.h
target_include_directories(
unittests PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../>
)
Expand All @@ -84,7 +85,6 @@ target_compile_options(
$<$<AND:$<CONFIG:Developer>,$<COMPILE_LANGUAGE:CXX>>:${DOLFINX_CXX_DEVELOPER_FLAGS}>
)

# TODO: should not be set in test and dolfinx but in cpp once.
if(ENABLE_CLANG_TIDY)
find_program(CLANG_TIDY NAMES clang-tidy REQUIRED)
set_target_properties(
Expand All @@ -95,9 +95,7 @@ if(ENABLE_CLANG_TIDY)
)
endif()

# Nice for debugging tests one at a time - but extremely slow due to process
# spawning/tear down: catch_discover_tests(unittests)
# Uncommenting line allows for debugging individual tests, but slow.
#catch_discover_tests(unittests)

foreach(np IN LISTS DOLFINX_TEST_MPI_PROCESSES)
add_test(NAME unittests_np_${np} COMMAND mpiexec -np ${np} ./unittests)
endforeach()
add_test(NAME unittests COMMAND $<TARGET_FILE:unittests>)
Loading