Tests: Add FindMPI test environment modification option

Provide a way to configure an environment specific to this test.
Avoid setting the environment globally for it in CI jobs.
This commit is contained in:
Brad King
2023-03-29 16:33:54 -04:00
parent ee075a53c8
commit 0e87e6c1a4
3 changed files with 4 additions and 1 deletions

View File

@@ -45,6 +45,7 @@ set(CMake_TEST_FindLibXslt "ON" CACHE BOOL "")
set(CMake_TEST_FindMPI_C "ON" CACHE BOOL "")
set(CMake_TEST_FindMPI_CXX "ON" CACHE BOOL "")
set(CMake_TEST_FindMPI_Fortran "ON" CACHE BOOL "")
set(CMake_TEST_FindMPI_ENVMOD "PATH=path_list_prepend:/usr/lib64/mpich/bin;LD_LIBRARY_PATH=path_list_prepend:/usr/lib64/mpich/lib" CACHE STRING "")
set(CMake_TEST_FindMPI "ON" CACHE BOOL "")
set(CMake_TEST_FindODBC "ON" CACHE BOOL "")
set(CMake_TEST_FindOpenACC "ON" CACHE BOOL "")

View File

@@ -1,2 +1 @@
set(ENV{MY_RUBY_HOME} "/usr/local/rvm/rubies/ruby-3.0.4")
set(ENV{PATH} "/usr/lib64/mpich/bin:$ENV{PATH}")

View File

@@ -19,3 +19,6 @@ add_test(NAME FindMPI.Test COMMAND
-DMPI_TEST_Fortran=${CMake_TEST_FindMPI_FLAG_Fortran}
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
if(CMake_TEST_FindMPI_ENVMOD)
set_property(TEST FindMPI.Test PROPERTY ENVIRONMENT_MODIFICATION ${CMake_TEST_FindMPI_ENVMOD})
endif()