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

Re: [patch] Issue #601 - Regression tests for trans_tests.py

From: <kfogel_at_collab.net>
Date: 2005-02-15 17:11:31 CET

Madan U Sreenivasan <madan@collab.net> writes:
> Fix issue #601: Added regression test cases as described in trans_tests.py
> * subversion/tests/clients/cmdline/trans_tests.py
>
> Changed comments: Request for regression test changed to reflect
> completion of regression tests
>
> (propset_commit_otherwc_checkout): Added this funcion for
> propset, commit, checkout into another wc
>
> (propset_revert): Added this function for propset, revert

Thanks! This patch looks really good, just a few comments below.
I'll fix these up when I commit the patch, you don't need to repost.

> Index: subversion/tests/clients/cmdline/trans_tests.py
> ===================================================================
> --- subversion/tests/clients/cmdline/trans_tests.py (revision 13019)
> +++ subversion/tests/clients/cmdline/trans_tests.py (working copy)
> @@ -66,21 +66,24 @@
> #
> ####
>
> -########### THINGS THAT HAVE FAILED DURING HAND-TESTING ##############
> +######################## Regression Tests ##########################
> #
> -# These have all been fixed, but we want regression tests for them.
> +# Regression tests for the following cases have been completed.
> #
> # 1. Ben encountered this:
> # Create a greek tree, commit a keyword into one file,
> # then commit a keyword property (i.e., turn on keywords), then
> # try to check out head somewhere else. See seg fault.
> +# Test : propset_commit_checkout_nocrash()
> #
> # 2. Mike encountered this:
> # Add the keyword property to a file, svn revert the file, see
> # error.
> +# Test : propset_revert_noerror()
> #
> # 3. Another one from Ben:
> # Keywords not expanded on checkout.
> +# Test : keyword_expanded_on_checkout()
> #
> ######################################################################

We can just remove the entire comment; it serves no purpose now that
the new tests exist.

> @@ -652,7 +655,73 @@
> None, None, None, None, None,
> wc_dir)
>
> +#----------------------------------------------------------------------
> +# Create a greek tree, commit a keyword into one file,
> +# then commit a keyword property (i.e., turn on keywords), then
> +# try to check out head somewhere else.
> +# This should not cause seg fault
> +def propset_commit_checkout_nocrash(sbox):
> + "propset, commit, checkout into another wc"
> +
> + sbox.build()
> + wc_dir = sbox.wc_dir
> + mu_path = os.path.join(wc_dir, 'A', 'mu')
> +
> + # Set up A/mu to do $Rev$ keyword expansion
> + svntest.main.file_append (mu_path , "\n$Rev$")

I removed the space before that comma, not that it really matters.

> + svntest.actions.run_and_verify_svn(None, None, [],
> + 'propset', 'svn:keywords', 'Rev', mu_path)
> +
> + expected_output = wc.State(wc_dir, {
> + 'A/mu' : Item(verb='Sending'),
> + })
> + expected_status = svntest.actions.get_virginal_state(wc_dir, 2)
> + expected_status.tweak(wc_rev=1)
> + expected_status.tweak('A/mu', wc_rev=2)
> + svntest.actions.run_and_verify_commit (wc_dir,
> + expected_output, expected_status,
> + None, None, None, None, None,
> + wc_dir)

Strictly speaking, the recipe says to commit a keyword, *then* commit
the svn:keywords property. But here, you do both in one commit. I've
made it two separate commits, so we match the recipe more exactly.

> +
> + # Checkout into another wc dir
> + other_wc_dir = sbox.add_wc_path('other')
> + mu_other_path = os.path.join(other_wc_dir, 'A', 'mu')
>
> + try:
> + svntest.actions.run_and_verify_svn (None, None, None, 'checkout',
> + '--username', svntest.main.wc_author,
> + '--password', svntest.main.wc_passwd,
> + svntest.main.current_repo_url,
> + other_wc_dir)
> + except OSError:
> + return 0

Why the try/except? Why would an OSError be acceptable here?

> + # Check the contents of the file
> + svntest.actions.run_and_verify_svn (None, [ "This is the file 'mu'.\n",
> + "$Rev: 2 $" ], None,
> + 'cat', '-r', 'HEAD', mu_other_path)

Why use 'svn cat'? Just examine the working file directly, using
standard Python file-opening calls. No need to involve SVN.

> +#----------------------------------------------------------------------
> +# Add the keyword property to a file, svn revert the file
> +# This should not display any error message
> +def propset_revert_noerror(sbox):
> + "propset, revert"
> +
> + sbox.build()
> + wc_dir = sbox.wc_dir
> + mu_path = os.path.join(wc_dir, 'A', 'mu')
> +
> + # Set the Rev keyword for the mu file
> + # could use the keywords_on()/keywords_off() functions to
> + # set/del all svn:keywords
> + svntest.actions.run_and_verify_svn(None, None, [],
> + 'propset', 'svn:keywords', 'Rev', mu_path)
> +
> + # Revert the propset
> + svntest.actions.run_and_verify_svn(None, None, [], 'revert', mu_path)

Looks good to me.

> ########################################################################
> # Run the tests
>
> @@ -668,6 +737,8 @@
> keyword_expanded_on_checkout,
> cat_keyword_expansion,
> copy_propset_commit,
> + propset_commit_checkout_nocrash,
> + propset_revert_noerror,
> ]

Committed the patch in r13027.

Thanks!

-Karl

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Feb 15 17:26:49 2005

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.