Arwin Arni <ar...@collab.net> writes:

> Index: subversion/tests/cmdline/svnsync_tests.py
> ===================================================================
> --- subversion/tests/cmdline/svnsync_tests.py (revision 1099373)
> +++ subversion/tests/cmdline/svnsync_tests.py (working copy)
> @@ -155,7 +155,8 @@
>  
>  
>  def setup_and_sync(sbox, dump_file_contents, subdir=None,
> -                   bypass_prop_validation=False, source_prop_encoding=None):
> +                   bypass_prop_validation=False, source_prop_encoding=None,
> +                   is_src_ra_local=None, is_dest_ra_local=None):
>    """Create a repository for SBOX, load it with DUMP_FILE_CONTENTS, then 
> create a mirror repository and sync it with SBOX.  Return the mirror 
> sandbox."""
>  
>    # Create the empty master repository.
> @@ -179,13 +180,20 @@
>    svntest.actions.enable_revprop_changes(dest_sbox.repo_dir)
>  
>    repo_url = sbox.repo_url
> +  cwd = os.getcwd()
> +  if is_src_ra_local:
> +    repo_url = "file://" + os.path.join(cwd, sbox.repo_dir)
> +

I suspect that might not work on Windows, look at file_scheme_prefix in
svntest/main.py and pathname2url.  It would be better to somehow access
the main.py code (via sandbox.py?).

>    if subdir:
>      repo_url = repo_url + subdir
> -  run_init(dest_sbox.repo_url, repo_url, source_prop_encoding)
>  
> -  run_sync(dest_sbox.repo_url, repo_url,
> +  dest_repo_url = dest_sbox.repo_url
> +  if is_dest_ra_local:
> +    dest_repo_url = "file://" + os.path.join(cwd, dest_sbox.repo_dir)
> +  run_init(dest_repo_url, repo_url, source_prop_encoding)
> +  run_sync(dest_repo_url, repo_url,
>             source_prop_encoding=source_prop_encoding)
> -  run_copy_revprops(dest_sbox.repo_url, repo_url,
> +  run_copy_revprops(dest_repo_url, repo_url,
>                      source_prop_encoding=source_prop_encoding)
>  
>    return dest_sbox
> @@ -208,7 +216,9 @@
>      "Dump files", "DUMP", exp_dump_file_contents, dest_dump)
>  
>  def run_test(sbox, dump_file_name, subdir=None, exp_dump_file_name=None,
> -             bypass_prop_validation=False, source_prop_encoding=None):
> +             bypass_prop_validation=False, source_prop_encoding=None,
> +             is_src_ra_local=None, is_dest_ra_local=None):
> +
>    """Load a dump file, sync repositories, and compare contents with the 
> original
>  or another dump file."""
>  
> @@ -222,7 +232,8 @@
>                                    'rb').readlines()
>  
>    dest_sbox = setup_and_sync(sbox, master_dumpfile_contents, subdir,
> -                             bypass_prop_validation, source_prop_encoding)
> +                             bypass_prop_validation, source_prop_encoding,
> +                             is_src_ra_local, is_dest_ra_local)
>  
>    # Compare the dump produced by the mirror repository with either the 
> original
>    # dump file (used to create the master repository) or another specified 
> dump
> @@ -932,6 +943,14 @@
>    # Does the result look as we expected?
>    verify_mirror(dest_sbox, expected_contents)
>  
> +@Issue(3870)
> +@SkipUnless(svntest.main.is_posix_os)
> +@XFail()
> +def fd_leak_sync_from_serf_to_local(sbox):
> +  "FD leak during sync over serf to local"

No leading capital in the description.

> +  import resource
> +  resource.setrlimit(resource.RLIMIT_NOFILE, (128, 128))
> +  run_test(sbox, "largemods.dump", is_src_ra_local=None, 
> is_dest_ra_local=True)
>  ########################################################################
>  # Run the tests
>  
> @@ -971,6 +990,7 @@
>                commit_a_copy_of_root,
>                descend_into_replace,
>                delete_revprops,
> +              fd_leak_sync_from_serf_to_local,
>               ]
>  serial_only = True
>  
>
> * subversion/tests/cmdline/svnsync_tests.py
>   (setup_and_sync): Modified to accept two bools is_src_ra_local and 
>                     is_dest_ra_local. If True, the init, sync and 
>                     copy_revprops will use the ra_local URLs.

The "If True ..." bit should be in the code.

>   (run_test):       Percolate is_src_ra_local and is_dest_ra_local.
>                     Fix call of setup_and_sync.
>
>   (fd_leak_sync_from_serf_to_local): New test for Issue 3870.
>
> Patch by: Arwin Arni <arwin{_AT_}collab.net>
>   

-- 
Philip

Reply via email to