You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2015/01/27 18:33:57 UTC
svn commit: r1655096 - in
/subversion/branches/dump-load-cross-check/subversion/tests/cmdline:
authz_tests.py svntest/main.py svntest/sandbox.py svntest/testcase.py
Author: brane
Date: Tue Jan 27 17:33:56 2015
New Revision: 1655096
URL: http://svn.apache.org/r1655096
Log:
On the dump-load-cross-check branch: Enable svnrdump to avoid authz
restrictions during the dump/load cross-check step.
* subversion/tests/cmdline/svntest/main.py
(crosscheck_username, crosscheck_password): Credentials for svnrdump.
(svnrdump_crosscheck_authentication): Magic class object used by _with_auth.
(_with_auth): If the magic class object is in the arg list, filter it
out and put the svnrdump credentials into the argument list.
(_post_create_repos): Add svnrdump credentials to svnserve's users authn file.
(write_authz_file): Add rules that allow the svnrdump cross-check user
full access to the repository regardless of otehr constraints in the
authz file.
* subversion/tests/cmdline/svntest/sandbox.py
(Sandbox.verify_repo): Add the magic class object to the
argument list for 'svnrdump dump'.
(Sandbox.verify): Add an option to skip the dump/load check
for individual test cases.
* subversion/tests/cmdline/svntest/testcase.py
(__all__): Add _SkipDumpLoadCrossCheck.
(FunctionTestCase): Add a flag that tels the test runner to skip
the dump/load check; propagate it to Sandbox.verify().
(_SkipDumpLoadCrossCheck): New predicate/decorator class.
(create_test_case): Propagate an option to skip the dump/load cross-check.
(SkipDumpLoadCrossCheck_deco): New decorator.
* subversion/tests/cmdline/authz_tests.py
(SkipDumpLoadCrossCheck): Import from svntest.testcase.
(broken_authz_file): Skip the dump/load check because the authz file
this test uses is broken on purpose.
Modified:
subversion/branches/dump-load-cross-check/subversion/tests/cmdline/authz_tests.py
subversion/branches/dump-load-cross-check/subversion/tests/cmdline/svntest/main.py
subversion/branches/dump-load-cross-check/subversion/tests/cmdline/svntest/sandbox.py
subversion/branches/dump-load-cross-check/subversion/tests/cmdline/svntest/testcase.py
Modified: subversion/branches/dump-load-cross-check/subversion/tests/cmdline/authz_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/dump-load-cross-check/subversion/tests/cmdline/authz_tests.py?rev=1655096&r1=1655095&r2=1655096&view=diff
==============================================================================
--- subversion/branches/dump-load-cross-check/subversion/tests/cmdline/authz_tests.py (original)
+++ subversion/branches/dump-load-cross-check/subversion/tests/cmdline/authz_tests.py Tue Jan 27 17:33:56 2015
@@ -45,6 +45,7 @@ XFail = svntest.testcase.XFail_deco
Issues = svntest.testcase.Issues_deco
Issue = svntest.testcase.Issue_deco
Wimp = svntest.testcase.Wimp_deco
+SkipDumpLoadCrossCheck = svntest.testcase.SkipDumpLoadCrossCheck_deco
######################################################################
# Tests
@@ -123,6 +124,7 @@ def authz_open_directory(sbox):
wc_dir)
@Skip(svntest.main.is_ra_type_file)
+@SkipDumpLoadCrossCheck()
def broken_authz_file(sbox):
"broken authz files cause errors"
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=1655096&r1=1655095&r2=1655096&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 17:33:56 2015
@@ -132,6 +132,10 @@ else:
wc_author = 'jrandom'
wc_passwd = 'rayjandom'
+# Username and password used by svnrdump in dump/load cross-checks
+crosscheck_username = '__dumpster__'
+crosscheck_password = '__loadster__'
+
# Username and password used by the working copies for "second user"
# scenarios
wc_author2 = 'jconstant' # use the same password as wc_author
@@ -693,14 +697,25 @@ def _with_config_dir(args):
else:
return args + ('--config-dir', default_config_dir)
+class svnrdump_crosscheck_authentication:
+ pass
+
def _with_auth(args):
assert '--password' not in args
- args = args + ('--password', wc_passwd,
+ if svnrdump_crosscheck_authentication in args:
+ args = filter(lambda x: x is not svnrdump_crosscheck_authentication, args)
+ auth_username = crosscheck_username
+ auth_password = crosscheck_password
+ else:
+ auth_username = wc_author
+ auth_password = wc_passwd
+
+ args = args + ('--password', auth_password,
'--no-auth-cache' )
if '--username' in args:
return args
else:
- return args + ('--username', wc_author )
+ return args + ('--username', auth_username )
# For running subversion and returning the output
def run_svn(error_expected, *varargs):
@@ -934,8 +949,13 @@ def _post_create_repos(path, minor_versi
# This actually creates TWO [users] sections in the file (one of them is
# uncommented in `svnadmin create`'s template), so we exercise the .ini
# files reading code's handling of duplicates, too. :-)
- file_append(os.path.join(path, "conf", "passwd"),
- "[users]\njrandom = rayjandom\njconstant = rayjandom\n");
+ users = ("[users]\n"
+ "jrandom = rayjandom\n"
+ "jconstant = rayjandom\n")
+ if tests_verify_dump_load_cross_check():
+ # Insert a user for the dump/load cross-check.
+ users += (crosscheck_username + " = " + crosscheck_password + "\n")
+ file_append(os.path.join(path, "conf", "passwd"), users)
if options.fs_type is None or options.fs_type == 'fsfs':
# fsfs.conf file
@@ -1220,12 +1240,22 @@ an appropriate list of mappings.
prefix = repo_name + ":"
else:
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 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:
+ # We need a repository-root ACE for the dump/load cross-check
+ fp.write("[/]\n" + crosscheck_username + " = rw\n")
+
fp.close()
# See the warning about parallel test execution in write_authz_file
Modified: subversion/branches/dump-load-cross-check/subversion/tests/cmdline/svntest/sandbox.py
URL: http://svn.apache.org/viewvc/subversion/branches/dump-load-cross-check/subversion/tests/cmdline/svntest/sandbox.py?rev=1655096&r1=1655095&r2=1655096&view=diff
==============================================================================
--- subversion/branches/dump-load-cross-check/subversion/tests/cmdline/svntest/sandbox.py (original)
+++ subversion/branches/dump-load-cross-check/subversion/tests/cmdline/svntest/sandbox.py Tue Jan 27 17:33:56 2015
@@ -400,8 +400,8 @@ class Sandbox:
dumpfile_a_d = svntest.actions.run_and_verify_dump(self.repo_dir,
deltas=True)
dumpfile_r_d = svntest.actions.run_and_verify_svnrdump(
- None, svntest.verify.AnyOutput, [], 0,
- 'dump', '-q', self.repo_url)
+ None, svntest.verify.AnyOutput, [], 0, 'dump', '-q', self.repo_url,
+ svntest.main.svnrdump_crosscheck_authentication)
# Compare the two deltas dumpfiles, ignoring expected differences
dumpfile_a_d_cmp = [l for l in dumpfile_a_d
@@ -468,11 +468,12 @@ class Sandbox:
expect_content_length_always=True,
ignore_empty_prop_sections=True)
- def verify(self):
+ def verify(self, skip_cross_check=False):
"""Do additional testing that should hold for any sandbox, such as
verifying that the repository can be dumped.
"""
- if svntest.main.tests_verify_dump_load_cross_check():
+ if (not skip_cross_check
+ and svntest.main.tests_verify_dump_load_cross_check()):
if self.is_built() and not self.read_only:
# verify that we can in fact dump the repo
# (except for the few tests that deliberately corrupt the repo)
Modified: subversion/branches/dump-load-cross-check/subversion/tests/cmdline/svntest/testcase.py
URL: http://svn.apache.org/viewvc/subversion/branches/dump-load-cross-check/subversion/tests/cmdline/svntest/testcase.py?rev=1655096&r1=1655095&r2=1655096&view=diff
==============================================================================
--- subversion/branches/dump-load-cross-check/subversion/tests/cmdline/svntest/testcase.py (original)
+++ subversion/branches/dump-load-cross-check/subversion/tests/cmdline/svntest/testcase.py Tue Jan 27 17:33:56 2015
@@ -28,7 +28,8 @@ import os, types, sys
import svntest
# if somebody does a "from testcase import *", they only get these names
-__all__ = ['_XFail', '_Wimp', '_Skip', '_SkipUnless']
+__all__ = ['_XFail', '_Wimp', '_Skip', '_SkipUnless',
+ '_SkipDumpLoadCrossCheck']
RESULT_OK = 'ok'
RESULT_FAIL = 'fail'
@@ -135,7 +136,7 @@ class FunctionTestCase(TestCase):
is derived from the file name in which FUNC was defined)
"""
- def __init__(self, func, issues=None):
+ def __init__(self, func, issues=None, skip_cross_check=False):
# it better be a function that accepts an sbox parameter and has a
# docstring on it.
assert isinstance(func, types.FunctionType)
@@ -161,6 +162,7 @@ class FunctionTestCase(TestCase):
TestCase.__init__(self, doc=doc, issues=issues)
self.func = func
+ self.skip_cross_check = skip_cross_check
def get_function_name(self):
return self.func.func_name
@@ -174,7 +176,7 @@ class FunctionTestCase(TestCase):
def run(self, sandbox):
result = self.func(sandbox)
- sandbox.verify()
+ sandbox.verify(skip_cross_check = self.skip_cross_check)
return result
@@ -263,11 +265,22 @@ class _SkipUnless(_Skip):
_Skip.__init__(self, test_case, lambda c=cond_func: not c())
-def create_test_case(func, issues=None):
+class _SkipDumpLoadCrossCheck(TestCase):
+ """A test that will skip the post-test dump/load cross-check."""
+
+ def __init__(self, test_case, cond_func=lambda: True, wip=None,
+ issues=None):
+ TestCase.__init__(self,
+ create_test_case(test_case, skip_cross_check=True),
+ cond_func, wip=wip, issues=issues)
+
+
+def create_test_case(func, issues=None, skip_cross_check=False):
if isinstance(func, TestCase):
return func
else:
- return FunctionTestCase(func, issues=issues)
+ return FunctionTestCase(func, issues=issues,
+ skip_cross_check=skip_cross_check)
# Various decorators to make declaring tests as such simpler
@@ -324,5 +337,15 @@ def Issues_deco(*issues):
return _second
+def SkipDumpLoadCrossCheck_deco(cond_func = lambda: True):
+ def _second(func):
+ if isinstance(func, TestCase):
+ return _SkipDumpLoadCrossCheck(func, cond_func, issues=func.issues)
+ else:
+ return _SkipDumpLoadCrossCheck(func, cond_func)
+
+ return _second
+
+
# Create a singular alias, for linguistic correctness
Issue_deco = Issues_deco