Commit db024f44 authored by Brad King's avatar Brad King
Browse files

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.
parent d3679610
......@@ -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)
......
......@@ -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}
)
#-----------------------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment