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

Re: [PATCH] run_and_verify_svnrdump

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Sat, 24 Jul 2010 20:06:59 +0300

Ramkumar Ramachandra wrote on Sat, Jul 24, 2010 at 22:28:12 +0530:
> Hi,
>
> Thanks to Daniel for suggesting this.
>
> -- Ram
>
> [[[
> * subversion/tests/cmdline/svntest/actions.py
> (run_and_verify_svnrdump): Add new function to run svnrdump with
> '-q', verify that stderr is empty, and return the output on stdout.
> * subversion/tests/cmdline/svnrdump_tests.py
> (run_test, basic_svnrdump): Factor out run_svnrdump in favor of
> run_and_verify_svnrdump.
>
> Suggested by: danielsh
> ]]]
>
> Index: subversion/tests/cmdline/svntest/actions.py
> ===================================================================
> --- subversion/tests/cmdline/svntest/actions.py (revision 978817)
> +++ subversion/tests/cmdline/svntest/actions.py (working copy)
> @@ -284,6 +284,14 @@ def run_and_verify_dump(repo_dir):
> return output
>
>
> +def run_and_verify_svnrdump(repo_dir):
> + "Runs 'svnadmin dump' and reports any errors, returning the dump content."
> + exit_code, output, errput = main.run_svnrdump('-q', repo_dir)
> + verify.verify_outputs("Missing expected output(s)", output, errput,
> + verify.AnyOutput, None)

Do you want "None" or "[]" for the expected_stderr argument?

Do you intentionally not check exit_code?

(In run_and_verify_svn(), 'None' is "don't care" and '[]' is "zero lines".)

> + return output
> +
> +
> def load_repo(sbox, dumpfile_path = None, dump_str = None):
> "Loads the dumpfile into sbox"
> if not dump_str:
> Index: subversion/tests/cmdline/svnrdump_tests.py
> ===================================================================
> --- subversion/tests/cmdline/svnrdump_tests.py (revision 978852)
> +++ subversion/tests/cmdline/svnrdump_tests.py (working copy)
> @@ -73,16 +73,8 @@ def run_test(sbox, dumpfile_name):
> 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('-q', sbox.repo_url)
> + svnrdump_dumpfile = svntest.actions.run_and_verify_svnrdump(sbox.repo_url)
>
> - # Check error code
> - if (r != 0):
> - raise svntest.Failure('Result code not 0')
> -
> - # Check the output from stderr
> - if err:
> - raise SVNUnexpectedStderr(err)
> -
> # Compare the output from stdout
> svntest.verify.compare_and_display_lines(
> "Dump files", "DUMP", svnadmin_dumpfile, svnrdump_dumpfile)
> @@ -94,11 +86,8 @@ def basic_svnrdump(sbox):
> "dump the standard sbox repos"
> sbox.build(read_only = True, create_wc = False)
>
> - r, out, err = svntest.main.run_svnrdump(sbox.repo_url)
> + out = svntest.actions.run_and_verify_svnrdump(sbox.repo_url)
>
> - if (r != 0):
> - raise svntest.Failure('Result code not 0')
> -
> if not out[0].startswith('SVN-fs-dump-format-version:'):
> raise svntest.Failure('No valid output')
>
Received on 2010-07-24 19:08:41 CEST

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