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

Re: [PATCH] input_validation_tests.py: Reduce overhead of multiple checkouts.

From: Noorul Islam K M <noorul_at_collab.net>
Date: Sun, 27 Feb 2011 10:32:02 +0530

Noorul Islam K M <noorul_at_collab.net> writes:

> Noorul Islam K M <noorul_at_collab.net> writes:
>
>> Lieven Govaerts <svnlgo_at_mobsol.be> writes:
>>
>>> On Mon, Feb 21, 2011 at 11:32 AM, Noorul Islam K M <noorul_at_collab.net>wrote:
>>>
>>>> Noorul Islam K M <noorul_at_collab.net> writes:
>>>>
>>>> > Stefan Sperling <stsp_at_elego.ed> writes:
>>>> >
>>>> >> On Mon, Feb 21, 2011 at 01:44:35PM +0530, Noorul Islam K M wrote:
>>>> >>
>>>> >>>
>>>> >>> This patch reduces checkout by around 23 times.
>>>> >>
>>>> >> On my system the difference is 43 seconds vs. 30 seconds.
>>>> >>
>>>> >> We lose the ability to easily spot which of the subtest is failing
>>>> >> if we do this. I.e. instead of:
>>>> >>
>>>> >> ...
>>>> >> PASS: input_validation_tests.py 19: non-working copy paths for 'status'
>>>> >> FAIL: input_validation_tests.py 20: non-working copy paths for 'patch'
>>>> >> PASS: input_validation_tests.py 21: non-working copy paths for 'switch'
>>>> >> ...
>>>> >>
>>>> >> all we'd get is:
>>>> >>
>>>> >> FAIL: input_validation_tests.py 1: inavlid wc and url targets
>>>> >>
>>>> >> Is there a way of keeping these as individual tests but also
>>>> >> avoiding the overhead of creating a repository and a working copy?
>>>> >> If there isn't I would prefer to just leave this as it is now because
>>>> >> I prefer the current output.
>>>> >
>>>> > I think it will be possible by keeping sandbox global. I will modify and
>>>> > send an updated patch.
>>>> >
>>>>
>>>> I looked into it. I don't think it is straight forward. I will leave it
>>>> as such. As you said 13 seconds gain is no big deal.
>>>>
>>>
>>> So the tests need one read-only working copy for the whole suite, instead of
>>> one per test right?
>>>
>>
>> Yes you are right.
>>
>>> What about this:
>>> - add optional setup_suite_func and destroy_suite_func parameters to
>>> svntest.main.run_tests.
>>> - in run_tests, before running the tests, call setup_suite_func. After
>>> running the tests, call destroy_suite_func.
>>> -> this is a standard feature of any unit test framework.
>>>
>>> - in your setup_suite_func callback, checkout a working copy
>>> - in your destroy_suite_func callback, rmtree the working copy
>>>
>>> - in all tests, when creating the sandbox, pass the create_wc = false
>>> option.
>>> - in run_and_verify_svn_in_wc, use the new single working copy.
>>>
>>> This doesn't guarantee the working copy stays unmodified, but since the
>>> actual actions on the wc are centralized in one function
>>> (run_and_verify_svn_in_wc) it's easy to see this from the code. You could
>>> run "svn status" at the end of each test if you really want to be sure.
>>>
>>
>> I will explore this and let you know.
>>
>
> Before start working on this I would like to know whether everyone is
> fine with this approach.
>
> Thanks and Regards
> Noorul

Since svntest.main.run_tests already run "svnadmin create" and "svn
import", in this particular case of input_validation_tests we don't need
to create wc. So I passed create_wc = False to sbox.build() and
everything works fine. So no overhead of repeated checkouts. Here is the
patch.

Log

[[[

Pass "create_wc = False" to sbox.build() in order reduce the overhead of
repeated checkouts.

* subversion/tests/cmdline/input_validation_tests.py
  (invalid_wcpath_add, invalid_wcpath_changelist,
   invalid_wcpath_cleanup, invalid_wcpath_commit, invalid_copy_sources,
   invalid_copy_target, invalid_delete_targets, invalid_diff_targets,
   invalid_export_targets, invalid_import_rags, invalid_log_targets,
   invalid_merge_rags, invalid_wcpath_upgrade, invalid_resolve_targets,
   invalid_resolved_targets, invalid_revert_targets,
   invalid_lock_targets, invalid_unlock_targets, invalid_status_targets,
   invalid_patch_targets, invalid_switch_targets,
   invalid_relocate_targets, invalid_mkdir_targets,
   invalid_update_targets): Pass "create_wc = False" to sbox.build()

Patch by: Noorul Islam K M <noorul{_AT_}collab.net>
]]]

Thanks and Regards
Noorul

Index: subversion/tests/cmdline/input_validation_tests.py
===================================================================
--- subversion/tests/cmdline/input_validation_tests.py (revision 1074971)
+++ subversion/tests/cmdline/input_validation_tests.py (working copy)
@@ -66,13 +66,13 @@
 
 def invalid_wcpath_add(sbox):
   "non-working copy paths for 'add'"
- sbox.build(read_only=True)
+ sbox.build(create_wc = False)
   for target in _invalid_wc_path_targets:
     run_and_verify_svn_in_wc(sbox, "svn:.*is not a local path", 'add', target)
 
 def invalid_wcpath_changelist(sbox):
   "non-working copy paths for 'changelist'"
- sbox.build(read_only=True)
+ sbox.build(create_wc = False)
   for target in _invalid_wc_path_targets:
     run_and_verify_svn_in_wc(sbox, "svn:.*is not a local path", 'changelist',
                              'foo', target)
@@ -81,28 +81,28 @@
 
 def invalid_wcpath_cleanup(sbox):
   "non-working copy paths for 'cleanup'"
- sbox.build(read_only=True)
+ sbox.build(create_wc = False)
   for target in _invalid_wc_path_targets:
     run_and_verify_svn_in_wc(sbox, "svn:.*is not a local path", 'cleanup',
                              target)
 
 def invalid_wcpath_commit(sbox):
   "non-working copy paths for 'commit'"
- sbox.build(read_only=True)
+ sbox.build(create_wc = False)
   for target in _invalid_wc_path_targets:
     run_and_verify_svn_in_wc(sbox, "svn: E205000: '.*' is a URL, but URLs cannot be " +
                              "commit targets", 'commit', target)
 
 def invalid_copy_sources(sbox):
   "invalid sources for 'copy'"
- sbox.build(read_only=True)
+ sbox.build(create_wc = False)
   for (src1, src2) in [("iota", "^/"), ("^/", "iota"), ("file://", "iota")]:
     run_and_verify_svn_in_wc(sbox, "svn: E200007: Cannot mix repository and working " +
                              "copy sources", 'copy', src1, src2, "A")
 
 def invalid_copy_target(sbox):
   "invalid target for 'copy'"
- sbox.build(read_only=True)
+ sbox.build(create_wc = False)
   mu_path = os.path.join('A', 'mu')
   C_path = os.path.join('A', 'C')
   run_and_verify_svn_in_wc(sbox, "svn: E155007: Path '.*' is not a directory",
@@ -110,14 +110,14 @@
 
 def invalid_delete_targets(sbox):
   "invalid targets for 'delete'"
- sbox.build(read_only=True)
+ sbox.build(create_wc = False)
   for (target1, target2) in [("iota", "^/"), ("file://", "iota")]:
     run_and_verify_svn_in_wc(sbox, "svn: E205000: Cannot mix repository and working "
                              "copy targets", 'delete', target1, target2)
 
 def invalid_diff_targets(sbox):
   "invalid targets for 'diff'"
- sbox.build(read_only=True)
+ sbox.build(create_wc = False)
   for (target1, target2) in [("iota", "^/"), ("file://", "iota")]:
     run_and_verify_svn_in_wc(sbox, "svn: E205000: Cannot mix repository and working "
                              "copy targets", 'diff', target1, target2)
@@ -127,7 +127,7 @@
 
 def invalid_export_targets(sbox):
   "invalid targets for 'export'"
- sbox.build(read_only=True)
+ sbox.build(create_wc = False)
   run_and_verify_svn_in_wc(sbox, "svn: (E000017|E720183): Can't create directory 'iota':.*",
                            'export', '.', 'iota')
   for target in ["^/", "file://"]:
@@ -136,7 +136,7 @@
 
 def invalid_import_args(sbox):
   "invalid arguments for 'import'"
- sbox.build(read_only=True)
+ sbox.build(create_wc = False)
   run_and_verify_svn_in_wc(sbox, "svn:.*is not a local path",
                            'import', '^/', '^/')
   run_and_verify_svn_in_wc(sbox, "svn:.*is not a local path",
@@ -146,7 +146,7 @@
 
 def invalid_log_targets(sbox):
   "invalid targets for 'log'"
- sbox.build(read_only=True)
+ sbox.build(create_wc = False)
   for (target1, target2) in [('^/', '/a/b/c'), ('^/', '^/'), ('^/', 'file://')]:
     run_and_verify_svn_in_wc(sbox, "svn: E205000: Only relative paths can be " +
                              "specified after a URL for 'svn log', but.*is " +
@@ -154,7 +154,7 @@
 
 def invalid_merge_args(sbox):
   "invalid arguments for 'merge'"
- sbox.build(read_only=True)
+ sbox.build(create_wc = False)
   run_and_verify_svn_in_wc(sbox, "svn: E195002: A working copy merge source needs "
                            "an explicit revision", 'merge', 'iota', '^/')
   for (src, target) in [('iota_at_HEAD', '^/'), ('iota_at_BASE', 'file://')]:
@@ -171,69 +171,69 @@
 
 def invalid_wcpath_upgrade(sbox):
   "non-working copy paths for 'upgrade'"
- sbox.build(read_only=True)
+ sbox.build(create_wc = False)
   for target in _invalid_wc_path_targets:
     run_and_verify_svn_in_wc(sbox, "svn:.*is not a local path", 'upgrade',
                              target, target)
 
 def invalid_resolve_targets(sbox):
   "non-working copy paths for 'resolve'"
- sbox.build(read_only=True)
+ sbox.build(create_wc = False)
   for target in _invalid_wc_path_targets:
     run_and_verify_svn_in_wc(sbox, "svn:.*is not a local path", 'resolve',
                              '--accept', 'base', target)
 
 def invalid_resolved_targets(sbox):
   "non-working copy paths for 'resolved'"
- sbox.build(read_only=True)
+ sbox.build(create_wc = False)
   for target in _invalid_wc_path_targets:
     run_and_verify_svn_in_wc(sbox, "svn:.*is not a local path", 'resolved',
                              target)
 
 def invalid_revert_targets(sbox):
   "non-working copy paths for 'revert'"
- sbox.build(read_only=True)
+ sbox.build(create_wc = False)
   for target in _invalid_wc_path_targets:
     run_and_verify_svn_in_wc(sbox, "svn:.*is not a local path", 'revert',
                              target)
 
 def invalid_lock_targets(sbox):
   "wc paths and repo URL target mixture for 'lock'"
- sbox.build(read_only=True)
+ sbox.build(create_wc = False)
   for (target1, target2) in [("iota", "^/"), ("file://", "iota")]:
     run_and_verify_svn_in_wc(sbox, "svn: E205000: Cannot mix repository and working "
                              "copy targets", 'lock', target1, target2)
 
 def invalid_unlock_targets(sbox):
   "wc paths and repo URL target mixture for 'unlock'"
- sbox.build(read_only=True)
+ sbox.build(create_wc = False)
   for (target1, target2) in [("iota", "^/"), ("file://", "iota")]:
     run_and_verify_svn_in_wc(sbox, "svn: E205000: Cannot mix repository and working "
                              "copy targets", 'unlock', target1, target2)
 
 def invalid_status_targets(sbox):
   "non-working copy paths for 'status'"
- sbox.build(read_only=True)
+ sbox.build(create_wc = False)
   for target in _invalid_wc_path_targets:
     run_and_verify_svn_in_wc(sbox, "svn:.*is not a local path", 'status',
                              target)
 
 def invalid_patch_targets(sbox):
   "non-working copy paths for 'patch'"
- sbox.build(read_only=True)
+ sbox.build(create_wc = False)
   for (target1, target2) in [("foo", "^/"), ("^/", "^/"), ("^/", "foo")]:
     run_and_verify_svn_in_wc(sbox, "svn:.*is not a local path", 'patch',
                              target1, target2)
 
 def invalid_switch_targets(sbox):
   "non-working copy paths for 'switch'"
- sbox.build(read_only=True)
+ sbox.build(create_wc = False)
   run_and_verify_svn_in_wc(sbox, "svn:.*is not a local path", 'switch',
                            "^/", "^/")
 
 def invalid_relocate_targets(sbox):
   "non-working copy paths for 'relocate'"
- sbox.build(read_only=True)
+ sbox.build(create_wc = False)
   run_and_verify_svn_in_wc(sbox, "svn:.*is not a local path", 'relocate',
                            "^/", "^/", "^/")
 
@@ -241,13 +241,13 @@
 # the same thing the other way around.
 def invalid_mkdir_targets(sbox):
   "invalid targets for 'mkdir'"
- sbox.build(read_only=True)
+ sbox.build(create_wc = False)
   run_and_verify_svn_in_wc(sbox, "svn: E205000: Cannot mix repository and working "
                            "copy targets", 'mkdir', "folder", "^/folder")
 
 def invalid_update_targets(sbox):
   "non-working copy paths for 'update'"
- sbox.build(read_only=True)
+ sbox.build(create_wc = False)
   run_and_verify_svn_in_wc(sbox, "svn:.*is not a local path", 'update',
                            "^/")
 
Received on 2011-02-27 06:02:50 CET

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.