1 # This script drives creation of a Mercurial 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}/@CTestUpdateHG_DIR@")
9 # Include code common to all update tests.
10 include("@CMAKE_CURRENT_SOURCE_DIR@/CTestUpdateCommon.cmake")
12 #-----------------------------------------------------------------------------
13 # Report hg tools in use.
14 message("Using HG tools:")
15 set(HG "@HG_EXECUTABLE@")
16 message(" hg = ${HG}")
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.hg)
28 WORKING_DIRECTORY ${TOP}/repo.hg
31 set(REPO file://${TOP}/repo.hg)
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
42 run_child(WORKING_DIRECTORY ${TOP}/import
45 run_child(WORKING_DIRECTORY ${TOP}/import
46 COMMAND ${HG} commit -m "Initial content"
47 -u "Test Author <testauthor@cmake.org>"
49 run_child(WORKING_DIRECTORY ${TOP}/import
50 COMMAND ${HG} push "${REPO}"
53 #-----------------------------------------------------------------------------
54 # Create a working tree.
55 message("Checking out first revision...")
57 WORKING_DIRECTORY ${TOP}
58 COMMAND ${HG} clone ${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 ${HG} add ${dirs_added}
72 WORKING_DIRECTORY ${TOP}/user-source
73 COMMAND ${HG} add ${files_added}
76 WORKING_DIRECTORY ${TOP}/user-source
77 COMMAND ${HG} rm ${files_removed}
80 WORKING_DIRECTORY ${TOP}/user-source
84 #-----------------------------------------------------------------------------
85 # Commit the changes to the repository.
86 message("Committing revision 2...")
88 WORKING_DIRECTORY ${TOP}/user-source
89 COMMAND ${HG} commit -m "Changed content"
90 -u "Test Author <testauthor@cmake.org>"
93 WORKING_DIRECTORY ${TOP}/user-source
97 #-----------------------------------------------------------------------------
98 # Make changes in the working tree.
99 message("Changing content again...")
100 change_content(user-source)
102 WORKING_DIRECTORY ${TOP}/user-source
106 #-----------------------------------------------------------------------------
107 # Commit the changes to the repository.
108 message("Committing revision 3...")
110 WORKING_DIRECTORY ${TOP}/user-source
111 COMMAND ${HG} commit -m "Changed content again"
112 -u "Test Author <testauthor@cmake.org>"
115 WORKING_DIRECTORY ${TOP}/user-source
119 #-----------------------------------------------------------------------------
120 # Go back to before the changes so we can test updating.
121 message("Backing up to first revision...")
123 WORKING_DIRECTORY ${TOP}/user-source
124 COMMAND ${HG} update -C -r 0
127 # Create a modified file.
128 modify_content(user-source)
130 #-----------------------------------------------------------------------------
131 # Test updating the user work directory with the command-line interface.
132 message("Running CTest Dashboard Command Line...")
134 # Create the user build tree.
135 create_build_tree(user-source user-binary)
136 file(APPEND ${TOP}/user-binary/CTestConfiguration.ini
137 "# HG command configuration
141 # Run the dashboard command line interface.
142 run_dashboard_command_line(user-binary)
144 #-----------------------------------------------------------------------------
145 # Test initial checkout and update with a dashboard script.
146 message("Running CTest Dashboard Script...")
148 create_dashboard_script(dashboard.cmake
149 "# hg command configuration
150 set(CTEST_HG_COMMAND \"${HG}\")
151 set(CTEST_HG_UPDATE_OPTIONS)
153 WORKING_DIRECTORY \"${TOP}\"
154 COMMAND \"${HG}\" clone \"${REPO}\" dash-source
157 WORKING_DIRECTORY \"${TOP}/dash-source\"
158 COMMAND \"${HG}\" update -C -r 0
162 # Run the dashboard script with CTest.
163 run_dashboard_script(dashboard.cmake)