ENH: set expected failure for tests
[cmake.git] / Tests / CTestUpdateHG.cmake.in
blobf2e5f83878f1ea2a41d0a634435c476b72c1f0af
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...")
21 init_testing()
23 #-----------------------------------------------------------------------------
24 # Create the repository.
25 message("Creating repository...")
26 file(MAKE_DIRECTORY ${TOP}/repo.hg)
27 run_child(
28   WORKING_DIRECTORY ${TOP}/repo.hg
29   COMMAND ${HG} init
30   )
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
40   COMMAND ${HG} init
41   )
42 run_child(WORKING_DIRECTORY ${TOP}/import
43   COMMAND ${HG} add .
44   )
45 run_child(WORKING_DIRECTORY ${TOP}/import
46   COMMAND ${HG} commit -m "Initial content"
47                        -u "Test Author <testauthor@cmake.org>"
48   )
49 run_child(WORKING_DIRECTORY ${TOP}/import
50   COMMAND ${HG} push "${REPO}"
51   )
53 #-----------------------------------------------------------------------------
54 # Create a working tree.
55 message("Checking out first revision...")
56 run_child(
57   WORKING_DIRECTORY ${TOP}
58   COMMAND ${HG} clone ${REPO} user-source
59   )
61 #-----------------------------------------------------------------------------
62 # Make changes in the working tree.
63 message("Changing content...")
64 update_content(user-source files_added files_removed dirs_added)
65 if(dirs_added)
66   run_child(
67     WORKING_DIRECTORY ${TOP}/user-source
68     COMMAND ${HG} add ${dirs_added}
69     )
70 endif(dirs_added)
71 run_child(
72   WORKING_DIRECTORY ${TOP}/user-source
73   COMMAND ${HG} add ${files_added}
74   )
75 run_child(
76   WORKING_DIRECTORY ${TOP}/user-source
77   COMMAND ${HG} rm ${files_removed}
78   )
79 run_child(
80   WORKING_DIRECTORY ${TOP}/user-source
81   COMMAND ${HG} add
82   )
84 #-----------------------------------------------------------------------------
85 # Commit the changes to the repository.
86 message("Committing revision 2...")
87 run_child(
88   WORKING_DIRECTORY ${TOP}/user-source
89   COMMAND ${HG} commit -m "Changed content"
90                        -u "Test Author <testauthor@cmake.org>"
91   )
92 run_child(
93   WORKING_DIRECTORY ${TOP}/user-source
94   COMMAND ${HG} push
95   )
97 #-----------------------------------------------------------------------------
98 # Make changes in the working tree.
99 message("Changing content again...")
100 change_content(user-source)
101 run_child(
102   WORKING_DIRECTORY ${TOP}/user-source
103   COMMAND ${HG} add
104   )
106 #-----------------------------------------------------------------------------
107 # Commit the changes to the repository.
108 message("Committing revision 3...")
109 run_child(
110   WORKING_DIRECTORY ${TOP}/user-source
111   COMMAND ${HG} commit -m "Changed content again"
112                        -u "Test Author <testauthor@cmake.org>"
113   )
114 run_child(
115   WORKING_DIRECTORY ${TOP}/user-source
116   COMMAND ${HG} push
117   )
119 #-----------------------------------------------------------------------------
120 # Go back to before the changes so we can test updating.
121 message("Backing up to first revision...")
122 run_child(
123   WORKING_DIRECTORY ${TOP}/user-source
124   COMMAND ${HG} update -C -r 0
125   )
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
138 UpdateCommand: ${HG}
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)
152 execute_process(
153   WORKING_DIRECTORY \"${TOP}\"
154   COMMAND \"${HG}\" clone \"${REPO}\" dash-source
155   )
156 execute_process(
157   WORKING_DIRECTORY \"${TOP}/dash-source\"
158   COMMAND \"${HG}\" update -C -r 0
159   )
162 # Run the dashboard script with CTest.
163 run_dashboard_script(dashboard.cmake)