1 # This script drives creation of a bzr repository and checks
2 # that CTest can update from it.
4 #-----------------------------------------------------------------------------
5 # Test in a directory next to this script.
6 get_filename_component(TOP "${CMAKE_CURRENT_LIST_FILE}" PATH)
7 set(TOP "${TOP}/@CTestUpdateBZR_DIR@")
9 # Include code common to all update tests.
10 include("@CMAKE_CURRENT_SOURCE_DIR@/CTestUpdateCommon.cmake")
12 #-----------------------------------------------------------------------------
13 # Report bzr tools in use.
14 message("Using BZR tools:")
15 set(BZR "@BZR_EXECUTABLE@")
16 message(" bzr = ${BZR}")
18 #-----------------------------------------------------------------------------
19 # Initialize the testing directory.
20 message("Creating test directory...")
23 #-----------------------------------------------------------------------------
24 # Create the repository.
25 message("Creating repository...")
26 file(MAKE_DIRECTORY ${TOP}/repo.bzr)
28 WORKING_DIRECTORY ${TOP}/repo.bzr
31 set(REPO file://${TOP}/repo.bzr)
33 #-----------------------------------------------------------------------------
34 # Import initial content into the repository.
35 message("Importing content...")
36 create_content(import)
38 # Import the content into the repository.
39 run_child(WORKING_DIRECTORY ${TOP}/import
43 run_child(WORKING_DIRECTORY ${TOP}/import
46 run_child(WORKING_DIRECTORY ${TOP}/import
47 COMMAND ${BZR} commit -m "Initial content"
49 run_child(WORKING_DIRECTORY ${TOP}/import
50 COMMAND ${BZR} push --create-prefix "${REPO}"
53 #-----------------------------------------------------------------------------
54 # Create a working tree.
55 message("Checking out revision 1...")
57 WORKING_DIRECTORY ${TOP}
58 COMMAND ${BZR} branch "${REPO}" user-source
61 #-----------------------------------------------------------------------------
62 # Make changes in the working tree.
63 message("Changing content...")
64 update_content(user-source files_added files_removed dirs_added)
67 WORKING_DIRECTORY ${TOP}/user-source
68 COMMAND ${BZR} add ${dirs_added}
72 WORKING_DIRECTORY ${TOP}/user-source
73 COMMAND ${BZR} add ${files_added}
76 WORKING_DIRECTORY ${TOP}/user-source
77 COMMAND ${BZR} rm ${files_removed}
80 #-----------------------------------------------------------------------------
81 # Commit the changes to the repository.
82 message("Committing revision 2...")
84 WORKING_DIRECTORY ${TOP}/user-source
85 COMMAND ${BZR} commit -m "Changed content"
88 WORKING_DIRECTORY ${TOP}/user-source
89 COMMAND ${BZR} push "${REPO}"
92 #-----------------------------------------------------------------------------
93 # Make changes in the working tree.
94 message("Changing content again...")
95 change_content(user-source)
97 #-----------------------------------------------------------------------------
98 # Commit the changes to the repository.
99 message("Committing revision 3...")
101 WORKING_DIRECTORY ${TOP}/user-source
102 COMMAND ${BZR} commit -m "Changed content again"
105 WORKING_DIRECTORY ${TOP}/user-source
106 COMMAND ${BZR} push "${REPO}"
109 #-----------------------------------------------------------------------------
110 # Go back to before the changes so we can test updating.
111 message("Backing up to revision 1...")
113 WORKING_DIRECTORY ${TOP}/user-source
114 COMMAND ${BZR} pull --overwrite -r1
117 # Create a modified file.
118 modify_content(user-source)
120 #-----------------------------------------------------------------------------
121 # Test updating the user work directory with the command-line interface.
122 message("Running CTest Dashboard Command Line...")
124 # Create the user build tree.
125 create_build_tree(user-source user-binary)
126 file(APPEND ${TOP}/user-binary/CTestConfiguration.ini
127 "# BZR command configuration
128 UpdateCommand: ${BZR}
131 # Run the dashboard command line interface.
132 run_dashboard_command_line(user-binary)
134 #-----------------------------------------------------------------------------
135 # Test initial checkout and update with a dashboard script.
136 message("Running CTest Dashboard Script...")
138 create_dashboard_script(dashboard.cmake
139 "# bzr command configuration
140 set(CTEST_BZR_COMMAND \"${BZR}\")
141 set(CTEST_CHECKOUT_COMMAND
142 \"\\\"\${CTEST_BZR_COMMAND}\\\" branch -r1 \\\"${REPO}\\\" dash-source\")
145 # Run the dashboard script with CTest.
146 run_dashboard_script(dashboard.cmake)