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 # Create a modified file.
106 modify_content(user-source)
108 #-----------------------------------------------------------------------------
109 # Test updating the user work directory with the command-line interface.
110 message("Running CTest Dashboard Command Line...")
112 # Create the user build tree.
113 create_build_tree(user-source user-binary)
114 file(APPEND ${TOP}/user-binary/CTestConfiguration.ini
115 "# CVS command configuration
117 CVSUpdateOptions: -dAP
120 # Run the dashboard command line interface.
121 run_dashboard_command_line(user-binary)
123 #-----------------------------------------------------------------------------
124 # Test initial checkout and update with a dashboard script.
125 message("Running CTest Dashboard Script...")
127 create_dashboard_script(dashboard.cmake
128 "# CVS command configuration
129 set(CTEST_CVS_COMMAND \"${CVS}\")
130 set(CTEST_CVS_UPDATE_OPTIONS -dAP)
131 set(CTEST_CHECKOUT_COMMAND
132 \"\\\"\${CTEST_CVS_COMMAND}\\\" -d \\\"${REPO}\\\" co -rRevision1 -d dash-source Project\")
135 # Run the dashboard script with CTest.
136 run_dashboard_script(dashboard.cmake)