Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CTest test cases from existing tests (run_tests.sh) #20

Merged
merged 25 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e48df44
rework github action for build and test and delete old one
siggmo Sep 6, 2024
0dbe410
adapt workflow to be compatible with local execution using nektos/act
siggmo Sep 6, 2024
4671b9e
switch back to explicit docker create/exec commands instead of 'conta…
siggmo Sep 6, 2024
f968260
Merge branch 'develop' into feature/gh-action-build-and-test
siggmo Sep 6, 2024
a5f77c5
fix whitespaces and newline at end of file
siggmo Sep 6, 2024
0a86e21
replace hardcoded paths by variable ones in upload-artifact steps
siggmo Sep 8, 2024
7b88cc0
Clean up docker create command
siggmo Sep 8, 2024
5b556ac
Consistently use bash -c in docker exec commands, and use single quot…
siggmo Sep 8, 2024
ff5a38f
Enable testing and add test cases from run_tests.sh
siggmo Sep 8, 2024
4a27156
Execute tests as non root since MPI requires this.
siggmo Sep 8, 2024
3869215
Merge branch 'feature/gh-action-build-and-test' into feature/ctest-te…
siggmo Sep 8, 2024
539d481
fix newline at end of file
siggmo Sep 8, 2024
a220993
set max. cores to two for debugging MPI in GitHub Action runners
siggmo Sep 9, 2024
ac48e6b
Add non-root user already in first stage, to make it available in the…
siggmo Sep 9, 2024
b3194ce
remove linux/arm64 from build and test workflow. Drop QEMU and make u…
siggmo Sep 9, 2024
095bcc6
Merge branch 'feature/gh-action-build-and-test' into feature/ctest-te…
siggmo Sep 9, 2024
9cdbe91
add debug output to compare two ways of determining available cores/m…
siggmo Sep 9, 2024
de777d0
use cmake_host_system_information instead as this actually gives the …
siggmo Sep 9, 2024
cf900f2
Merge branch 'develop' into feature/ctest-testcases
IshaanDesai Sep 17, 2024
beab95d
remove unnecessary ProcessorCount module include
siggmo Sep 18, 2024
8c26f8a
Merge branch 'develop' into feature/ctest-testcases
IshaanDesai Sep 20, 2024
f15839f
Update test names in CMake recipe
IshaanDesai Sep 20, 2024
649725d
Use correct path in test execution in the CMake recipe
IshaanDesai Sep 20, 2024
5335488
Use correct capital case
IshaanDesai Sep 20, 2024
fc6a566
Use correct relative path in test/CMakeLists.txt
IshaanDesai Sep 20, 2024
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
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,19 @@ install(
COMPONENT FANS_Development
)

# ##############################################################################
# TESTING
# ##############################################################################

if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(FANS_ENABLE_TESTING_DEFAULT ON)
endif ()
option(FANS_ENABLE_TESTING "Enable testing" ${FANS_ENABLE_TESTING_DEFAULT})
if (FANS_ENABLE_TESTING)
enable_testing()
add_subdirectory(test)
endif ()

# ##############################################################################
# PACKAGING
# ##############################################################################
Expand Down
33 changes: 33 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
set(FANS_TEST_INPUT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(FANS_TEST_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(FANS_EXECUTABLE $<TARGET_FILE:FANS_main>)

# determine MPI process count. The discretization of the test geometry allows for max. 8 processes.
set(FANS_N_MPI_PROCESSES_MAX 8)
cmake_host_system_information(RESULT FANS_CORES_AVAILABLE QUERY NUMBER_OF_PHYSICAL_CORES)
if (FANS_N_MPI_PROCESSES_MAX LESS FANS_CORES_AVAILABLE)
set(FANS_N_MPI_PROCESSES ${FANS_N_MPI_PROCESSES_MAX})
else()
set(FANS_N_MPI_PROCESSES ${FANS_CORES_AVAILABLE})
endif()
message(STATUS "Will use ${FANS_N_MPI_PROCESSES} processes for MPI test cases.")

set(FANS_TEST_CASES
J2Plasticity
LinearElastic
LinearThermal
PseudoPlastic
)

list(LENGTH FANS_TEST_CASES N_TESTS)
math(EXPR N_TESTS "${N_TESTS} - 1")

foreach(N RANGE ${N_TESTS})
list(GET FANS_TEST_CASES ${N} FANS_TEST_CASE)

add_test(
NAME ${FANS_TEST_CASE}
COMMAND mpiexec -n ${FANS_N_MPI_PROCESSES} ${FANS_EXECUTABLE} input_files/test_${FANS_TEST_CASE}.json ${FANS_TEST_OUTPUT_DIR}/test_${FANS_TEST_CASE}.h5
WORKING_DIRECTORY ${FANS_TEST_INPUT_DIR}
)
endforeach()