diff options
author | Brad King <brad.king@kitware.com> | 2009-11-23 19:24:53 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-11-23 19:24:53 (GMT) |
commit | 647d7105b42af55f2f99972ee01589d91730850f (patch) | |
tree | 7ad195615894d5a8c9d6c098afac9cbaf6e1bfc8 /Tests/EnforceConfig.cmake.in | |
parent | c4e002fd49abe57cdadabc2465ab453353cb8575 (diff) | |
download | CMake-647d7105b42af55f2f99972ee01589d91730850f.zip CMake-647d7105b42af55f2f99972ee01589d91730850f.tar.gz CMake-647d7105b42af55f2f99972ee01589d91730850f.tar.bz2 |
Fake $HOME to isolate tests from user
On platforms with $HOME in the environment, some of our features use it
to store information in the user home directory. However, tests for
these features should not touch the real user home directory. Instead
we configure a fake $HOME that points inside the build tree for use
during testing.
See issue #9949.
Diffstat (limited to 'Tests/EnforceConfig.cmake.in')
-rw-r--r-- | Tests/EnforceConfig.cmake.in | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Tests/EnforceConfig.cmake.in b/Tests/EnforceConfig.cmake.in index c10d2a3..9a5f042 100644 --- a/Tests/EnforceConfig.cmake.in +++ b/Tests/EnforceConfig.cmake.in @@ -27,3 +27,10 @@ IF(NOT CTEST_CONFIGURATION_TYPE AND CONFIG_REQUIRED) ENDIF(NOT CTEST_CONFIGURATION_TYPE) MESSAGE("Guessing configuration ${CTEST_CONFIGURATION_TYPE}") ENDIF(NOT CTEST_CONFIGURATION_TYPE AND CONFIG_REQUIRED) + +# Fake a user home directory to avoid polluting the real one. +IF(DEFINED ENV{HOME}) + SET(HOME "@CMake_BINARY_DIR@/Tests/CMakeFiles/TestHome") + FILE(MAKE_DIRECTORY "${HOME}") + SET(ENV{HOME} "${HOME}") +ENDIF(DEFINED ENV{HOME}) |