Răsfoiți Sursa

ENH: Enhance CTest.UpdateCVS/SVN tests

This adds a source tree subdirectory to the content of the test
projects.  It also smoke tests more than one revision worth of changes.
Brad King 17 ani în urmă
părinte
comite
5b49f22caf

+ 20 - 1
Tests/CTestUpdateCVS.cmake.in

@@ -57,7 +57,13 @@ run_child(
 #-----------------------------------------------------------------------------
 # Make changes in the working tree.
 message("Changing content...")
-update_content(user-source files_added files_removed)
+update_content(user-source files_added files_removed dirs_added)
+if(dirs_added)
+  run_child(
+    WORKING_DIRECTORY ${TOP}/user-source
+    COMMAND ${CVSCMD} add ${dirs_added}
+    )
+endif(dirs_added)
 run_child(
   WORKING_DIRECTORY ${TOP}/user-source
   COMMAND ${CVSCMD} add ${files_added}
@@ -75,6 +81,19 @@ run_child(
   COMMAND ${CVSCMD} commit -m "Changed content"
   )
 
+#-----------------------------------------------------------------------------
+# Make changes in the working tree.
+message("Changing content again...")
+change_content(user-source)
+
+#-----------------------------------------------------------------------------
+# Commit the changes to the repository.
+message("Committing revision 3...")
+run_child(
+  WORKING_DIRECTORY ${TOP}/user-source
+  COMMAND ${CVSCMD} commit -m "Changed content again"
+  )
+
 #-----------------------------------------------------------------------------
 # Go back to before the changes so we can test updating.
 message("Backing up to revision 1...")

+ 17 - 4
Tests/CTestUpdateCommon.cmake

@@ -88,14 +88,25 @@ endfunction(create_content)
 
 #-----------------------------------------------------------------------------
 # Function to update content.
-function(update_content dir added_var removed_var)
+function(update_content dir added_var removed_var dirs_var)
   file(APPEND ${TOP}/${dir}/foo.txt "foo line 2\n")
   file(WRITE ${TOP}/${dir}/zot.txt "zot\n")
   file(REMOVE ${TOP}/${dir}/bar.txt)
-  set(${added_var} zot.txt PARENT_SCOPE)
+  file(MAKE_DIRECTORY ${TOP}/${dir}/subdir)
+  file(WRITE ${TOP}/${dir}/subdir/foo.txt "foo\n")
+  file(WRITE ${TOP}/${dir}/subdir/bar.txt "bar\n")
+  set(${dirs_var} subdir PARENT_SCOPE)
+  set(${added_var} zot.txt subdir/foo.txt subdir/bar.txt PARENT_SCOPE)
   set(${removed_var} bar.txt PARENT_SCOPE)
 endfunction(update_content)
 
+#-----------------------------------------------------------------------------
+# Function to change existing files
+function(change_content dir)
+  file(APPEND ${TOP}/${dir}/foo.txt "foo line 3\n")
+  file(APPEND ${TOP}/${dir}/subdir/foo.txt "foo line 2\n")
+endfunction(change_content)
+
 #-----------------------------------------------------------------------------
 # Function to write CTestConfiguration.ini content.
 function(create_build_tree src_dir bin_dir)
@@ -136,7 +147,8 @@ function(run_dashboard_command_line bin_dir)
     )
 
   # Verify the updates reported by CTest.
-  check_updates(${bin_dir} foo.txt bar.txt zot.txt)
+  check_updates(${bin_dir} foo.txt bar.txt zot.txt
+                           subdir/foo.txt subdir/bar.txt)
 endfunction(run_dashboard_command_line)
 
 #-----------------------------------------------------------------------------
@@ -148,7 +160,8 @@ function(run_dashboard_script name)
     )
 
   # Verify the updates reported by CTest.
-  check_updates(dash-binary foo.txt bar.txt zot.txt)
+  check_updates(dash-binary foo.txt bar.txt zot.txt
+                            subdir/foo.txt subdir/bar.txt)
 endfunction(run_dashboard_script)
 
 #-----------------------------------------------------------------------------

+ 20 - 1
Tests/CTestUpdateSVN.cmake.in

@@ -58,7 +58,13 @@ run_child(
 #-----------------------------------------------------------------------------
 # Make changes in the working tree.
 message("Changing content...")
-update_content(user-source files_added files_removed)
+update_content(user-source files_added files_removed dirs_added)
+if(dirs_added)
+  run_child(
+    WORKING_DIRECTORY ${TOP}/user-source
+    COMMAND ${SVNCMD} add ${dirs_added}
+    )
+endif(dirs_added)
 run_child(
   WORKING_DIRECTORY ${TOP}/user-source
   COMMAND ${SVNCMD} add ${files_added}
@@ -76,6 +82,19 @@ run_child(
   COMMAND ${SVNCMD} commit -m "Changed content"
   )
 
+#-----------------------------------------------------------------------------
+# Make changes in the working tree.
+message("Changing content again...")
+change_content(user-source)
+
+#-----------------------------------------------------------------------------
+# Commit the changes to the repository.
+message("Committing revision 3...")
+run_child(
+  WORKING_DIRECTORY ${TOP}/user-source
+  COMMAND ${SVNCMD} commit -m "Changed content again"
+  )
+
 #-----------------------------------------------------------------------------
 # Go back to before the changes so we can test updating.
 message("Backing up to revision 1...")