List Info

Thread: cmdline test help for relative url merge test




cmdline test help for relative url merge test
user name
2007-11-05 22:57:21
Ok I'm trying to write a test case for my relative url
support in the
command-line client.  I am in
subversion/tests/cmdline/merge_tests.py
and have copy-n-pasted a bit of code and modified it in an
attempt to
test my implementation.  I successfully worked through a
couple of
error already, but I'm really confused on this one.

Attached:
relative_url_merge_test.txt   : My python sub-routine
merge_test_75_failure.txt    : The failure message I get
when I run my
test (#75)

Any help would be much appreciated!  I'm not much of a
python guy, and
this is my first stab at the svn cmdline test suite.  It
looks very
well developed, but I am still very confused!

Thanks,
Troy
-- 
"Beware of spyware. If you can, use the Firefox
browser." - USA Today
Download now at http://getfirefox.com
Registered Linux User #354814 ( http://counter.li.org/)

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribesubversion.tigris.org
For additional commands, e-mail: dev-helpsubversion.tigris.org
  
  
Re: cmdline test help for relative url merge test
user name
2007-11-06 08:43:24
"Troy Curtis Jr" <troycurtisjrgmail.com> writes:

> Couldn't find node 'B2' in expected tree
>  * Node name:   B2
>     Path:      
svn-test-work/working_copies/merge_tests-75/A/B2
>     Contents:   N/A (node is a directory)
>     Properties: {}
>     Attributes: {'status': '  ', 'wc_rev': '2'}
>     Children:   3

>      # Now do the merge with relative url
>      expected_output = wc.State(wc_dir, {
>          'A/B2/lambda'  : Item(status='U ', wc_rev=3),
>          })
>
>      expected_disk = svntest.main.greek_state.copy()

I think that creates a tree without B2.

>      expected_disk.tweak('A/B2/lambda',
>                         
contents=expected_disk.desc['A/B2/lambda'].contents
>                          + lambda_text)

So you need expected_disk.add here.

>
>      expected_status =
svntest.actions.get_virginal_state(wc_dir, 3)
>      expected_status.add({
>          'A/B2/lambda'   : Item(status='M ',
wc_rev=3),
>          })

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribesubversion.tigris.org
For additional commands, e-mail: dev-helpsubversion.tigris.org


Re: cmdline test help for relative url merge test
user name
2007-11-06 16:10:30
On Mon, 05 Nov 2007, Troy Curtis Jr wrote:
...
> relative_url_merge_test.txt   : My python sub-routine
> merge_test_75_failure.txt    : The failure message I
get when I run my
> test (#75)

Hey Troy, this was pretty much the perfect information to
provide!
The only thing you could've done even better is provide
relative_url_merge_test.txt as a patch, so that the line
numbers in
the error message had a chance of being meaningful.

> Any help would be much appreciated!  I'm not much of a
python guy, and
> this is my first stab at the svn cmdline test suite. 
It looks very
> well developed, but I am still very confused!

Troy, the error you're seeing "Couldn't find node 'B2'
in expected
tree", is the test framework's way of saying that the
expected_status
tree that you created as part of your test differs from the
actual
status output that Subversion is seeing.  Looking at the
stack trace
that's part of your error message, we can tell that this is
failed
comparison is triggered after the test suite makes a
commit.

The first place in your test that you make a commit (after
your
perform a WC -> WC copy), you are explicitly adding the
tree "A/B2" to
your expected_status tree.  I'm guessing that this commit
is
successful (if we had meaningful line numbers in that stack
trace,
we'd know for sure ;).

The second spot that your test makes a commit clobbers the
expected_status tree you'd previously created:

     expected_status =
svntest.actions.get_virginal_state(wc_dir, 2)
     expected_status.add({
         'A/B/lambda'   : Item(status='  ', wc_rev=3),
         })

I'm guessing that you were assuming that
get_virginal_state() scans
your WC, and produces a new tree that corresponds to it. 
Whelp, it
doesn't -- it only gets a copy of the initial state, with
revnum set
as specified.  It's currently on the programmer to
explicitly carry
forward all the WC changes that they've made in the expected
tree
structures.

Instead of resetting expected_status using
get_virginal_state(), use:

  expected_status.tweak(wc_rev=2)

...and then proceed with the add().


> Couldn't find node 'B2' in expected tree
>  * Node name:   B2
>     Path:      
svn-test-work/working_copies/merge_tests-75/A/B2
>     Contents:   N/A (node is a directory)
>     Properties: {}
>     Attributes: {'status': '  ', 'wc_rev': '2'}
>     Children:   3
> Unequal at node A
> Unequal at node merge_tests-75
> Unequal at node working_copies
> Unequal at node svn-test-work
> EXPECTED STATUS OUTPUT TREE:
> ROOT
>   +-- svn-test-work
>         +-- working_copies
>               +-- merge_tests-75
>                     |-- A
>                     |     |-- B
>                     |     |     |-- E
>                     |     |     |     |-- beta
>                     |     |     |     +-- alpha
>                     |     |     |-- F
>                     |     |     +-- lambda
>                     |     |-- D
>                     |     |     |-- G
>                     |     |     |     |-- rho
>                     |     |     |     |-- pi
>                     |     |     |     +-- tau
>                     |     |     |-- H
>                     |     |     |     |-- chi
>                     |     |     |     |-- psi
>                     |     |     |     +-- omega
>                     |     |     +-- gamma
>                     |     |-- C
>                     |     +-- mu
>                     +-- iota
> ACTUAL STATUS OUTPUT TREE:
> ROOT
>   +-- svn-test-work
>         +-- working_copies
>               +-- merge_tests-75
>                     |-- A
>                     |     |-- B
>                     |     |     |-- lambda
>                     |     |     |-- E
>                     |     |     |     |-- alpha
>                     |     |     |     +-- beta
>                     |     |     +-- F
>                     |     |-- mu
>                     |     |-- C
>                     |     |-- D
>                     |     |     |-- gamma
>                     |     |     |-- G
>                     |     |     |     |-- pi
>                     |     |     |     |-- rho
>                     |     |     |     +-- tau
>                     |     |     +-- H
>                     |     |           |-- chi
>                     |     |           |-- omega
>                     |     |           +-- psi
>                     |     +-- B2
>                     |           |-- lambda
>                     |           |-- E
>                     |           |     |-- alpha
>                     |           |     +-- beta
>                     |           +-- F
>                     +-- iota
> EXCEPTION: SVNTreeUnequal
> Traceback (most recent call last):
>   File
"/home/troy/working/subversion/subversion/tests/cmdline
/svntest/main.py", line 995, in run
>     rc = apply(self.pred.run, (), kw)
>   File
"/home/troy/working/subversion/subversion/tests/cmdline
/svntest/testcase.py", line 121, in run
>     return self.func(sandbox)
>   File "./merge_tests.py", line 9371, in
merge_with_relative_urls
>     wc_dir)
>   File
"/home/troy/working/subversion/subversion/tests/cmdline
/svntest/actions.py", line 824, in
run_and_verify_commit
>     run_and_verify_status(wc_dir_name, status_tree)
>   File
"/home/troy/working/subversion/subversion/tests/cmdline
/svntest/actions.py", line 852, in
run_and_verify_status
>     singleton_handler_b, b_baton)
>   File
"/home/troy/working/subversion/subversion/tests/cmdline
/svntest/tree.py", line 515, in compare_trees
>     singleton_handler_b, b_baton)
>   File
"/home/troy/working/subversion/subversion/tests/cmdline
/svntest/tree.py", line 515, in compare_trees
>     singleton_handler_b, b_baton)
>   File
"/home/troy/working/subversion/subversion/tests/cmdline
/svntest/tree.py", line 515, in compare_trees
>     singleton_handler_b, b_baton)
>   File
"/home/troy/working/subversion/subversion/tests/cmdline
/svntest/tree.py", line 515, in compare_trees
>     singleton_handler_b, b_baton)
>   File
"/home/troy/working/subversion/subversion/tests/cmdline
/svntest/tree.py", line 517, in compare_trees
>     singleton_handler_a(a_child, a_baton)
>   File
"/home/troy/working/subversion/subversion/tests/cmdline
/svntest/tree.py", line 415, in
default_singleton_handler_a
>     raise SVNTreeUnequal
> SVNTreeUnequal
> FAIL:  merge_tests.py 75: merge with relative urls

> # Merge with relative urls
> def merge_with_relative_urls(sbox):
>      "merge with relative urls"
> 
>      sbox.build()
>      wc_dir = sbox.wc_dir
>      repo_url = sbox.repo_url
> 
>      # Rev 2 copy B to B2
>      B_path  = os.path.join(wc_dir, 'A', 'B')
>      lambda_path = os.path.join(wc_dir, 'A', 'B',
'lambda')
>      B2_path = os.path.join(wc_dir, 'A', 'B2')
>      B_url   = repo_url + '/A/B'
> 
>      svntest.actions.run_and_verify_svn(None, None,
[],
>                                         'copy', B_path,
B2_path)
> 
>      expected_output = wc.State(wc_dir, {
>        'A/B2'       : Item(verb='Adding'),
>        })
>      expected_status =
svntest.actions.get_virginal_state(wc_dir, 1)
>      expected_status.add({
>        'A/B2'         : Item(status='  ', wc_rev=2),
>        'A/B2/E'       : Item(status='  ', wc_rev=2),
>        'A/B2/E/alpha' : Item(status='  ', wc_rev=2),
>        'A/B2/E/beta'  : Item(status='  ', wc_rev=2),
>        'A/B2/F'       : Item(status='  ', wc_rev=2),
>        'A/B2/lambda'  : Item(status='  ', wc_rev=2),
>        })
>      svntest.actions.run_and_verify_commit(wc_dir,
>                                          
expected_output,
>                                          
expected_status,
>                                           None,
>                                           None, None,
>                                           None, None,
>                                           wc_dir)
> 
>      svntest.actions.run_and_verify_svn(None, None,
[],
>                                         'up', wc_dir)
>      # Rev 3 modify A/B/lambda
>      lambda_text = fill_file_with_lines(lambda_path,
2)
>      svntest.main.file_append(lambda_path,
lambda_text)
>      
>      expected_output = wc.State(wc_dir, {
>          'A/B/lambda'   : Item(verb='Sending'),
>          })
>      expected_status =
svntest.actions.get_virginal_state(wc_dir, 2)
>      expected_status.add({
>          'A/B/lambda'   : Item(status='  ', wc_rev=3),
>          })
> 
>      svntest.actions.run_and_verify_commit(wc_dir,
>                                          
expected_output,
>                                          
expected_status,
>                                           None,
>                                           None, None,
>                                           None, None,
>                                           wc_dir)
> 
>      svntest.actions.run_and_verify_svn(None, None,
[],
>                                         'up', wc_dir)
>      # Now do the merge with relative url
>      expected_output = wc.State(wc_dir, {
>          'A/B2/lambda'  : Item(status='U ', wc_rev=3),
>          })
> 
>      expected_disk = svntest.main.greek_state.copy()
>      expected_disk.tweak('A/B2/lambda',
>                         
contents=expected_disk.desc['A/B2/lambda'].contents
>                          + lambda_text)
> 
>      expected_status =
svntest.actions.get_virginal_state(wc_dir, 3)
>      expected_status.add({
>          'A/B2/lambda'   : Item(status='M ',
wc_rev=3),
>          })
> 
>      expected_skip = wc.State('', { })
> 
>      #saved_cwd = os.getcwd()
> 
>      #os.chdir(B2_path)
>      svntest.actions.run_and_verify_merge(B2_path, '2',
'3', '^/A/B',
>                                          
expected_output,
>                                          
expected_disk,
>                                          
expected_status,
>                                          
expected_skip, 
>                                           None, None,
None,
>                                           None, None, #
no B singleton handler
>                                           False, #
Don't check props
>                                           False) # Not
a dry run
>      #os.chdir(saved_cwd)
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )