Author: brane
Date: Tue Jan 27 19:28:03 2015
New Revision: 1655118
URL: http://svn.apache.org/r1655118
Log:
On the dump-load-cross-check branch: Fix almost all the test failures
in svnsync_authz_tests.py when using dump/load check via svnserve.
* subversion/tests/cmdline/svntest/main.py
(write_authz_file): Add an optional parameter that is a set of
authz rules where paths already contain the repository prefix.
* subversion/tests/cmdline/svnsync_authz_tests.py
(basic_authz,
copy_from_unreadable_dir,
copy_with_mod_from_unreadable_dir,
copy_with_mod_from_unreadable_dir_and_copy,
specific_deny_authz,
copy_delete_unreadable_child): Use the new capability of
write_authz_file to create the authz files for these
tests instead of hand-crafting them.
Modified:
subversion/branches/dump-load-cross-check/subversion/tests/cmdline/svnsync_authz_tests.py
subversion/branches/dump-load-cross-check/subversion/tests/cmdline/svntest/main.py
Modified:
subversion/branches/dump-load-cross-check/subversion/tests/cmdline/svnsync_authz_tests.py
URL:
http://svn.apache.org/viewvc/subversion/branches/dump-load-cross-check/subversion/tests/cmdline/svnsync_authz_tests.py?rev=1655118&r1=1655117&r2=1655118&view=diff
==============================================================================
---
subversion/branches/dump-load-cross-check/subversion/tests/cmdline/svnsync_authz_tests.py
(original)
+++
subversion/branches/dump-load-cross-check/subversion/tests/cmdline/svnsync_authz_tests.py
Tue Jan 27 19:28:03 2015
@@ -37,6 +37,7 @@ import svntest
from svntest.verify import SVNUnexpectedStdout, SVNUnexpectedStderr
from svntest.verify import SVNExpectedStderr
from svntest.main import write_restrictive_svnserve_conf
+from svntest.main import write_authz_file
from svntest.main import server_has_partial_replay
# Shared helpers
@@ -67,16 +68,14 @@ def basic_authz(sbox):
run_init(dest_sbox.repo_url, sbox.repo_url)
- args = tuple(s.authz_name() for s in [sbox, sbox, dest_sbox])
- svntest.main.file_write(sbox.authz_file,
- "[%s:/]\n"
- "* = r\n"
- "\n"
- "[%s:/A/B]\n"
- "* = \n"
- "\n"
- "[%s:/]\n"
- "* = rw\n" % args)
+ src_authz = sbox.authz_name()
+ dst_authz = dest_sbox.authz_name()
+ write_authz_file(sbox, None,
+ prefixed_rules = {
+ src_authz + ':/': '* = r',
+ src_authz + ':/A/B': '* =',
+ dst_authz + ':/': '* = rw',
+ })
run_sync(dest_sbox.repo_url)
@@ -145,17 +144,14 @@ def copy_from_unreadable_dir(sbox):
svntest.actions.enable_revprop_changes(dest_sbox.repo_dir)
- args = tuple(s.authz_name() for s in [sbox, sbox, dest_sbox])
- open(sbox.authz_file, 'w').write(
- "[%s:/]\n"
- "* = r\n"
- "\n"
- "[%s:/A/B]\n"
- "* = \n"
- "\n"
- "[%s:/]\n"
- "* = rw"
- % args)
+ src_authz = sbox.authz_name()
+ dst_authz = dest_sbox.authz_name()
+ write_authz_file(sbox, None,
+ prefixed_rules = {
+ src_authz + ':/': '* = r',
+ src_authz + ':/A/B': '* =',
+ dst_authz + ':/': '* = rw',
+ })
run_init(dest_sbox.repo_url, sbox.repo_url)
@@ -259,17 +255,14 @@ def copy_with_mod_from_unreadable_dir(sb
svntest.actions.enable_revprop_changes(dest_sbox.repo_dir)
- args = tuple(s.authz_name() for s in [sbox, sbox, dest_sbox])
- open(sbox.authz_file, 'w').write(
- "[%s:/]\n"
- "* = r\n"
- "\n"
- "[%s:/A/B]\n"
- "* = \n"
- "\n"
- "[%s:/]\n"
- "* = rw"
- % args)
+ src_authz = sbox.authz_name()
+ dst_authz = dest_sbox.authz_name()
+ write_authz_file(sbox, None,
+ prefixed_rules = {
+ src_authz + ':/': '* = r',
+ src_authz + ':/A/B': '* =',
+ dst_authz + ':/': '* = rw',
+ })
run_init(dest_sbox.repo_url, sbox.repo_url)
@@ -351,17 +344,14 @@ def copy_with_mod_from_unreadable_dir_an
svntest.actions.enable_revprop_changes(dest_sbox.repo_dir)
- args = tuple(s.authz_name() for s in [sbox, sbox, dest_sbox])
- open(sbox.authz_file, 'w').write(
- "[%s:/]\n"
- "* = r\n"
- "\n"
- "[%s:/A/B]\n"
- "* = \n"
- "\n"
- "[%s:/]\n"
- "* = rw"
- % args)
+ src_authz = sbox.authz_name()
+ dst_authz = dest_sbox.authz_name()
+ write_authz_file(sbox, None,
+ prefixed_rules = {
+ src_authz + ':/': '* = r',
+ src_authz + ':/A/B': '* =',
+ dst_authz + ':/': '* = rw',
+ })
run_init(dest_sbox.repo_url, sbox.repo_url)
@@ -443,31 +433,24 @@ def specific_deny_authz(sbox):
# For mod_dav_svn's parent path setup we need per-repos permissions in
# the authz file...
if sbox.repo_url.startswith('http'):
- args = tuple(s.authz_name() for s in [sbox, sbox, sbox, dest_sbox])
- svntest.main.file_write(sbox.authz_file,
- "[%s:/]\n"
- "* = r\n"
- "\n"
- "[%s:/A]\n"
- "* = \n"
- "\n"
- "[%s:/A_COPY/B/lambda]\n"
- "* = \n"
- "\n"
- "[%s:/]\n"
- "* = rw\n" % args)
+ src_authz = sbox.authz_name()
+ dst_authz = dest_sbox.authz_name()
+ write_authz_file(sbox, None,
+ prefixed_rules = {
+ src_authz + ':/': '* = r',
+ src_authz + ':/A': '* =',
+ src_authz + ':/A_COPY/B/lambda': '* =',
+ dst_authz + ':/': '* = rw',
+ })
# Otherwise we can just go with the permissions needed for the source
# repository.
else:
- svntest.main.file_write(sbox.authz_file,
- "[/]\n"
- "* = r\n"
- "\n"
- "[/A]\n"
- "* = \n"
- "\n"
- "[/A_COPY/B/lambda]\n"
- "* = \n")
+ write_authz_file(sbox, None,
+ prefixed_rules = {
+ '/': '* = r',
+ '/A': '* =',
+ '/A_COPY/B/lambda': '* =',
+ })
run_sync(dest_sbox.repo_url)
@@ -498,14 +481,13 @@ def copy_delete_unreadable_child(sbox):
svntest.actions.enable_revprop_changes(dest_sbox.repo_dir)
# Lock down the source.
- authz = sbox.authz_name()
write_restrictive_svnserve_conf(sbox.repo_dir, anon_access='read')
- svntest.main.file_write(sbox.authz_file,
- "[%s:/]\n"
- "* = r\n"
- "[%s:/A]\n"
- "* = \n"
- % (authz, authz))
+ src_authz = sbox.authz_name()
+ write_authz_file(sbox, None,
+ prefixed_rules = {
+ src_authz + ':/': '* = r',
+ src_authz + ':/A': '* =',
+ })
dest_url = svntest.main.file_scheme_prefix \
+ urllib.pathname2url(os.path.abspath(dest_sbox.repo_dir))
Modified:
subversion/branches/dump-load-cross-check/subversion/tests/cmdline/svntest/main.py
URL:
http://svn.apache.org/viewvc/subversion/branches/dump-load-cross-check/subversion/tests/cmdline/svntest/main.py?rev=1655118&r1=1655117&r2=1655118&view=diff
==============================================================================
---
subversion/branches/dump-load-cross-check/subversion/tests/cmdline/svntest/main.py
(original)
+++
subversion/branches/dump-load-cross-check/subversion/tests/cmdline/svntest/main.py
Tue Jan 27 19:28:03 2015
@@ -1221,7 +1221,7 @@ def write_restrictive_svnserve_conf_with
# parallel execution at the bottom like so
# if __name__ == '__main__':
# svntest.main.run_tests(test_list, serial_only = True)
-def write_authz_file(sbox, rules, sections=None):
+def write_authz_file(sbox, rules, sections=None, prefixed_rules=None):
"""Write an authz file to SBOX, appropriate for the RA method used,
with authorizations rules RULES mapping paths to strings containing
the rules. You can add sections SECTIONS (ex. groups, aliases...) with
@@ -1237,22 +1237,29 @@ an appropriate list of mappings.
repo_name = os.path.basename(repo_name)
if sbox.repo_url.startswith("http"):
- prefix = repo_name + ":"
+ default_prefix = repo_name + ":"
else:
- prefix = ""
+ default_prefix = ""
if sections:
for p, r in sections.items():
fp.write("[%s]\n%s\n" % (p, r))
- for p, r in rules.items():
- fp.write("[%s%s]\n%s\n" % (prefix, p, r))
+ if not prefixed_rules:
+ prefixed_rules = dict()
+
+ if rules:
+ for p, r in rules.items():
+ prefixed_rules[default_prefix + p] = r
+
+ for p, r in prefixed_rules.items():
+ fp.write("[%s]\n%s\n" % (p, r))
if tests_verify_dump_load_cross_check():
# Insert an ACE that lets the dump/load cross-check bypass
# authz restrictions.
fp.write(crosscheck_username + " = rw\n")
- if tests_verify_dump_load_cross_check() and '/' not in rules:
+ if tests_verify_dump_load_cross_check() and '/' not in prefixed_rules:
# We need a repository-root ACE for the dump/load cross-check
fp.write("[/]\n" + crosscheck_username + " = rw\n")