You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Arwin Arni <ar...@collab.net> on 2011/05/04 18:22:31 UTC

[PATCH] Add a test for issue#3870

Hi All,

This patch adds a test to svnsync_tests.py, to showcase issue #3870:
(http://subversion.tigris.org/issues/show_bug.cgi?id=3870)
"File descriptor leaks during svnsync"

Regards,
Arwin Arni



Re: [PATCH] Add a test for issue#3870

Posted by Arwin Arni <ar...@collab.net>.
On Wednesday 04 May 2011 09:52 PM, Arwin Arni wrote:
> Hi All,
>
> This patch adds a test to svnsync_tests.py, to showcase issue #3870:
> (http://subversion.tigris.org/issues/show_bug.cgi?id=3870)
> "File descriptor leaks during svnsync"
>
> Regards,
> Arwin Arni
>
>
Sorry, forgot to attach file : largemods.dump to be added inside 
subversion/tests/cmdline/svnsync_tests_data

Re: [PATCH] Add a test for issue#3870

Posted by Philip Martin <ph...@wandisco.com>.
Arwin Arni <ar...@collab.net> writes:

> * subversion/tests/cmdline/svnsync_tests.py
>   (setup_and_sync): Modified to accept two bools 'is_src_ra_local' and 
>                     'is_dest_ra_local' to sync from or to local URLs.
>
>   (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>

Committed in revision 1099836, thanks!  Lets see if the buildbots
also XFAIL and PASS as expected.

-- 
Philip

Re: [PATCH] Add a test for issue#3870

Posted by Arwin Arni <ar...@collab.net>.
On Thursday 05 May 2011 03:07 PM, Philip Martin wrote:
> Arwin Arni<ar...@collab.net>  writes:
>
>> On Wednesday 04 May 2011 10:27 PM, Philip Martin wrote:
>>> 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?).
>>>
>> I did some tests and it does work on Windows as well.
> How many of the many forms of Windows path did you test?  I assume that
> the code uses file_scheme_prefix and pathname2url because some Windows
> paths require it.  I don't know Windows well enough to know what is
> important, so I'm not prepared to commit your alternative code.
>
Oh.. Okay..

I'm not all that familiar with windows either.. :-) I hope this 
following patch does what you said..

Regards,
Arwin Arni

Re: [PATCH] Add a test for issue#3870

Posted by Philip Martin <ph...@wandisco.com>.
Arwin Arni <ar...@collab.net> writes:

> On Wednesday 04 May 2011 10:27 PM, Philip Martin wrote:
>> 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?).
>>
>
> I did some tests and it does work on Windows as well.

How many of the many forms of Windows path did you test?  I assume that
the code uses file_scheme_prefix and pathname2url because some Windows
paths require it.  I don't know Windows well enough to know what is
important, so I'm not prepared to commit your alternative code.

-- 
Philip

Re: [PATCH] Add a test for issue#3870

Posted by Arwin Arni <ar...@collab.net>.
On Wednesday 04 May 2011 10:27 PM, Philip Martin wrote:
> 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?).
>

I did some tests and it does work on Windows as well.

I've made the other corrections.. Here's a modified patch.

The test XFails even in r1099706.

Thanks and Regards,
Arwin Arni

Re: [PATCH] Add a test for issue#3870

Posted by Philip Martin <ph...@wandisco.com>.
Philip Martin <ph...@wandisco.com> writes:

>> +@Issue(3870)
>> +@SkipUnless(svntest.main.is_posix_os)
>> +@XFail()

And that should be:
@XFail(svntest.main.is_ra_type_dav_serf)

>> +def fd_leak_sync_from_serf_to_local(sbox):
>> +  "FD leak during sync over serf to local"

-- 
Philip

Re: [PATCH] Add a test for issue#3870

Posted by Philip Martin <ph...@wandisco.com>.
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