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

Make ctests platform independent #461

Merged
merged 4 commits into from
Sep 23, 2024
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
2 changes: 0 additions & 2 deletions .github/workflows/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ jobs:
if [[ ${{ matrix.mpi }} == ON ]]; then
export PATH="/c/Program Files/Microsoft MPI/Bin":$PATH # add mpiexec to msys2 path
fi
export PATH="${GITHUB_WORKSPACE}/build":$PATH # add libarpack.dll to msys2 path for tests that run in different directory
cd build
ctest
- name: Re-run tests
Expand All @@ -340,7 +339,6 @@ jobs:
if [[ ${{ matrix.mpi }} == ON ]]; then
export PATH="/c/Program Files/Microsoft MPI/Bin":$PATH # add mpiexec to msys2 path
fi
export PATH="${GITHUB_WORKSPACE}/build":$PATH # add libarpack.dll to msys2 path for tests that run in different directory
cd build
echo "::group::Re-run ctest"
ctest --rerun-failed --output-on-failure || true
Expand Down
3 changes: 3 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
[ Kyle Guinn ]
* Build PARPACK p[sd]lamch10.f with FFLAGS from ./configure instead of forcing -O0. Build all of PARPACK with AM_FFLAGS.

[ Markus Mützel ]
* CMake: Fix running CTests on Windows.

arpack-ng - 3.9.1

[ Fabien Péan ]
Expand Down
26 changes: 21 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,23 @@ endif()
############################
# TEST
############################
function(build_tests)

function(add_test_with_rpath test_name)
# Add test which sets a current working directory that doesn't contain the
# libarpack library.
# Windows doesn't have a mechanism similar to RPATH on Linux or macOS.
# On Windows, if a test is running in a working directory that doesn't contain
# the ARPACK (and PARPACK) libraries, the path to these libraries has to be
# added to the PATH environment variable.
add_test(NAME ${test_name} ${ARGN})
if (WIN32 AND BUILD_SHARED_LIBS)
set_tests_properties(${test_name}
PROPERTIES
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:arpack>")
endif()
endfunction()

function(build_tests)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/TESTS)

add_executable(dnsimp_test TESTS/dnsimp.f TESTS/mmio.f TESTS/debug.h)
Expand Down Expand Up @@ -704,13 +720,13 @@ function(build_tests)
configure_file(EXAMPLES/MATRIX_MARKET/B.mtx ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/B.mtx)
configure_file(EXAMPLES/MATRIX_MARKET/Bz.mtx ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Bz.mtx)
configure_file(EXAMPLES/MATRIX_MARKET/arpackmm.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/arpackmm.sh)
add_test(NAME arpackmm_tst WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${BASH_PROGRAM} arpackmm.sh)
add_test_with_rpath(arpackmm_tst WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${BASH_PROGRAM} arpackmm.sh)
configure_file(EXAMPLES/MATRIX_MARKET/issue401.mtx ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/issue401.mtx)
configure_file(EXAMPLES/MATRIX_MARKET/issue401.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/issue401.sh)
add_test(NAME issue401_tst WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${BASH_PROGRAM} issue401.sh)
add_test_with_rpath(issue401_tst WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${BASH_PROGRAM} issue401.sh)
configure_file(EXAMPLES/MATRIX_MARKET/issue215.mtx ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/issue215.mtx)
configure_file(EXAMPLES/MATRIX_MARKET/issue215.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/issue215.sh)
add_test(NAME issue215_tst WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${BASH_PROGRAM} issue215.sh)
add_test_with_rpath(issue215_tst WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${BASH_PROGRAM} issue215.sh)
endif()

if (PYTHON3)
Expand Down Expand Up @@ -795,7 +811,7 @@ endfunction(build_tests)

if(TESTS)
enable_testing()
set(CMAKE_CTEST_COMMAND ctest -V)
set(CMAKE_CTEST_COMMAND ctest -V)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK to remove extra spaces

build_tests()
endif()

Expand Down
Loading