https://github.com/Kitware/CMake
Revision d2059d25114b53c1e7531704b3e955c6853a355e authored by Brad King on 10 February 2014, 19:52:59 UTC, committed by Brad King on 10 February 2014, 20:32:32 UTC
Use a uint64_t to store encoded version numbers so we have plenty of
bits available.  Encode with room for up to 1000 minor releases between
major releases and to encode dates until the year 10000 in the patch
level.  This is necessary because CMake development versions prior to
release 2.8.0 used the date in the patch level, and this practice may be
restored after the 3.0 release.
1 parent 2880510
Raw File
Tip revision: d2059d25114b53c1e7531704b3e955c6853a355e authored by Brad King on 10 February 2014, 19:52:59 UTC
cmVersion: Fix CMake_VERSION_ENCODE for date in patch level
Tip revision: d2059d2
CTestUpdateCVS.cmake.in
# 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)
set(TOP "${TOP}/@CTestUpdateCVS_DIR@")
set(UPDATE_NOT_GLOBAL 1)
set(UPDATE_MAYBE Updated{CTestConfig.cmake})

# 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)

# 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()

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...")
init_testing()

#-----------------------------------------------------------------------------
# Create the repository.
message("Creating repository...")
file(MAKE_DIRECTORY ${TOP}/repo)
run_child(
  COMMAND ${CVSCMD} init ${CVS_INIT_OPT}
  )

#-----------------------------------------------------------------------------
# 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...")
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}
    )
endif()
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"
  )

#-----------------------------------------------------------------------------
# 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"
  )

#-----------------------------------------------------------------------------
# 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
  )

# 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()

# Create a modified file.
message("Modifying locally...")
modify_content(user-source)

#-----------------------------------------------------------------------------
# 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...")

create_dashboard_script(dash-binary
  "# 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.
run_dashboard_script(dash-binary)
back to top