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

Re: [PATCH] svnrdump: Unittest for revision 0

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Sat, 24 Jul 2010 12:54:02 +0300

Ramkumar Ramachandra wrote on Sat, Jul 24, 2010 at 14:59:07 +0530:
> Hi,
>
> Thanks to Stefan and Daniel, I now have a neat patch with a nice log
> message.
>

You could thank us by adding a "Review by" header in the log message. :-)

> +++ subversion/tests/cmdline/svnrdump_tests.py (working copy)
> @@ -41,6 +41,54 @@ XFail = svntest.testcase.XFail
> +def run_test(sbox, dumpfile_name):
> + """Load a dumpfile using svnadmin load, dump it with svnrdump and
> + check that the same dumpfile is produced"""
> +
> + # Create an empty sanbox repository
> + build_repos(sbox)
> +
> + # This directory contains all the dump files
> + svnsync_tests_dir = os.path.join(os.path.dirname(sys.argv[0]),
> + 'svnrdump_tests_data')
> +

Typo (already pointed out on IRC).

> + # Load the specified dump file into the repository
> + svnadmin_dumpfile = open(os.path.join(svnsync_tests_dir,
> + dumpfile_name),
> + 'rb').readlines()
> +
> + # Create the revprop-change hook for this test
> + svntest.actions.enable_revprop_changes(sbox.repo_dir)
> +

svnsync needs this, but I think here you can do without it?

> + # Load dumpfile_contents into the sbox repository
> + svntest.actions.run_and_verify_load(sbox.repo_dir, svnadmin_dumpfile)
> +
> + # Create a dump file using svnrdump
> + r, svnrdump_dumpfile, err = svntest.main.run_svnrdump(sbox.repo_url)
> +
> + # Check error code
> + if (r != 0):
> + raise svntest.Failure('Result code not 0')
> +

Please check stderr too.

> + # Compare the output
> + svntest.verify.compare_and_display_lines(
> + "Dump files", "DUMP", svnadmin_dumpfile, svnrdump_dumpfile)
> +

+1 to commit once the last three points are addressed.

> +######################################################################
> +# Tests
> +
> def basic_svnrdump(sbox):
> "dump the standard sbox repos"
> sbox.build(read_only = True, create_wc = False)
> @@ -53,6 +101,10 @@ def basic_svnrdump(sbox):
> if not out[0].startswith('SVN-fs-dump-format-version:'):
> raise svntest.Failure('No valid output')
>
> +def revision0(sbox):
> + "dump revision zero"
> + run_test(sbox, dumpfile_name = "revision0.dump")
> +
> ########################################################################
> # Run the tests
>
> @@ -60,6 +112,7 @@ def basic_svnrdump(sbox):
> # list all tests here, starting with None:
> test_list = [ None,
> basic_svnrdump,

Can you extend basic_svnrdump() to use run_test() too? (and verify a complete dump,
of both r0 and r1)

> + revision0,
> ]
>
> if __name__ == '__main__':
Received on 2010-07-24 11:55:41 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.