1 # This script drives creation of a Subversion 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}/@CTestUpdateSVN_DIR@")
9 # Include code common to all update tests.
10 include("@CMAKE_CURRENT_SOURCE_DIR@/CTestUpdateCommon.cmake")
12 #-----------------------------------------------------------------------------
13 # Report subversion tools in use.
14 message("Using subversion tools:")
15 set(SVN "@Subversion_SVN_EXECUTABLE@")
16 set(SVNADMIN "@Subversion_SVNADMIN_EXECUTABLE@")
17 message(" svn = ${SVN}")
18 message(" svnadmin = ${SVNADMIN}")
20 # Isolate svn test operations from the user configuration.
21 file(MAKE_DIRECTORY ${TOP}/config)
22 set(SVNCMD ${SVN} --config-dir ${TOP}/config)
23 set(SVNUSER --username "test author" --non-interactive)
25 #-----------------------------------------------------------------------------
26 # Initialize the testing directory.
27 message("Creating test directory...")
30 #-----------------------------------------------------------------------------
31 # Create the repository.
32 message("Creating repository...")
33 file(MAKE_DIRECTORY ${TOP}/repo)
35 COMMAND ${SVNADMIN} create --config-dir ${TOP}/config ${TOP}/repo
37 set(REPO file:///${TOP}/repo/trunk)
39 #-----------------------------------------------------------------------------
40 # Import initial content into the repository.
41 message("Importing content...")
42 create_content(import)
44 # Import the content into the repository.
46 WORKING_DIRECTORY ${TOP}/import
47 COMMAND ${SVNCMD} import ${SVNUSER} -m "Initial content" . "${REPO}"
50 #-----------------------------------------------------------------------------
51 # Create a working tree.
52 message("Checking out revision 1...")
54 WORKING_DIRECTORY ${TOP}
55 COMMAND ${SVNCMD} co ${SVNUSER} ${REPO} user-source
58 #-----------------------------------------------------------------------------
59 # Make changes in the working tree.
60 message("Changing content...")
61 update_content(user-source files_added files_removed dirs_added)
64 WORKING_DIRECTORY ${TOP}/user-source
65 COMMAND ${SVNCMD} add ${dirs_added}
69 WORKING_DIRECTORY ${TOP}/user-source
70 COMMAND ${SVNCMD} add ${files_added}
73 WORKING_DIRECTORY ${TOP}/user-source
74 COMMAND ${SVNCMD} rm ${files_removed}
77 #-----------------------------------------------------------------------------
78 # Commit the changes to the repository.
79 message("Committing revision 2...")
81 WORKING_DIRECTORY ${TOP}/user-source
82 COMMAND ${SVNCMD} commit -m "Changed content"
85 #-----------------------------------------------------------------------------
86 # Make changes in the working tree.
87 message("Changing content again...")
88 change_content(user-source)
90 #-----------------------------------------------------------------------------
91 # Commit the changes to the repository.
92 message("Committing revision 3...")
94 WORKING_DIRECTORY ${TOP}/user-source
95 COMMAND ${SVNCMD} commit -m "Changed content again"
98 #-----------------------------------------------------------------------------
99 # Go back to before the changes so we can test updating.
100 message("Backing up to revision 1...")
102 WORKING_DIRECTORY ${TOP}/user-source
103 COMMAND ${SVNCMD} up -r1
106 # Create a modified file.
107 modify_content(user-source)
109 #-----------------------------------------------------------------------------
110 # Test updating the user work directory with the command-line interface.
111 message("Running CTest Dashboard Command Line...")
113 # Create the user build tree.
114 create_build_tree(user-source user-binary)
115 file(APPEND ${TOP}/user-binary/CTestConfiguration.ini
116 "# SVN command configuration
118 SVNUpdateOptions: --config-dir \"${TOP}/config\"
121 # Run the dashboard command line interface.
122 run_dashboard_command_line(user-binary)
124 #-----------------------------------------------------------------------------
125 # Test initial checkout and update with a dashboard script.
126 message("Running CTest Dashboard Script...")
128 create_dashboard_script(dashboard.cmake
129 "# Subversion command configuration
130 set(CTEST_SVN_COMMAND \"${SVN}\")
131 set(CTEST_SVN_UPDATE_OPTIONS
132 \"--config-dir \\\"\${CTEST_DASHBOARD_ROOT}/config\\\"\")
133 set(CTEST_CHECKOUT_COMMAND
134 \"\\\"\${CTEST_SVN_COMMAND}\\\" co -r1 \\\"${REPO}\\\" dash-source\")
137 # Run the dashboard script with CTest.
138 run_dashboard_script(dashboard.cmake)