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 # CVSNT requires an extra option to 'cvs init'.
24 COMMAND ${CVS} --version
25 RESULT_VARIABLE RESULT
26 OUTPUT_VARIABLE OUTPUT
29 if("${RESULT}" STREQUAL "0" AND "${OUTPUT}" MATCHES "\\(CVSNT\\)")
31 message(" cvs init needs -n")
34 #-----------------------------------------------------------------------------
35 # Initialize the testing directory.
36 message("Creating test directory...")
39 #-----------------------------------------------------------------------------
40 # Create the repository.
41 message("Creating repository...")
42 file(MAKE_DIRECTORY ${TOP}/repo)
44 COMMAND ${CVSCMD} init ${CVS_INIT_OPT}
47 #-----------------------------------------------------------------------------
48 # Import initial content into the repository.
49 message("Importing content...")
50 create_content(import)
52 # Import the content into the repository.
54 WORKING_DIRECTORY ${TOP}/import
55 COMMAND ${CVSCMD} import -m "Initial content" Project vendor-tag release-tag
58 #-----------------------------------------------------------------------------
59 # Create a working tree.
60 message("Checking out revision 1...")
62 WORKING_DIRECTORY ${TOP}
63 COMMAND ${CVSCMD} co -d user-source Project
66 WORKING_DIRECTORY ${TOP}/user-source
67 COMMAND ${CVSCMD} tag Revision1
70 #-----------------------------------------------------------------------------
71 # Make changes in the working tree.
72 message("Changing content...")
73 update_content(user-source files_added files_removed dirs_added)
76 WORKING_DIRECTORY ${TOP}/user-source
77 COMMAND ${CVSCMD} add ${dirs_added}
81 WORKING_DIRECTORY ${TOP}/user-source
82 COMMAND ${CVSCMD} add ${files_added}
85 WORKING_DIRECTORY ${TOP}/user-source
86 COMMAND ${CVSCMD} rm ${files_removed}
89 #-----------------------------------------------------------------------------
90 # Commit the changes to the repository.
91 message("Committing revision 2...")
93 WORKING_DIRECTORY ${TOP}/user-source
94 COMMAND ${CVSCMD} commit -m "Changed content"
97 #-----------------------------------------------------------------------------
98 # Make changes in the working tree.
99 message("Changing content again...")
100 change_content(user-source)
102 #-----------------------------------------------------------------------------
103 # Commit the changes to the repository.
104 message("Committing revision 3...")
106 WORKING_DIRECTORY ${TOP}/user-source
107 COMMAND ${CVSCMD} commit -m "Changed content again"
110 #-----------------------------------------------------------------------------
111 # Go back to before the changes so we can test updating.
112 message("Backing up to revision 1...")
114 WORKING_DIRECTORY ${TOP}/user-source
115 COMMAND ${CVSCMD} up -rRevision1
118 # Delay 1 second so the modification produces a newer time stamp.
119 find_program(SLEEP sleep)
121 message("Delaying...")
122 execute_process(COMMAND ${SLEEP} 1)
125 # Create a modified file.
126 message("Modifying locally...")
127 modify_content(user-source)
129 #-----------------------------------------------------------------------------
130 # Test updating the user work directory with the command-line interface.
131 message("Running CTest Dashboard Command Line...")
133 # Create the user build tree.
134 create_build_tree(user-source user-binary)
135 file(APPEND ${TOP}/user-binary/CTestConfiguration.ini
136 "# CVS command configuration
138 CVSUpdateOptions: -dAP
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 "# CVS command configuration
150 set(CTEST_CVS_COMMAND \"${CVS}\")
151 set(CTEST_CVS_UPDATE_OPTIONS -dAP)
152 set(CTEST_CHECKOUT_COMMAND
153 \"\\\"\${CTEST_CVS_COMMAND}\\\" -d \\\"${REPO}\\\" co -rRevision1 -d dash-source Project\")
156 # Run the dashboard script with CTest.
157 run_dashboard_script(dashboard.cmake)