1 # This script drives creation of a CVS 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}/@CTestUpdateCVS_DIR@")
9 # Include code common to all update tests.
10 include("@CMAKE_CURRENT_SOURCE_DIR@/CTestUpdateCommon.cmake")
12 #-----------------------------------------------------------------------------
13 # Report CVS tools in use.
14 message("Using CVS tools:")
15 set(CVS "@CVS_EXECUTABLE@")
16 message(" cvs = ${CVS}")
19 set(CVSCMD ${CVS} -d${REPO})
21 #-----------------------------------------------------------------------------
22 # Initialize the testing directory.
23 message("Creating test directory...")
26 #-----------------------------------------------------------------------------
27 # Create the repository.
28 message("Creating repository...")
29 file(MAKE_DIRECTORY ${TOP}/repo)
31 COMMAND ${CVSCMD} init
34 #-----------------------------------------------------------------------------
35 # Import initial content into the repository.
36 message("Importing content...")
37 create_content(import)
39 # Import the content into the repository.
41 WORKING_DIRECTORY ${TOP}/import
42 COMMAND ${CVSCMD} import -m "Initial content" Project vendor-tag release-tag
45 #-----------------------------------------------------------------------------
46 # Create a working tree.
47 message("Checking out revision 1...")
49 WORKING_DIRECTORY ${TOP}
50 COMMAND ${CVSCMD} co -d user-source Project
53 WORKING_DIRECTORY ${TOP}/user-source
54 COMMAND ${CVSCMD} tag Revision1
57 #-----------------------------------------------------------------------------
58 # Make changes in the working tree.
59 message("Changing content...")
60 update_content(user-source files_added files_removed dirs_added)
63 WORKING_DIRECTORY ${TOP}/user-source
64 COMMAND ${CVSCMD} add ${dirs_added}
68 WORKING_DIRECTORY ${TOP}/user-source
69 COMMAND ${CVSCMD} add ${files_added}
72 WORKING_DIRECTORY ${TOP}/user-source
73 COMMAND ${CVSCMD} rm ${files_removed}
76 #-----------------------------------------------------------------------------
77 # Commit the changes to the repository.
78 message("Committing revision 2...")
80 WORKING_DIRECTORY ${TOP}/user-source
81 COMMAND ${CVSCMD} commit -m "Changed content"
84 #-----------------------------------------------------------------------------
85 # Make changes in the working tree.
86 message("Changing content again...")
87 change_content(user-source)
89 #-----------------------------------------------------------------------------
90 # Commit the changes to the repository.
91 message("Committing revision 3...")
93 WORKING_DIRECTORY ${TOP}/user-source
94 COMMAND ${CVSCMD} commit -m "Changed content again"
97 #-----------------------------------------------------------------------------
98 # Go back to before the changes so we can test updating.
99 message("Backing up to revision 1...")
101 WORKING_DIRECTORY ${TOP}/user-source
102 COMMAND ${CVSCMD} up -rRevision1
105 # Delay 1 second so the modification produces a newer time stamp.
106 find_program(SLEEP sleep)
108 message("Delaying...")
109 execute_process(COMMAND ${SLEEP} 1)
112 # Create a modified file.
113 message("Modifying locally...")
114 modify_content(user-source)
116 #-----------------------------------------------------------------------------
117 # Test updating the user work directory with the command-line interface.
118 message("Running CTest Dashboard Command Line...")
120 # Create the user build tree.
121 create_build_tree(user-source user-binary)
122 file(APPEND ${TOP}/user-binary/CTestConfiguration.ini
123 "# CVS command configuration
125 CVSUpdateOptions: -dAP
128 # Run the dashboard command line interface.
129 run_dashboard_command_line(user-binary)
131 #-----------------------------------------------------------------------------
132 # Test initial checkout and update with a dashboard script.
133 message("Running CTest Dashboard Script...")
135 create_dashboard_script(dashboard.cmake
136 "# CVS command configuration
137 set(CTEST_CVS_COMMAND \"${CVS}\")
138 set(CTEST_CVS_UPDATE_OPTIONS -dAP)
139 set(CTEST_CHECKOUT_COMMAND
140 \"\\\"\${CTEST_CVS_COMMAND}\\\" -d \\\"${REPO}\\\" co -rRevision1 -d dash-source Project\")
143 # Run the dashboard script with CTest.
144 run_dashboard_script(dashboard.cmake)