From 0e87e6c1a40f8b5cce76599840c7aac23e183ac3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 29 Mar 2023 16:33:54 -0400 Subject: 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. --- .gitlab/ci/configure_fedora37_makefiles.cmake | 1 + .gitlab/ci/env_fedora37_makefiles.cmake | 1 - Tests/FindMPI/CMakeLists.txt | 3 +++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitlab/ci/configure_fedora37_makefiles.cmake b/.gitlab/ci/configure_fedora37_makefiles.cmake index f5676aa..2950eaa 100644 --- a/.gitlab/ci/configure_fedora37_makefiles.cmake +++ b/.gitlab/ci/configure_fedora37_makefiles.cmake @@ -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 "") diff --git a/.gitlab/ci/env_fedora37_makefiles.cmake b/.gitlab/ci/env_fedora37_makefiles.cmake index 2bcb6d0..ef13cda 100644 --- a/.gitlab/ci/env_fedora37_makefiles.cmake +++ b/.gitlab/ci/env_fedora37_makefiles.cmake @@ -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}") diff --git a/Tests/FindMPI/CMakeLists.txt b/Tests/FindMPI/CMakeLists.txt index 121d978..1bc12c8 100644 --- a/Tests/FindMPI/CMakeLists.txt +++ b/Tests/FindMPI/CMakeLists.txt @@ -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 $ ) +if(CMake_TEST_FindMPI_ENVMOD) + set_property(TEST FindMPI.Test PROPERTY ENVIRONMENT_MODIFICATION ${CMake_TEST_FindMPI_ENVMOD}) +endif() -- cgit v0.12