CTestUpdateBZR.cmake.in 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. # This script drives creation of a bzr 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}/@CTestUpdateBZR_DIR@")
  7. # Include code common to all update tests.
  8. include("@CMAKE_CURRENT_SOURCE_DIR@/CTestUpdateCommon.cmake")
  9. #-----------------------------------------------------------------------------
  10. # Report bzr tools in use.
  11. message("Using BZR tools:")
  12. set(BZR "@BZR_EXECUTABLE@")
  13. message(" bzr = ${BZR}")
  14. #-----------------------------------------------------------------------------
  15. # Initialize the testing directory.
  16. message("Creating test directory...")
  17. init_testing()
  18. #-----------------------------------------------------------------------------
  19. # Create the repository.
  20. message("Creating repository...")
  21. file(MAKE_DIRECTORY ${TOP}/repo.bzr)
  22. run_child(
  23. WORKING_DIRECTORY ${TOP}/repo.bzr
  24. COMMAND ${BZR} init
  25. )
  26. set(REPO file://${TOP}/repo.bzr)
  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(WORKING_DIRECTORY ${TOP}/import
  33. COMMAND ${BZR} init
  34. )
  35. run_child(WORKING_DIRECTORY ${TOP}/import
  36. COMMAND ${BZR} add .
  37. )
  38. run_child(WORKING_DIRECTORY ${TOP}/import
  39. COMMAND ${BZR} commit -m "Initial content"
  40. )
  41. run_child(WORKING_DIRECTORY ${TOP}/import
  42. COMMAND ${BZR} push --create-prefix "${REPO}"
  43. )
  44. #-----------------------------------------------------------------------------
  45. # Create a working tree.
  46. message("Checking out revision 1...")
  47. run_child(
  48. WORKING_DIRECTORY ${TOP}
  49. COMMAND ${BZR} branch "${REPO}" user-source
  50. )
  51. #-----------------------------------------------------------------------------
  52. # Make changes in the working tree.
  53. message("Changing content...")
  54. update_content(user-source files_added files_removed dirs_added)
  55. if(dirs_added)
  56. run_child(
  57. WORKING_DIRECTORY ${TOP}/user-source
  58. COMMAND ${BZR} add ${dirs_added}
  59. )
  60. endif(dirs_added)
  61. run_child(
  62. WORKING_DIRECTORY ${TOP}/user-source
  63. COMMAND ${BZR} add ${files_added}
  64. )
  65. run_child(
  66. WORKING_DIRECTORY ${TOP}/user-source
  67. COMMAND ${BZR} rm ${files_removed}
  68. )
  69. #-----------------------------------------------------------------------------
  70. # Commit the changes to the repository.
  71. message("Committing revision 2...")
  72. run_child(
  73. WORKING_DIRECTORY ${TOP}/user-source
  74. COMMAND ${BZR} commit -m "Changed content"
  75. )
  76. run_child(
  77. WORKING_DIRECTORY ${TOP}/user-source
  78. COMMAND ${BZR} push "${REPO}"
  79. )
  80. #-----------------------------------------------------------------------------
  81. # Make changes in the working tree.
  82. message("Changing content again...")
  83. change_content(user-source)
  84. #-----------------------------------------------------------------------------
  85. # Commit the changes to the repository.
  86. message("Committing revision 3...")
  87. run_child(
  88. WORKING_DIRECTORY ${TOP}/user-source
  89. COMMAND ${BZR} commit -m "Changed content again"
  90. )
  91. run_child(
  92. WORKING_DIRECTORY ${TOP}/user-source
  93. COMMAND ${BZR} push "${REPO}"
  94. )
  95. #-----------------------------------------------------------------------------
  96. # Go back to before the changes so we can test updating.
  97. message("Backing up to revision 1...")
  98. run_child(
  99. WORKING_DIRECTORY ${TOP}/user-source
  100. COMMAND ${BZR} pull --overwrite -r1
  101. )
  102. # Create a modified file.
  103. modify_content(user-source)
  104. #-----------------------------------------------------------------------------
  105. # Test updating the user work directory with the command-line interface.
  106. message("Running CTest Dashboard Command Line...")
  107. # Create the user build tree.
  108. create_build_tree(user-source user-binary)
  109. file(APPEND ${TOP}/user-binary/CTestConfiguration.ini
  110. "# BZR command configuration
  111. UpdateCommand: ${BZR}
  112. ")
  113. # Run the dashboard command line interface.
  114. run_dashboard_command_line(user-binary)
  115. #-----------------------------------------------------------------------------
  116. # Test initial checkout and update with a dashboard script.
  117. message("Running CTest Dashboard Script...")
  118. create_dashboard_script(dashboard.cmake
  119. "# bzr command configuration
  120. set(CTEST_BZR_COMMAND \"${BZR}\")
  121. set(CTEST_CHECKOUT_COMMAND
  122. \"\\\"\${CTEST_BZR_COMMAND}\\\" branch -r1 \\\"${REPO}\\\" dash-source\")
  123. ")
  124. # Run the dashboard script with CTest.
  125. run_dashboard_script(dashboard.cmake)