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

Re: [PATCH] tests: cmdline: actual disk tree has wrong paths

From: Neels Hofmeyr <neels_at_elego.de>
Date: Sun, 24 Aug 2008 06:14:52 +0200

Neels Hofmeyr wrote:
> Hi,
>
> in the cmdline tests, after dumping "actual disk" trees to screen, it came
> to my attention that all nodes below a depth of two have a wrong node.path.
>
> This is of course wrong, but has no bad effects in the current cmdline
> tests. But since the tests now print out these trees in the error output, it
> becomes confusing.
>
> It is particularly annoying when pasting the printout to a py script, since
> it requires a degree of figuring out and editing.
>
>
> In the following example, I simulated a failure of update_tests.py 9 on
> today's trunk, by adding a fantasy node to the expected disk tree. It prints
> out the following actual disk tree:
>
> [[[
> ACTUAL DISK TREE:
> svntest.wc.State('', {
> 'iota' : Item(contents="This is the file 'iota'.\n"),
> 'A' : Item(),
> 'A/mu' : Item(contents="This is the file 'mu'.\n"),
> 'A/C' : Item(),
> 'A/B' : Item(),
> 'B/lambda' : Item(contents="This is the file 'lambda'.\n"),
> 'B/F' : Item(),
> 'B/E' : Item(),
> 'E/beta' : Item(contents="This is the file 'beta'.\n"),
> 'E/alpha' : Item(contents="This is the file 'alpha'.\n"),
> 'A/D' : Item(),
> 'D/gamma' : Item(contents="This is the file 'gamma'.\n"),
> 'D/G' : Item(),
> 'G/tau' : Item(contents="This is the file 'tau'.\n"),
> 'G/pi' : Item(contents="This is the file 'pi'.\n"),
> 'G/rho' : Item(contents="This is the file 'rho'.\n"),
> 'D/H' : Item(),
> 'H/chi' : Item(contents="This is the file 'chi'.\n"),
> 'H/psi' : Item(contents="This is the file 'psi'.\n"),
> 'H/omega' : Item(contents="This is the file 'omega'.\n"),
> })
> ]]]
>
> This tree was read from disk and is actually well structured (node G
> actually sits below node D, which sits below node A, etc.).

To clarify, this tree was created as a mirror of an actual filesystem tree,
and the actual tree node instances in memory are well structured. Just their
PATH strings are wrong, thus the printout represents neither tree nor disk.

>
> Each node has a PATH element, which holds its "full" path within the
> tree structure as a string. The nodes are printed out using this PATH.
>
> Now, note that each PATH only has two node names. What should have been
> 'A/D/G/tau' is actually just 'G/tau'. Each node contains only its own name
> and that of its parent. This only happens for DISK trees.

s/Each node contains only/Each node's PATH contains only/

>
>
> I found the cause and came up with this patch. By reversing the order in
> which nodes are added to the tree, the PATHs are constructed correctly.
>
>
> But!, Fixing the issue also adds a '__SVN_ROOT_NODE/' string to the start of
> each path, as in all the other "actual" trees. The directory

The other tree kinds being "output", "status" and "skip", this one being a
"disk" tree. Of all four kinds, there are both "actual" and "expected"
representations. Just so you know what I'm talking about.

> `__SVN_ROOT_NODE' doesn't actually exist, it is just a reserved name.
>
> This, however, breaks update_tests.py 1 (and only this one, I ran the whole
> bunch) with:
>
> IOError: [Errno 2] No such file or directory:
> 'svn-test-work/working_copies/update_tests-1.backup/__SVN_ROOT_NODE/A/theta.r3'
>
> It's obvious that this test relied on the erratic node paths. Since it only
> uses the code in question on paths with a depth of two (`A/theta.r2' and
> `A/theta.r3'), the test was simply lucky to work.
>
> This patch also fixes this error (failure of update_tests.py 1) by removing
> the `__SVN_ROOT_NODE' path element from node PATHs before using it.

s/it/them/

>
>
> (It might make sense to altogether remove the root_node_name from PATH
> strings in all of the different "actual" trees. But that's another issue.)
>
> ~Neels
>
>
> [[[
> In the cmdline tests, fix PATH in "ACTUAL DISK" tree nodes, so that the
> disk tree is printed correctly in the error output of a failing test.
> "ACTUAL DISK" tree nodes only got a PATH string up to their respective
> parents, breaking PATHs at a depth of more than 2; in side-effect, the
> svntest.tree.root_node_name was missing from each PATH.
> Also fix update_tests.py 1, which relied on the erratic PATH.
>
> * subversion/tests/cmdline/svntest/tree.py (handle_dir): Reverse the
> order in which nodes are added to the tree, fixing PATH strings.
>
> * subversion/tests/cmdline/update_tests.py (detect_extra_files):
> Strip the svntest.tree.root_node_name from nodes' PATH before
> using it as a real file system path.
>
> Patch by: neels
> ]]]
>
>

-- 
Neels Hofmeyr -- elego Software Solutions GmbH
Gustav-Meyer-Allee 25 / Gebäude 12, 13355 Berlin, Germany
phone: +49 30 23458696  mobile: +49 177 2345869  fax: +49 30 23458695
http://www.elegosoft.com | Geschäftsführer: Olaf Wagner | Sitz: Berlin
Handelsreg: Amtsgericht Charlottenburg HRB 77719 | USt-IdNr: DE163214194

Received on 2008-08-24 06:15:25 CEST

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.