diff options
author | Brad King <brad.king@kitware.com> | 2009-06-22 20:26:02 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-06-22 20:26:02 (GMT) |
commit | db024f444e6672951b1beed84c5dbf6de76b7e85 (patch) | |
tree | 981443cdea6256ccfb4c851a4dcd137474365aa3 /Tests | |
parent | d3679610c6b60ff442a3f467b47005ea7c3996c1 (diff) | |
download | CMake-db024f444e6672951b1beed84c5dbf6de76b7e85.zip CMake-db024f444e6672951b1beed84c5dbf6de76b7e85.tar.gz CMake-db024f444e6672951b1beed84c5dbf6de76b7e85.tar.bz2 |
ENH: Auto-enable CTest.UpdateCVS test on Windows
The test needs to create a cvs repository with 'cvs init', but the CVSNT
client on Windows needs 'cvs init -n' to avoid administrator access.
Previously we required users to explicitly enable CTEST_TEST_UPDATE_CVS
to activate the test on Windows.
This teaches the test to use the '-n' option when necessary. Now we can
enable the test in all cases except when trying to use a cygwin cvs.exe
without cygwin paths.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 33 | ||||
-rw-r--r-- | Tests/CTestUpdateCVS.cmake.in | 15 |
2 files changed, 28 insertions, 20 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 29bfb52..51ccfe6 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -897,25 +897,20 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel ENDIF(Subversion_FOUND) # Test CTest Update with CVS - IF(UNIX) - # The test is expected to work by default on UNIX-like systems. - SET(CTEST_TEST_UPDATE_CVS 1) - ELSE(UNIX) - # Special CVS configuration is needed for test to pass on Windows. - OPTION(CTEST_TEST_UPDATE_CVS - "Enable CTest.UpdateCVS test. Requires extra CVS setup on windows." - OFF) - MARK_AS_ADVANCED(CTEST_TEST_UPDATE_CVS) - ENDIF(UNIX) + IF(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake) + FIND_PACKAGE(CVS QUIET) + ELSE(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake) + FIND_PROGRAM(CVS_EXECUTABLE NAMES cvs) + SET(CVS_FOUND ${CVS_EXECUTABLE}) + ENDIF(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake) + SET(CTEST_TEST_UPDATE_CVS ${CVS_FOUND}) + IF(CTEST_TEST_UPDATE_CVS AND NOT UNIX) + IF("${CVS_EXECUTABLE}" MATCHES "cygwin") + MESSAGE(STATUS "No CTest.UpdateCVS test with cygwin cvs.exe outside cygwin!") + SET(CTEST_TEST_UPDATE_CVS 0) + ENDIF("${CVS_EXECUTABLE}" MATCHES "cygwin") + ENDIF(CTEST_TEST_UPDATE_CVS AND NOT UNIX) IF(CTEST_TEST_UPDATE_CVS) - IF(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake) - FIND_PACKAGE(CVS QUIET) - ELSE(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake) - FIND_PROGRAM(CVS_EXECUTABLE NAMES cvs) - SET(CVS_FOUND ${CVS_EXECUTABLE}) - ENDIF(EXISTS ${CMAKE_ROOT}/Modules/FindCVS.cmake) - ENDIF(CTEST_TEST_UPDATE_CVS) - IF(CTEST_TEST_UPDATE_CVS AND CVS_FOUND) SET(CTestUpdateCVS_DIR "CTest UpdateCVS") CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestUpdateCVS.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestUpdateCVS.cmake" @ONLY) @@ -923,7 +918,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel -P "${CMake_BINARY_DIR}/Tests/CTestUpdateCVS.cmake" ) LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateCVS_DIR}") - ENDIF(CTEST_TEST_UPDATE_CVS AND CVS_FOUND) + ENDIF(CTEST_TEST_UPDATE_CVS) # Test CTest Update with BZR FIND_PROGRAM(BZR_EXECUTABLE NAMES bzr) diff --git a/Tests/CTestUpdateCVS.cmake.in b/Tests/CTestUpdateCVS.cmake.in index e983c25..8ac0fa1 100644 --- a/Tests/CTestUpdateCVS.cmake.in +++ b/Tests/CTestUpdateCVS.cmake.in @@ -18,6 +18,19 @@ message(" cvs = ${CVS}") set(REPO ${TOP}/repo) set(CVSCMD ${CVS} -d${REPO}) +# CVSNT requires an extra option to 'cvs init'. +set(CVS_INIT_OPT) +execute_process( + COMMAND ${CVS} --version + RESULT_VARIABLE RESULT + OUTPUT_VARIABLE OUTPUT + ERROR_VARIABLE OUTPUT + ) +if("${RESULT}" STREQUAL "0" AND "${OUTPUT}" MATCHES "\\(CVSNT\\)") + set(CVS_INIT_OPT -n) + message(" cvs init needs -n") +endif() + #----------------------------------------------------------------------------- # Initialize the testing directory. message("Creating test directory...") @@ -28,7 +41,7 @@ init_testing() message("Creating repository...") file(MAKE_DIRECTORY ${TOP}/repo) run_child( - COMMAND ${CVSCMD} init + COMMAND ${CVSCMD} init ${CVS_INIT_OPT} ) #----------------------------------------------------------------------------- |