[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Test suite: expected disk tree: how to write it, and making it optional

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2004-03-10 21:52:27 CET

Can someone help me write the expected disk tree for this test? I always have trouble with these.

The three diffs below are:

1) The test that I am trying to write, but passing 'None' instead of 'expected_disk' to run_and_verify_update.

2) Patch to run_and_verify_update to accept 'None' as meaning don't test this.

3) The bug fix that this tests tests. Without this, the final update fails anyway. With this, the test passes except that if it verifies the tree, it complains:

CMD: svn "up" "working_copies/update_tests-20" "--config-dir" "/home/julianfoad/build/subversion/subversion/tests/clients/cmdline/local_tmp/config" <TIME = 1.541314>
Got singleton from expected tree: B
 * Node name: B
    Path: __SVN_ROOT_NODE/A/B
    Contents: None
    Properties: {}
    Attributes: {}
    Children: 3
Unequal at node A
EXCEPTION: SVNTreeUnequal
FAIL: update_tests.py 20: update

The tree that I expect (and get, as far as I can see) is the standard Greek tree but without the subtree "A/B".

Any help would be appreciated.

Would anyone else like me to patch the test harness to make the various expected trees optional, as below but extended to other similar functions as well? I have wanted this before when struggling to write tests.

- Julian

Index: subversion/tests/clients/cmdline/update_tests.py
===================================================================
--- subversion/tests/clients/cmdline/update_tests.py (revision 8966)
+++ subversion/tests/clients/cmdline/update_tests.py (working copy)
@@ -1219,6 +1219,46 @@
                                         wc_dir)

+#----------------------------------------------------------------------
+
+def update_deletion_inside_out(sbox):
+ "update child before parent of a deleted tree"
+
+ sbox.build()
+ wc_dir = sbox.wc_dir
+
+ parent_path = os.path.join(wc_dir, 'A', 'B')
+ child_path = os.path.join(parent_path, 'E') # Could be a file, doesn't matter
+
+ # Delete the parent directory.
+ svntest.actions.run_and_verify_svn(None, None, [],
+ 'rm', parent_path)
+ svntest.actions.run_and_verify_svn(None, None, [],
+ 'ci', '-m', '', wc_dir)
+
+ # Update back to r1.
+ svntest.actions.run_and_verify_svn(None, None, [],
+ 'update', '-r', '1', wc_dir)
+
+ # Update just the child to r2.
+ svntest.actions.run_and_verify_svn(None, None, [],
+ 'update', '-r', '2', child_path)
+
+ # Now try a normal update.
+ expected_output = svntest.wc.State(wc_dir, {
+ 'A/B' : Item(status='D '),
+ })
+ expected_disk = svntest.main.greek_state.copy()
+ expected_disk.remove('A/B')
+
+ svntest.actions.run_and_verify_update(wc_dir,
+ expected_output,
+ None, #expected_disk
+ None, None,
+ None, None, None, None, 0,
+ wc_dir)
+
+
 ########################################################################
 # Run the tests

@@ -1244,6 +1284,7 @@
               non_recursive_update,
               checkout_empty_dir,
               update_to_deletion,
+ update_deletion_inside_out,
              ]

 if __name__ == '__main__':
Index: subversion/tests/clients/cmdline/svntest/actions.py
===================================================================
--- subversion/tests/clients/cmdline/svntest/actions.py (revision 8966)
+++ subversion/tests/clients/cmdline/svntest/actions.py (working copy)
@@ -278,15 +278,17 @@
   on failure."""

   # Verify actual output against expected output.
- tree.compare_trees (actual_output, output_tree)
+ if output_tree:
+ tree.compare_trees (actual_output, output_tree)

- # Create a tree by scanning the working copy
- mytree = tree.build_tree_from_wc (wc_dir_name, check_props)
+ if disk_tree:
+ # Create a tree by scanning the working copy
+ mytree = tree.build_tree_from_wc (wc_dir_name, check_props)

- # Verify expected disk against actual disk.
- tree.compare_trees (mytree, disk_tree,
- singleton_handler_a, a_baton,
- singleton_handler_b, b_baton)
+ # Verify expected disk against actual disk.
+ tree.compare_trees (mytree, disk_tree,
+ singleton_handler_a, a_baton,
+ singleton_handler_b, b_baton)

   # Verify via 'status' command too, if possible.
   if status_tree:
Index: subversion/libsvn_repos/reporter.c
===================================================================
--- subversion/libsvn_repos/reporter.c (revision 8966)
+++ subversion/libsvn_repos/reporter.c (working copy)
@@ -737,7 +737,7 @@
       t_entry = apr_hash_get (t_entries, name, APR_HASH_KEY_STRING);
       s_fullpath = s_path ? svn_path_join (s_path, name, subpool) : NULL;
       s_entry = s_entries ?
- apr_hash_get (t_entries, name, APR_HASH_KEY_STRING) : NULL;
+ apr_hash_get (s_entries, name, APR_HASH_KEY_STRING) : NULL;

       SVN_ERR (update_entry (b, s_rev, s_fullpath, s_entry, t_fullpath,
                              t_entry, dir_baton, e_fullpath, info,

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Mar 10 21:51:38 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.