2008-10-19 19:53:01 +04:00
|
|
|
# This script drives creation of a CVS repository and checks
|
|
|
|
# that CTest can update from it.
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Test in a directory next to this script.
|
|
|
|
get_filename_component(TOP "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
2016-07-28 01:43:04 +03:00
|
|
|
string(APPEND TOP "/@CTestUpdateCVS_DIR@")
|
2009-12-18 16:13:51 +03:00
|
|
|
set(UPDATE_NOT_GLOBAL 1)
|
2010-02-10 19:48:09 +03:00
|
|
|
set(UPDATE_MAYBE Updated{CTestConfig.cmake})
|
2008-10-19 19:53:01 +04:00
|
|
|
|
|
|
|
# Include code common to all update tests.
|
|
|
|
include("@CMAKE_CURRENT_SOURCE_DIR@/CTestUpdateCommon.cmake")
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Report CVS tools in use.
|
|
|
|
message("Using CVS tools:")
|
|
|
|
set(CVS "@CVS_EXECUTABLE@")
|
|
|
|
message(" cvs = ${CVS}")
|
|
|
|
|
|
|
|
set(REPO ${TOP}/repo)
|
2012-03-02 23:20:58 +04:00
|
|
|
|
|
|
|
# The MSYS cvs tool interprets "c:/" as a "machine:" name for SSH.
|
|
|
|
# Detect the MSYS cvs and convert the repo path to an MSYS path.
|
|
|
|
if(WIN32)
|
|
|
|
if(EXISTS "${CVS}")
|
|
|
|
file(STRINGS "${CVS}" cvs_is_msys LIMIT_COUNT 1 REGEX "[Mm][Ss][Yy][Ss]")
|
|
|
|
if(cvs_is_msys)
|
|
|
|
message(" '${CVS}' is from MSYS (contains '${cvs_is_msys}')")
|
|
|
|
string(REGEX REPLACE "^([A-Za-z]):" "/\\1" REPO "${REPO}")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2008-10-19 19:53:01 +04:00
|
|
|
set(CVSCMD ${CVS} -d${REPO})
|
|
|
|
|
2009-06-23 00:26:02 +04:00
|
|
|
# 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()
|
|
|
|
|
2008-10-19 19:53:01 +04:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Initialize the testing directory.
|
|
|
|
message("Creating test directory...")
|
|
|
|
init_testing()
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Create the repository.
|
|
|
|
message("Creating repository...")
|
|
|
|
file(MAKE_DIRECTORY ${TOP}/repo)
|
|
|
|
run_child(
|
2009-06-23 00:26:02 +04:00
|
|
|
COMMAND ${CVSCMD} init ${CVS_INIT_OPT}
|
2008-10-19 19:53:01 +04:00
|
|
|
)
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Import initial content into the repository.
|
|
|
|
message("Importing content...")
|
|
|
|
create_content(import)
|
|
|
|
|
|
|
|
# Import the content into the repository.
|
|
|
|
run_child(
|
|
|
|
WORKING_DIRECTORY ${TOP}/import
|
|
|
|
COMMAND ${CVSCMD} import -m "Initial content" Project vendor-tag release-tag
|
|
|
|
)
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Create a working tree.
|
|
|
|
message("Checking out revision 1...")
|
|
|
|
run_child(
|
|
|
|
WORKING_DIRECTORY ${TOP}
|
|
|
|
COMMAND ${CVSCMD} co -d user-source Project
|
|
|
|
)
|
|
|
|
run_child(
|
|
|
|
WORKING_DIRECTORY ${TOP}/user-source
|
|
|
|
COMMAND ${CVSCMD} tag Revision1
|
|
|
|
)
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Make changes in the working tree.
|
|
|
|
message("Changing content...")
|
2009-02-23 23:59:07 +03:00
|
|
|
update_content(user-source files_added files_removed dirs_added)
|
|
|
|
if(dirs_added)
|
|
|
|
run_child(
|
|
|
|
WORKING_DIRECTORY ${TOP}/user-source
|
|
|
|
COMMAND ${CVSCMD} add ${dirs_added}
|
|
|
|
)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2008-10-19 19:53:01 +04:00
|
|
|
run_child(
|
|
|
|
WORKING_DIRECTORY ${TOP}/user-source
|
|
|
|
COMMAND ${CVSCMD} add ${files_added}
|
|
|
|
)
|
|
|
|
run_child(
|
|
|
|
WORKING_DIRECTORY ${TOP}/user-source
|
|
|
|
COMMAND ${CVSCMD} rm ${files_removed}
|
|
|
|
)
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Commit the changes to the repository.
|
|
|
|
message("Committing revision 2...")
|
|
|
|
run_child(
|
|
|
|
WORKING_DIRECTORY ${TOP}/user-source
|
|
|
|
COMMAND ${CVSCMD} commit -m "Changed content"
|
|
|
|
)
|
|
|
|
|
2009-02-23 23:59:07 +03:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Make changes in the working tree.
|
|
|
|
message("Changing content again...")
|
|
|
|
change_content(user-source)
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Commit the changes to the repository.
|
|
|
|
message("Committing revision 3...")
|
|
|
|
run_child(
|
|
|
|
WORKING_DIRECTORY ${TOP}/user-source
|
|
|
|
COMMAND ${CVSCMD} commit -m "Changed content again"
|
|
|
|
)
|
|
|
|
|
2008-10-19 19:53:01 +04:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Go back to before the changes so we can test updating.
|
|
|
|
message("Backing up to revision 1...")
|
|
|
|
run_child(
|
|
|
|
WORKING_DIRECTORY ${TOP}/user-source
|
|
|
|
COMMAND ${CVSCMD} up -rRevision1
|
|
|
|
)
|
|
|
|
|
2009-04-08 17:21:57 +04:00
|
|
|
# Delay 1 second so the modification produces a newer time stamp.
|
|
|
|
find_program(SLEEP sleep)
|
|
|
|
if(SLEEP)
|
|
|
|
message("Delaying...")
|
|
|
|
execute_process(COMMAND ${SLEEP} 1)
|
|
|
|
endif()
|
|
|
|
|
2009-02-26 17:22:16 +03:00
|
|
|
# Create a modified file.
|
2009-04-08 17:22:08 +04:00
|
|
|
message("Modifying locally...")
|
2009-02-26 17:22:16 +03:00
|
|
|
modify_content(user-source)
|
|
|
|
|
2008-10-19 19:53:01 +04:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Test updating the user work directory with the command-line interface.
|
|
|
|
message("Running CTest Dashboard Command Line...")
|
|
|
|
|
|
|
|
# Create the user build tree.
|
|
|
|
create_build_tree(user-source user-binary)
|
|
|
|
file(APPEND ${TOP}/user-binary/CTestConfiguration.ini
|
|
|
|
"# CVS command configuration
|
|
|
|
CVSCommand: ${CVS}
|
|
|
|
CVSUpdateOptions: -dAP
|
|
|
|
")
|
|
|
|
|
|
|
|
# Run the dashboard command line interface.
|
|
|
|
run_dashboard_command_line(user-binary)
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Test initial checkout and update with a dashboard script.
|
|
|
|
message("Running CTest Dashboard Script...")
|
|
|
|
|
2010-06-08 23:58:39 +04:00
|
|
|
create_dashboard_script(dash-binary
|
2008-10-19 19:53:01 +04:00
|
|
|
"# CVS command configuration
|
|
|
|
set(CTEST_CVS_COMMAND \"${CVS}\")
|
|
|
|
set(CTEST_CVS_UPDATE_OPTIONS -dAP)
|
|
|
|
set(CTEST_CHECKOUT_COMMAND
|
|
|
|
\"\\\"\${CTEST_CVS_COMMAND}\\\" -d \\\"${REPO}\\\" co -rRevision1 -d dash-source Project\")
|
|
|
|
")
|
|
|
|
|
|
|
|
# Run the dashboard script with CTest.
|
2010-06-08 23:58:39 +04:00
|
|
|
run_dashboard_script(dash-binary)
|
2015-06-11 16:00:01 +03:00
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Test ctest_update(RETURN_VALUE) on failure
|
|
|
|
message("Running CTest Dashboard Script (fail to update)...")
|
|
|
|
|
|
|
|
set(ctest_update_check [[
|
|
|
|
if(NOT ret LESS 0)
|
|
|
|
message(FATAL_ERROR "ctest_update incorrectly succeeded with ${ret}")
|
|
|
|
endif()
|
|
|
|
]])
|
|
|
|
create_dashboard_script(dash-binary-fail
|
|
|
|
"set(CTEST_CVS_COMMAND \"update-command-does-not-exist\")
|
|
|
|
")
|
|
|
|
unset(ctest_update_check)
|
|
|
|
|
|
|
|
# Run the dashboard script with CTest.
|
|
|
|
set(FAIL_UPDATE 1)
|
|
|
|
run_dashboard_script(dash-binary-fail)
|
|
|
|
unset(FAIL_UPDATE)
|