CTestUpdateCVS.cmake.in 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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)
  51. run_child(
  52. WORKING_DIRECTORY ${TOP}/user-source
  53. COMMAND ${CVSCMD} add ${files_added}
  54. )
  55. run_child(
  56. WORKING_DIRECTORY ${TOP}/user-source
  57. COMMAND ${CVSCMD} rm ${files_removed}
  58. )
  59. #-----------------------------------------------------------------------------
  60. # Commit the changes to the repository.
  61. message("Committing revision 2...")
  62. run_child(
  63. WORKING_DIRECTORY ${TOP}/user-source
  64. COMMAND ${CVSCMD} commit -m "Changed content"
  65. )
  66. #-----------------------------------------------------------------------------
  67. # Go back to before the changes so we can test updating.
  68. message("Backing up to revision 1...")
  69. run_child(
  70. WORKING_DIRECTORY ${TOP}/user-source
  71. COMMAND ${CVSCMD} up -rRevision1
  72. )
  73. #-----------------------------------------------------------------------------
  74. # Test updating the user work directory with the command-line interface.
  75. message("Running CTest Dashboard Command Line...")
  76. # Create the user build tree.
  77. create_build_tree(user-source user-binary)
  78. file(APPEND ${TOP}/user-binary/CTestConfiguration.ini
  79. "# CVS command configuration
  80. CVSCommand: ${CVS}
  81. CVSUpdateOptions: -dAP
  82. ")
  83. # Run the dashboard command line interface.
  84. run_dashboard_command_line(user-binary)
  85. #-----------------------------------------------------------------------------
  86. # Test initial checkout and update with a dashboard script.
  87. message("Running CTest Dashboard Script...")
  88. create_dashboard_script(dashboard.cmake
  89. "# CVS command configuration
  90. set(CTEST_CVS_COMMAND \"${CVS}\")
  91. set(CTEST_CVS_UPDATE_OPTIONS -dAP)
  92. set(CTEST_CHECKOUT_COMMAND
  93. \"\\\"\${CTEST_CVS_COMMAND}\\\" -d \\\"${REPO}\\\" co -rRevision1 -d dash-source Project\")
  94. ")
  95. # Run the dashboard script with CTest.
  96. run_dashboard_script(dashboard.cmake)