CTestUpdateCVS.cmake.in 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. # This script drives creation of a CVS repository and checks
  2. # that CTest can update from it.
  3. #-----------------------------------------------------------------------------
  4. # Test in a directory next to this script.
  5. get_filename_component(TOP "${CMAKE_CURRENT_LIST_FILE}" PATH)
  6. set(TOP "${TOP}/@CTestUpdateCVS_DIR@")
  7. # Include code common to all update tests.
  8. include("@CMAKE_CURRENT_SOURCE_DIR@/CTestUpdateCommon.cmake")
  9. #-----------------------------------------------------------------------------
  10. # Report CVS tools in use.
  11. message("Using CVS tools:")
  12. set(CVS "@CVS_EXECUTABLE@")
  13. message(" cvs = ${CVS}")
  14. set(REPO ${TOP}/repo)
  15. set(CVSCMD ${CVS} -d${REPO})
  16. #-----------------------------------------------------------------------------
  17. # Initialize the testing directory.
  18. message("Creating test directory...")
  19. init_testing()
  20. #-----------------------------------------------------------------------------
  21. # Create the repository.
  22. message("Creating repository...")
  23. file(MAKE_DIRECTORY ${TOP}/repo)
  24. run_child(
  25. COMMAND ${CVSCMD} init
  26. )
  27. #-----------------------------------------------------------------------------
  28. # Import initial content into the repository.
  29. message("Importing content...")
  30. create_content(import)
  31. # Import the content into the repository.
  32. run_child(
  33. WORKING_DIRECTORY ${TOP}/import
  34. COMMAND ${CVSCMD} import -m "Initial content" Project vendor-tag release-tag
  35. )
  36. #-----------------------------------------------------------------------------
  37. # Create a working tree.
  38. message("Checking out revision 1...")
  39. run_child(
  40. WORKING_DIRECTORY ${TOP}
  41. COMMAND ${CVSCMD} co -d user-source Project
  42. )
  43. run_child(
  44. WORKING_DIRECTORY ${TOP}/user-source
  45. COMMAND ${CVSCMD} tag Revision1
  46. )
  47. #-----------------------------------------------------------------------------
  48. # Make changes in the working tree.
  49. message("Changing content...")
  50. update_content(user-source files_added files_removed dirs_added)
  51. if(dirs_added)
  52. run_child(
  53. WORKING_DIRECTORY ${TOP}/user-source
  54. COMMAND ${CVSCMD} add ${dirs_added}
  55. )
  56. endif(dirs_added)
  57. run_child(
  58. WORKING_DIRECTORY ${TOP}/user-source
  59. COMMAND ${CVSCMD} add ${files_added}
  60. )
  61. run_child(
  62. WORKING_DIRECTORY ${TOP}/user-source
  63. COMMAND ${CVSCMD} rm ${files_removed}
  64. )
  65. #-----------------------------------------------------------------------------
  66. # Commit the changes to the repository.
  67. message("Committing revision 2...")
  68. run_child(
  69. WORKING_DIRECTORY ${TOP}/user-source
  70. COMMAND ${CVSCMD} commit -m "Changed content"
  71. )
  72. #-----------------------------------------------------------------------------
  73. # Make changes in the working tree.
  74. message("Changing content again...")
  75. change_content(user-source)
  76. #-----------------------------------------------------------------------------
  77. # Commit the changes to the repository.
  78. message("Committing revision 3...")
  79. run_child(
  80. WORKING_DIRECTORY ${TOP}/user-source
  81. COMMAND ${CVSCMD} commit -m "Changed content again"
  82. )
  83. #-----------------------------------------------------------------------------
  84. # Go back to before the changes so we can test updating.
  85. message("Backing up to revision 1...")
  86. run_child(
  87. WORKING_DIRECTORY ${TOP}/user-source
  88. COMMAND ${CVSCMD} up -rRevision1
  89. )
  90. # Delay 1 second so the modification produces a newer time stamp.
  91. find_program(SLEEP sleep)
  92. if(SLEEP)
  93. message("Delaying...")
  94. execute_process(COMMAND ${SLEEP} 1)
  95. endif()
  96. # Create a modified file.
  97. message("Modifying locally...")
  98. modify_content(user-source)
  99. #-----------------------------------------------------------------------------
  100. # Test updating the user work directory with the command-line interface.
  101. message("Running CTest Dashboard Command Line...")
  102. # Create the user build tree.
  103. create_build_tree(user-source user-binary)
  104. file(APPEND ${TOP}/user-binary/CTestConfiguration.ini
  105. "# CVS command configuration
  106. CVSCommand: ${CVS}
  107. CVSUpdateOptions: -dAP
  108. ")
  109. # Run the dashboard command line interface.
  110. run_dashboard_command_line(user-binary)
  111. #-----------------------------------------------------------------------------
  112. # Test initial checkout and update with a dashboard script.
  113. message("Running CTest Dashboard Script...")
  114. create_dashboard_script(dashboard.cmake
  115. "# CVS command configuration
  116. set(CTEST_CVS_COMMAND \"${CVS}\")
  117. set(CTEST_CVS_UPDATE_OPTIONS -dAP)
  118. set(CTEST_CHECKOUT_COMMAND
  119. \"\\\"\${CTEST_CVS_COMMAND}\\\" -d \\\"${REPO}\\\" co -rRevision1 -d dash-source Project\")
  120. ")
  121. # Run the dashboard script with CTest.
  122. run_dashboard_script(dashboard.cmake)