[Cmake-commits] [cmake-commits] king committed CMakeLists.txt 1.156 1.157 EnforceConfig.cmake.in 1.2 1.3

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Nov 24 12:15:36 EST 2009


Update of /cvsroot/CMake/CMake/Tests
In directory public:/mounts/ram/cvs-serv27564/Tests

Modified Files:
	CMakeLists.txt EnforceConfig.cmake.in 
Log Message:
Improve fake $HOME test isolation code

The commit "Fake $HOME to isolate tests from user" started setting $HOME
in the CTest script environment.  On some platforms tests depend on some
local configuration in the home directory, such as the "cvs login" for
KWSys in CTestTest3.

In this commit we now construct a fake home dir during CMake config step
and populate it with a .cvspass file needed by the test.  We also check
CTEST_NO_TEST_HOME to optionally disable the test home.

See issue #9949.


Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/CMakeLists.txt,v
retrieving revision 1.156
retrieving revision 1.157
diff -C 2 -d -r1.156 -r1.157
*** CMakeLists.txt	24 Nov 2009 16:16:50 -0000	1.156
--- CMakeLists.txt	24 Nov 2009 17:15:32 -0000	1.157
***************
*** 14,17 ****
--- 14,26 ----
  ENDMACRO(ADD_TEST_MACRO)
  
+ # Fake a user home directory to avoid polluting the real one.
+ IF(DEFINED ENV{HOME} AND NOT CTEST_NO_TEST_HOME)
+   SET(TEST_HOME "${CMake_BINARY_DIR}/Tests/CMakeFiles/TestHome")
+   FILE(MAKE_DIRECTORY "${TEST_HOME}")
+   FILE(WRITE "${TEST_HOME}/.cvspass" ":pserver:anoncvs at www.cmake.org:/cvsroot/KWSys A\n")
+   SET(TEST_HOME_ENV_CODE "# Fake a user home directory to avoid polluting the real one.
+ SET(ENV{HOME} \"${TEST_HOME}\")")
+ ENDIF()
+ 
  # Make sure the 'testing' test gets a proper configuration.
  CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/EnforceConfig.cmake.in

Index: EnforceConfig.cmake.in
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/EnforceConfig.cmake.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -C 2 -d -r1.2 -r1.3
*** EnforceConfig.cmake.in	23 Nov 2009 19:24:53 -0000	1.2
--- EnforceConfig.cmake.in	24 Nov 2009 17:15:33 -0000	1.3
***************
*** 29,36 ****
  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})
--- 29,31 ----
  ENDIF(NOT CTEST_CONFIGURATION_TYPE AND CONFIG_REQUIRED)
  
! @TEST_HOME_ENV_CODE@



More information about the Cmake-commits mailing list