You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by vm...@apache.org on 2012/12/27 05:03:55 UTC
svn commit: r1426116 [13/16] - in /subversion/branches/javahl-ra: ./ build/
build/ac-macros/ build/generator/ build/win32/
contrib/server-side/svncutter/ notes/ subversion/bindings/cxxhl/
subversion/bindings/swig/ subversion/bindings/swig/perl/native/ ...
Modified: subversion/branches/javahl-ra/subversion/tests/cmdline/svnrdump_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/cmdline/svnrdump_tests.py?rev=1426116&r1=1426115&r2=1426116&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/cmdline/svnrdump_tests.py (original)
+++ subversion/branches/javahl-ra/subversion/tests/cmdline/svnrdump_tests.py Thu Dec 27 04:03:49 2012
@@ -94,11 +94,13 @@ def compare_repos_dumps(svnrdump_sbox, s
def run_dump_test(sbox, dumpfile_name, expected_dumpfile_name = None,
subdir = None, bypass_prop_validation = False,
- ignore_base_checksums = False):
+ ignore_base_checksums = False, extra_options = []):
+
"""Load a dumpfile using 'svnadmin load', dump it with 'svnrdump
dump' and check that the same dumpfile is produced or that
expected_dumpfile_name is produced if provided. Additionally, the
- subdir argument appends itself to the URL"""
+ subdir argument appends itself to the URL. EXTRA_OPTIONS is an
+ array of optional additional options to pass to 'svnrdump dump'."""
# Create an empty sandbox repository
build_repos(sbox)
@@ -121,10 +123,10 @@ def run_dump_test(sbox, dumpfile_name, e
repo_url = repo_url + subdir
# Create a dump file using svnrdump
+ opts = extra_options + ['-q', 'dump', repo_url]
svnrdump_dumpfile = \
svntest.actions.run_and_verify_svnrdump(None, svntest.verify.AnyOutput,
- [], 0, '-q', 'dump',
- repo_url)
+ [], 0, *opts)
if expected_dumpfile_name:
svnadmin_dumpfile = open(os.path.join(svnrdump_tests_dir,
@@ -197,7 +199,6 @@ def run_load_test(sbox, dumpfile_name, e
######################################################################
# Tests
-@Skip(svntest.main.is_ra_type_dav_serf)
def basic_dump(sbox):
"dump: standard sbox repos"
sbox.build(read_only = True, create_wc = False)
@@ -210,7 +211,6 @@ def basic_dump(sbox):
if not out[0].startswith('SVN-fs-dump-format-version:'):
raise svntest.Failure('No valid output')
-@Skip(svntest.main.is_ra_type_dav_serf)
def revision_0_dump(sbox):
"dump: revision zero"
run_dump_test(sbox, "revision-0.dump")
@@ -229,7 +229,6 @@ def revision_0_load(sbox):
# docs/ (Added r6)
# README (Added r6)
-@Skip(svntest.main.is_ra_type_dav_serf)
def skeleton_dump(sbox):
"dump: skeleton repository"
run_dump_test(sbox, "skeleton.dump")
@@ -238,7 +237,6 @@ def skeleton_load(sbox):
"load: skeleton repository"
run_load_test(sbox, "skeleton.dump")
-@Skip(svntest.main.is_ra_type_dav_serf)
def sparse_propchanges_dump(sbox):
"dump: sparse file/dir propchanges"
run_dump_test(sbox, "sparse-propchanges.dump")
@@ -248,7 +246,6 @@ def sparse_propchanges_load(sbox):
"load: sparse file/dir propchanges"
run_load_test(sbox, "sparse-propchanges.dump")
-@Skip(svntest.main.is_ra_type_dav_serf)
def copy_and_modify_dump(sbox):
"dump: copy and modify"
run_dump_test(sbox, "copy-and-modify.dump")
@@ -257,7 +254,6 @@ def copy_and_modify_load(sbox):
"load: copy and modify"
run_load_test(sbox, "copy-and-modify.dump")
-@Skip(svntest.main.is_ra_type_dav_serf)
def no_author_dump(sbox):
"dump: copy revs with no svn:author revprops"
run_dump_test(sbox, "no-author.dump")
@@ -266,7 +262,6 @@ def no_author_load(sbox):
"load: copy revs with no svn:author revprops"
run_load_test(sbox, "no-author.dump")
-@Skip(svntest.main.is_ra_type_dav_serf)
def copy_from_previous_version_and_modify_dump(sbox):
"dump: copy from previous version and modify"
run_dump_test(sbox, "copy-from-previous-version-and-modify.dump")
@@ -275,7 +270,6 @@ def copy_from_previous_version_and_modif
"load: copy from previous version and modify"
run_load_test(sbox, "copy-from-previous-version-and-modify.dump")
-@Skip(svntest.main.is_ra_type_dav_serf)
def modified_in_place_dump(sbox):
"dump: modified in place"
run_dump_test(sbox, "modified-in-place.dump")
@@ -284,7 +278,6 @@ def modified_in_place_load(sbox):
"load: modified in place"
run_load_test(sbox, "modified-in-place.dump")
-@Skip(svntest.main.is_ra_type_dav_serf)
def move_and_modify_in_the_same_revision_dump(sbox):
"dump: move parent & modify child file in same rev"
run_dump_test(sbox, "move-and-modify.dump")
@@ -293,7 +286,6 @@ def move_and_modify_in_the_same_revision
"load: move parent & modify child file in same rev"
run_load_test(sbox, "move-and-modify.dump")
-@Skip(svntest.main.is_ra_type_dav_serf)
def tag_empty_trunk_dump(sbox):
"dump: tag empty trunk"
run_dump_test(sbox, "tag-empty-trunk.dump")
@@ -302,7 +294,6 @@ def tag_empty_trunk_load(sbox):
"load: tag empty trunk"
run_load_test(sbox, "tag-empty-trunk.dump")
-@Skip(svntest.main.is_ra_type_dav_serf)
def tag_trunk_with_file_dump(sbox):
"dump: tag trunk containing a file"
run_dump_test(sbox, "tag-trunk-with-file.dump")
@@ -311,7 +302,6 @@ def tag_trunk_with_file_load(sbox):
"load: tag trunk containing a file"
run_load_test(sbox, "tag-trunk-with-file.dump")
-@Skip(svntest.main.is_ra_type_dav_serf)
def tag_trunk_with_file2_dump(sbox):
"dump: tag trunk containing a file (#2)"
run_dump_test(sbox, "tag-trunk-with-file2.dump")
@@ -320,7 +310,6 @@ def tag_trunk_with_file2_load(sbox):
"load: tag trunk containing a file (#2)"
run_load_test(sbox, "tag-trunk-with-file2.dump")
-@Skip(svntest.main.is_ra_type_dav_serf)
def dir_prop_change_dump(sbox):
"dump: directory property changes"
run_dump_test(sbox, "dir-prop-change.dump")
@@ -329,7 +318,6 @@ def dir_prop_change_load(sbox):
"load: directory property changes"
run_load_test(sbox, "dir-prop-change.dump")
-@Skip(svntest.main.is_ra_type_dav_serf)
def copy_parent_modify_prop_dump(sbox):
"dump: copy parent and modify prop"
run_dump_test(sbox, "copy-parent-modify-prop.dump")
@@ -338,7 +326,6 @@ def copy_parent_modify_prop_load(sbox):
"load: copy parent and modify prop"
run_load_test(sbox, "copy-parent-modify-prop.dump")
-@Skip(svntest.main.is_ra_type_dav_serf)
def copy_revprops_dump(sbox):
"dump: copy revprops other than svn:*"
run_dump_test(sbox, "revprops.dump")
@@ -347,19 +334,16 @@ def copy_revprops_load(sbox):
"load: copy revprops other than svn:*"
run_load_test(sbox, "revprops.dump")
-@Skip(svntest.main.is_ra_type_dav_serf)
def only_trunk_dump(sbox):
"dump: subdirectory"
run_dump_test(sbox, "trunk-only.dump", subdir="/trunk",
- expected_dumpfile_name="trunk-only.expected.dump",)
+ expected_dumpfile_name="trunk-only.expected.dump")
-@Skip(svntest.main.is_ra_type_dav_serf)
def only_trunk_A_with_changes_dump(sbox):
"dump: subdirectory with changes on root"
run_dump_test(sbox, "trunk-A-changes.dump", subdir="/trunk/A",
expected_dumpfile_name="trunk-A-changes.expected.dump")
-@Skip(svntest.main.is_ra_type_dav_serf)
def url_encoding_dump(sbox):
"dump: url encoding issues"
run_dump_test(sbox, "url-encoding-bug.dump")
@@ -368,21 +352,25 @@ def url_encoding_load(sbox):
"load: url encoding issues"
run_load_test(sbox, "url-encoding-bug.dump")
-@Skip(svntest.main.is_ra_type_dav_serf)
def copy_bad_line_endings_dump(sbox):
"dump: inconsistent line endings in svn:* props"
run_dump_test(sbox, "copy-bad-line-endings.dump",
expected_dumpfile_name="copy-bad-line-endings.expected.dump",
bypass_prop_validation=True)
-@Skip(svntest.main.is_ra_type_dav_serf)
+@XFail()
+@Issue(4263)
+def copy_bad_line_endings_load(sbox):
+ "load: inconsistent line endings in svn:* props"
+ run_load_test(sbox, "copy-bad-line-endings.dump",
+ expected_dumpfile_name="copy-bad-line-endings.expected.dump")
+
def copy_bad_line_endings2_dump(sbox):
"dump: non-LF line endings in svn:* props"
run_dump_test(sbox, "copy-bad-line-endings2.dump",
expected_dumpfile_name="copy-bad-line-endings2.expected.dump",
bypass_prop_validation=True, ignore_base_checksums=True)
-@Skip(svntest.main.is_ra_type_dav_serf)
def commit_a_copy_of_root_dump(sbox):
"dump: commit a copy of root"
run_dump_test(sbox, "repo-with-copy-of-root-dir.dump")
@@ -391,7 +379,6 @@ def commit_a_copy_of_root_load(sbox):
"load: commit a copy of root"
run_load_test(sbox, "repo-with-copy-of-root-dir.dump")
-@Skip(svntest.main.is_ra_type_dav_serf)
def descend_into_replace_dump(sbox):
"dump: descending into replaced dir looks in src"
run_dump_test(sbox, "descend-into-replace.dump", subdir='/trunk/H',
@@ -402,7 +389,6 @@ def descend_into_replace_load(sbox):
run_load_test(sbox, "descend-into-replace.dump")
@Issue(3847)
-@Skip(svntest.main.is_ra_type_dav_serf)
def add_multi_prop_dump(sbox):
"dump: add with multiple props"
run_dump_test(sbox, "add-multi-prop.dump")
@@ -417,7 +403,6 @@ def multi_prop_edit_load(sbox):
# revs in svn:mergeinfo' but uses 'svnrdump load' in place of
# 'svnadmin load'.
@Issue(3890)
-@Skip(svntest.main.is_ra_type_dav_serf)
def reflect_dropped_renumbered_revs(sbox):
"svnrdump renumbers dropped revs in mergeinfo"
@@ -481,7 +466,6 @@ def reflect_dropped_renumbered_revs(sbox
# from incremental dump' but uses 'svnrdump [dump|load]' in place of
# 'svnadmin [dump|load]'.
@Issue(3890)
-@Skip(svntest.main.is_ra_type_dav_serf)
def dont_drop_valid_mergeinfo_during_incremental_svnrdump_loads(sbox):
"don't drop mergeinfo revs in incremental svnrdump"
@@ -756,7 +740,34 @@ def svnrdump_load_partial_incremental_du
svntest.verify.AnyOutput,
[], 0, 'load', sbox.repo_url)
- ########################################################################
+
+#----------------------------------------------------------------------
+@Issue(4101)
+def range_dump(sbox):
+ "dump: using -rX:Y"
+ run_dump_test(sbox, "trunk-only.dump",
+ expected_dumpfile_name="root-range.expected.dump",
+ extra_options=['-r2:HEAD'])
+
+@Issue(4101)
+def only_trunk_range_dump(sbox):
+ "dump: subdirectory using -rX:Y"
+ run_dump_test(sbox, "trunk-only.dump", subdir="/trunk",
+ expected_dumpfile_name="trunk-only-range.expected.dump",
+ extra_options=['-r1:HEAD'])
+
+@Issue(4101)
+def only_trunk_A_range_dump(sbox):
+ "dump: deeper subdirectory using -rX:Y"
+ run_dump_test(sbox, "trunk-only.dump", subdir="/trunk/A",
+ expected_dumpfile_name="trunk-A-range.expected.dump",
+ extra_options=['-r2:HEAD'])
+
+
+#----------------------------------------------------------------------
+
+
+########################################################################
# Run the tests
@@ -796,6 +807,7 @@ test_list = [ None,
move_and_modify_in_the_same_revision_dump,
move_and_modify_in_the_same_revision_load,
copy_bad_line_endings_dump,
+ copy_bad_line_endings_load,
copy_bad_line_endings2_dump,
commit_a_copy_of_root_dump,
commit_a_copy_of_root_load,
@@ -806,6 +818,9 @@ test_list = [ None,
reflect_dropped_renumbered_revs,
dont_drop_valid_mergeinfo_during_incremental_svnrdump_loads,
svnrdump_load_partial_incremental_dump,
+ range_dump,
+ only_trunk_range_dump,
+ only_trunk_A_range_dump,
]
if __name__ == '__main__':
Modified: subversion/branches/javahl-ra/subversion/tests/cmdline/svnserveautocheck.sh
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/cmdline/svnserveautocheck.sh?rev=1426116&r1=1426115&r2=1426116&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/cmdline/svnserveautocheck.sh (original)
+++ subversion/branches/javahl-ra/subversion/tests/cmdline/svnserveautocheck.sh Thu Dec 27 04:03:49 2012
@@ -21,16 +21,16 @@
#
# -*- mode: shell-script; -*-
-# This script simplifies the preparation of the environment for a Subversion client
-# communicating with an svnserve server.
+# This script simplifies the preparation of the environment for a Subversion
+# client communicating with an svnserve server.
#
-# The script runs svnserve, runs "make check", and kills the svnserve afterwards.
-# It makes sure to kill the svnserve even if the test run dies.
+# The script runs svnserve, runs "make check", and kills the svnserve
+# afterwards. It makes sure to kill the svnserve even if the test run dies.
#
# This script should be run from the top level of the Subversion
-# distribution; it's easiest to just run it as "make
-# svnserveautocheck". Like "make check", you can specify further options
-# like "make svnserveautocheck FS_TYPE=bdb TESTS=subversion/tests/cmdline/basic.py".
+# distribution; it's easiest to just run it as "make svnserveautocheck".
+# Like "make check", you can specify further options like
+# "make svnserveautocheck FS_TYPE=bdb TESTS=subversion/tests/cmdline/basic.py".
PYTHON=${PYTHON:-python}
@@ -80,8 +80,6 @@ fi
# for it and "make check-clean".
SVNSERVE_PID=$ABS_BUILDDIR/subversion/tests/svnserveautocheck.pid
-export LD_LIBRARY_PATH="$ABS_BUILDDIR/subversion/libsvn_ra_neon/.libs:$ABS_BUILDDIR/subversion/libsvn_ra_local/.libs:$ABS_BUILDDIR/subversion/libsvn_ra_svn/.libs:$LD_LIBRARY_PATH"
-
SERVER_CMD="$ABS_BUILDDIR/subversion/svnserve/svnserve"
rm -f $SVNSERVE_PID
@@ -94,6 +92,12 @@ random_port() {
fi
}
+if type time > /dev/null; then
+ TIME_CMD=time
+else
+ TIME_CMD=""
+fi
+
SVNSERVE_PORT=$(random_port)
while netstat -an | grep $SVNSERVE_PORT | grep 'LISTEN'; do
SVNSERVE_PORT=$(random_port)
@@ -115,13 +119,13 @@ fi
BASE_URL=svn://127.0.0.1:$SVNSERVE_PORT
if [ $# = 0 ]; then
- time make check "BASE_URL=$BASE_URL"
+ $TIME_CMD make check "BASE_URL=$BASE_URL"
r=$?
else
cd "$ABS_BUILDDIR/subversion/tests/cmdline/"
TEST="$1"
shift
- time "./${TEST}_tests.py" "--url=$BASE_URL" $*
+ $TIME_CMD "./${TEST}_tests.py" "--url=$BASE_URL" $*
r=$?
cd - > /dev/null
fi
Modified: subversion/branches/javahl-ra/subversion/tests/cmdline/svntest/actions.py
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/cmdline/svntest/actions.py?rev=1426116&r1=1426115&r2=1426116&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/cmdline/svntest/actions.py (original)
+++ subversion/branches/javahl-ra/subversion/tests/cmdline/svntest/actions.py Thu Dec 27 04:03:49 2012
@@ -1918,7 +1918,11 @@ def get_wc_base_rev(wc_dir):
def hook_failure_message(hook_name):
"""Return the error message that the client prints for failure of the
specified hook HOOK_NAME. The wording changed with Subversion 1.5."""
- if svntest.main.options.server_minor_version < 5:
+
+ # Output depends on the server version, not the repository version.
+ # This gets the wrong result for modern servers with old format
+ # repositories.
+ if svntest.main.options.server_minor_version < 5 and not svntest.main.is_ra_type_file():
return "'%s' hook failed with error output:\n" % hook_name
else:
if hook_name in ["start-commit", "pre-commit"]:
@@ -1985,8 +1989,12 @@ def create_failing_post_commit_hook(repo
# set_prop can be used for properties with NULL characters which are not
# handled correctly when passed to subprocess.Popen() and values like "*"
# which are not handled correctly on Windows.
-def set_prop(name, value, path, expected_re_string=None):
+def set_prop(name, value, path, expected_re_string=None, force=None):
"""Set a property with specified value"""
+ if not force:
+ propset = ('propset',)
+ else:
+ propset = ('propset', '--force')
if value and (value[0] == '-' or '\x00' in value or sys.platform == 'win32'):
from tempfile import mkstemp
(fd, value_file_path) = mkstemp()
@@ -1995,12 +2003,12 @@ def set_prop(name, value, path, expected
value_file.write(value)
value_file.flush()
value_file.close()
- exit_code, out, err = main.run_svn(expected_re_string, 'propset',
- '-F', value_file_path, name, path)
+ propset += ('-F', value_file_path, name, path)
+ exit_code, out, err = main.run_svn(expected_re_string, *propset)
os.remove(value_file_path)
else:
- exit_code, out, err = main.run_svn(expected_re_string, 'propset',
- name, value, path)
+ propset += (name, value, path)
+ exit_code, out, err = main.run_svn(expected_re_string, *propset)
if expected_re_string:
if not expected_re_string.startswith(".*"):
expected_re_string = ".*(" + expected_re_string + ")"
Modified: subversion/branches/javahl-ra/subversion/tests/cmdline/svntest/factory.py
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/cmdline/svntest/factory.py?rev=1426116&r1=1426115&r2=1426116&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/cmdline/svntest/factory.py (original)
+++ subversion/branches/javahl-ra/subversion/tests/cmdline/svntest/factory.py Thu Dec 27 04:03:49 2012
@@ -310,6 +310,7 @@ class TestFactory:
# Wether we ever used the variables 'wc_dir' and 'url' (tiny tweak)
self.used_wc_dir = False
+ self.used_abs_wc_dir = False
self.used_url = False
# The alternate working copy directories created that need to be
@@ -350,6 +351,8 @@ class TestFactory:
# main wc_dir and url
if self.used_wc_dir:
init += 'wc_dir = sbox.wc_dir\n'
+ if self.used_abs_wc_dir:
+ init += 'abs_wc_dir = os.path.abspath(sbox.wc_dir)\n'
if self.used_url:
init += 'url = sbox.repo_url\n'
@@ -447,9 +450,14 @@ class TestFactory:
return self.cmd_svn_checkout(args[2:])
if second in ['propset','pset','ps']:
- return self.cmd_svn(args[1:], False,
+ multiline_args = [arg.replace(r'\n', '\n') for arg in args[1:]]
+ return self.cmd_svn(multiline_args, False,
self.keep_args_of, 3)
+ if second in ['propget','pget','pg']:
+ return self.cmd_svn(args[1:], False,
+ self.keep_args_of, 2)
+
if second in ['delete','del','remove', 'rm']:
return self.cmd_svn(args[1:], False,
self.keep_args_of + ['--with-revprop'])
@@ -1115,7 +1123,7 @@ class TestFactory:
if not runpath:
continue
strlen = len(runpath)
- item = [strlen, name, runpath]
+ item = (strlen, name, runpath)
bisect.insort(lst, item)
return lst
@@ -1128,14 +1136,14 @@ class TestFactory:
urls = []
for name in self.vars:
if name.startswith('url_'):
- bisect.insort(urls, [name.lower(), name])
+ bisect.insort(urls, (name.lower(), name))
else:
- bisect.insort(paths, [name.lower(), name])
+ bisect.insort(paths, (name.lower(), name))
list = []
for path in paths:
- list += [path[1]]
+ list.append(path[1])
for url in urls:
- list += [url[1]]
+ list.append(url[1])
return list
@@ -1168,8 +1176,20 @@ class TestFactory:
path = var[2]
str = replace(str, path, name, quote)
- str = replace(str, self.sbox.wc_dir, 'wc_dir', quote)
- str = replace(str, self.sbox.repo_url, 'url', quote)
+ str2 = replace(str, os.path.abspath(self.sbox.wc_dir), 'abs_wc_dir', quote)
+ if str != str2:
+ self.used_abs_wc_dir = True
+ str = str2
+
+ str2 = replace(str, self.sbox.wc_dir, 'wc_dir', quote)
+ if str != str2:
+ self.used_wc_dir = True
+ str = str2
+
+ str2 = replace(str, self.sbox.repo_url, 'url', quote)
+ if str != str2:
+ self.used_url = True
+ str = str2
# now remove trailing null-str adds:
# '' + url_A_C + ''
@@ -1615,6 +1635,7 @@ class TestFactory:
# special case: if a path is '.', simply use wc_dir.
if pathelements == ['.']:
+ self.used_wc_dir = True
return wc.py, wc.realpath
name = "_".join(pathelements)
Modified: subversion/branches/javahl-ra/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/cmdline/svntest/main.py?rev=1426116&r1=1426115&r2=1426116&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/branches/javahl-ra/subversion/tests/cmdline/svntest/main.py Thu Dec 27 04:03:49 2012
@@ -542,7 +542,7 @@ def run_command_stdin(command, error_exp
stderr_lines
def create_config_dir(cfgdir, config_contents=None, server_contents=None,
- ssl_cert=None, ssl_url=None):
+ ssl_cert=None, ssl_url=None, http_proxy=None):
"Create config directories and files"
# config file names
@@ -569,13 +569,19 @@ interactive-conflicts = false
http_library_str = ""
if options.http_library:
http_library_str = "http-library=%s" % (options.http_library)
+ http_proxy_str = ""
+ if options.http_proxy:
+ http_proxy_parsed = urlparse("//" + options.http_proxy)
+ http_proxy_str = "http-proxy-host=%s\n" % (http_proxy_parsed.hostname) + \
+ "http-proxy-port=%d" % (http_proxy_parsed.port or 80)
server_contents = """
#
[global]
%s
+%s
store-plaintext-passwords=yes
store-passwords=yes
-""" % (http_library_str)
+""" % (http_library_str, http_proxy_str)
file_write(cfgfile_cfg, config_contents)
file_write(cfgfile_srv, server_contents)
@@ -1228,6 +1234,17 @@ def server_enforces_date_syntax():
def server_has_atomic_revprop():
return options.server_minor_version >= 7
+def is_plaintext_password_storage_disabled():
+ try:
+ predicate = re.compile("^[^W]*WARNING: Plaintext password storage is enabled!")
+ code, out, err = run_svn(False, "--version")
+ for line in out:
+ if predicate.match(line):
+ return False
+ except:
+ return False
+ return True
+
######################################################################
@@ -1283,6 +1300,8 @@ class TestSpawningThread(threading.Threa
args.append('--milestone-filter=' + options.milestone_filter)
if options.ssl_cert:
args.append('--ssl-cert=' + options.ssl_cert)
+ if options.http_proxy:
+ args.append('--http-proxy=' + options.http_proxy)
result, stdout_lines, stderr_lines = spawn_process(command, 0, 0, None,
*args)
@@ -1636,6 +1655,8 @@ def _create_parser():
help='Source directory.')
parser.add_option('--ssl-cert', action='store',
help='Path to SSL server certificate.')
+ parser.add_option('--http-proxy', action='store',
+ help='Use the HTTP Proxy at hostname:port.')
# most of the defaults are None, but some are other values, set them here
parser.set_defaults(
@@ -1949,7 +1970,8 @@ def execute_tests(test_list, serial_only
# Build out the default configuration directory
create_config_dir(default_config_dir,
ssl_cert=options.ssl_cert,
- ssl_url=options.test_area_url)
+ ssl_url=options.test_area_url,
+ http_proxy=options.http_proxy)
# Setup the pristine repository
svntest.actions.setup_pristine_greek_repository()
Modified: subversion/branches/javahl-ra/subversion/tests/cmdline/switch_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/cmdline/switch_tests.py?rev=1426116&r1=1426115&r2=1426116&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/cmdline/switch_tests.py (original)
+++ subversion/branches/javahl-ra/subversion/tests/cmdline/switch_tests.py Thu Dec 27 04:03:49 2012
@@ -586,6 +586,11 @@ def file_dir_file(sbox):
if not os.path.isdir(file_path):
raise svntest.Failure
+ # The reason the following switch currently fails is that the node
+ # is determined to be a 'root', because it is switched against its parent.
+ # In this specific case the switch editor is designed to be rooted on the node
+ # itself instead of its ancestor. If you would use sbox.ospath('A') for
+ # file_path the switch works both ways.
svntest.actions.run_and_verify_svn(None, None, [], 'switch',
'--ignore-ancestry', file_url, file_path)
if not os.path.isfile(file_path):
@@ -2219,8 +2224,9 @@ def switch_to_root(sbox):
#----------------------------------------------------------------------
# Make sure that switch continue after deleting locally modified
-# directories, as it update and merge do.
+# directories, as update and merge do.
+@Issue(2505)
def tolerate_local_mods(sbox):
"tolerate deletion of a directory with local mods"
Modified: subversion/branches/javahl-ra/subversion/tests/cmdline/update_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/cmdline/update_tests.py?rev=1426116&r1=1426115&r2=1426116&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/cmdline/update_tests.py (original)
+++ subversion/branches/javahl-ra/subversion/tests/cmdline/update_tests.py Thu Dec 27 04:03:49 2012
@@ -5523,6 +5523,16 @@ def update_to_HEAD_plus_1(sbox):
None, None,
None, None, None, wc_dir, '-r', '2')
+ other_wc = sbox.add_wc_path('other')
+ other_url = sbox.repo_url + '/A'
+ svntest.actions.run_and_verify_svn("subtree checkout", None, [],
+ 'co', other_url, other_wc)
+ svntest.actions.run_and_verify_update(other_wc,
+ None, None, None,
+ "E160006.*No such.*revision",
+ None, None,
+ None, None, None, other_wc, '-r', '2')
+
@XFail()
def update_moved_dir_leaf_del(sbox):
"update locally moved dir with leaf del"
Modified: subversion/branches/javahl-ra/subversion/tests/libsvn_client/client-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/libsvn_client/client-test.c?rev=1426116&r1=1426115&r2=1426116&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/libsvn_client/client-test.c (original)
+++ subversion/branches/javahl-ra/subversion/tests/libsvn_client/client-test.c Thu Dec 27 04:03:49 2012
@@ -721,88 +721,6 @@ test_youngest_common_ancestor(const svn_
return SVN_NO_ERROR;
}
-static svn_error_t *
-test_externals_parse(const svn_test_opts_t *opts, apr_pool_t *pool)
-{
- int i;
- struct external_info
- {
- const char *line;
- const char *url;
- const char *local_path;
- svn_revnum_t peg_rev;
- svn_revnum_t rev;
-
- } items[] = {
- {
- "dir http://server/svn/a",
- "http://server/svn/a",
- "dir"
- },
- {
- "/svn/home dir",
- "u://svr/svn/home",
- "dir"
- },
- {
- "//server/home dir",
- "u://server/home",
- "dir"
- },
- {
- "../../../../home dir",
- "u://svr/svn/home",
- "dir",
- },
- {
- "^/../repB/tools/scripts scripts",
- "u://svr/svn/cur/repB/tools/scripts",
- "scripts"
- },
- {
- "^/../repB/tools/README.txt scripts/README.txt",
- "u://svr/svn/cur/repB/tools/README.txt",
- "scripts/README.txt"
- },
- };
-
-
- for (i = 0; i < sizeof(items) / sizeof(items[0]); i++)
- {
- apr_array_header_t *results;
- svn_wc_external_item2_t *external_item;
- const char *resolved_url;
- SVN_ERR(svn_wc_parse_externals_description3(&results, "/my/current/dir",
- items[i].line, FALSE, pool));
-
- SVN_TEST_ASSERT(results && results->nelts == 1);
-
- external_item = APR_ARRAY_IDX(results, 0, svn_wc_external_item2_t *);
-
- SVN_ERR(svn_wc__resolve_relative_external_url(&resolved_url,
- external_item,
- "u://svr/svn/cur/dir",
- "u://svr/svn/cur/dir/sd/fl",
- pool, pool));
-
- SVN_TEST_STRING_ASSERT(resolved_url, items[i].url);
- SVN_TEST_STRING_ASSERT(external_item->target_dir, items[i].local_path);
-
- if (items[i].peg_rev != 0)
- SVN_TEST_ASSERT(external_item->peg_revision.value.number
- == items[i].peg_rev);
- if (items[i].rev != 0)
- SVN_TEST_ASSERT(external_item->revision.value.number == items[i].rev);
- SVN_TEST_ASSERT(svn_uri_is_canonical(resolved_url, pool));
- }
-
-
- return SVN_NO_ERROR;
-
-}
-
-
-
/* ========================================================================== */
@@ -820,6 +738,5 @@ struct svn_test_descriptor_t test_funcs[
SVN_TEST_OPTS_PASS(test_16k_add, "test adding 16k files"),
#endif
SVN_TEST_OPTS_PASS(test_youngest_common_ancestor, "test youngest_common_ancestor"),
- SVN_TEST_OPTS_PASS(test_externals_parse, "test svn_wc_parse_externals_description3"),
SVN_TEST_NULL
};
Modified: subversion/branches/javahl-ra/subversion/tests/libsvn_fs/fs-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/libsvn_fs/fs-test.c?rev=1426116&r1=1426115&r2=1426116&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/libsvn_fs/fs-test.c (original)
+++ subversion/branches/javahl-ra/subversion/tests/libsvn_fs/fs-test.c Thu Dec 27 04:03:49 2012
@@ -3533,7 +3533,8 @@ static int my_rand(apr_uint64_t scalar,
{
static const apr_uint32_t TEST_RAND_MAX = 0xffffffffUL;
/* Assumes TEST_RAND_MAX+1 can be exactly represented in a double */
- return (int)(((double)svn_test_rand(seed)
+ apr_uint32_t r = svn_test_rand(seed);
+ return (int)(((double)r
/ ((double)TEST_RAND_MAX+1.0))
* (double)scalar);
}
@@ -4895,6 +4896,36 @@ node_history(const svn_test_opts_t *opts
return SVN_NO_ERROR;
}
+/* Test svn_fs_delete_fs(). */
+static svn_error_t *
+delete_fs(const svn_test_opts_t *opts,
+ apr_pool_t *pool)
+{
+ const char *path;
+ svn_node_kind_t kind;
+
+ /* We have to use a subpool to close the svn_fs_t before calling
+ svn_fs_delete_fs. See issue 4264. */
+ {
+ svn_fs_t *fs;
+ apr_pool_t *subpool = svn_pool_create(pool);
+ SVN_ERR(svn_test__create_fs(&fs, "test-repo-delete-fs", opts, subpool));
+ path = svn_fs_path(fs, pool);
+ svn_pool_destroy(subpool);
+ }
+
+ SVN_ERR(svn_io_check_path(path, &kind, pool));
+ SVN_TEST_ASSERT(kind != svn_node_none);
+ SVN_ERR(svn_fs_delete_fs(path, pool));
+ SVN_ERR(svn_io_check_path(path, &kind, pool));
+ SVN_TEST_ASSERT(kind == svn_node_none);
+
+ /* Recreate dir so that test cleanup doesn't fail. */
+ SVN_ERR(svn_io_dir_make(path, APR_OS_DEFAULT, pool));
+
+ return SVN_NO_ERROR;
+}
+
/* ------------------------------------------------------------------------ */
@@ -4978,5 +5009,7 @@ struct svn_test_descriptor_t test_funcs[
"create and modify small file"),
SVN_TEST_OPTS_PASS(node_history,
"test svn_fs_node_history"),
+ SVN_TEST_OPTS_PASS(delete_fs,
+ "test svn_fs_delete_fs"),
SVN_TEST_NULL
};
Propchange: subversion/branches/javahl-ra/subversion/tests/libsvn_ra/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Dec 27 04:03:49 2012
@@ -0,0 +1,4 @@
+*.lo
+.libs
+ra-test
+test-repo-*
Modified: subversion/branches/javahl-ra/subversion/tests/libsvn_repos/repos-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/libsvn_repos/repos-test.c?rev=1426116&r1=1426115&r2=1426116&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/libsvn_repos/repos-test.c (original)
+++ subversion/branches/javahl-ra/subversion/tests/libsvn_repos/repos-test.c Thu Dec 27 04:03:49 2012
@@ -49,6 +49,20 @@
#define MIN(a,b) (((a)<(b))?(a):(b))
#endif
+/* Compare strings, like strcmp but either or both may be NULL which
+ * compares equal to NULL and not equal to any non-NULL string. */
+static int
+strcmp_null(const char *s1, const char *s2)
+{
+ if (s1 && s2)
+ return strcmp(s1, s2);
+ else if (s1 || s2)
+ return 1;
+ else
+ return 0;
+}
+
+
static svn_error_t *
dir_deltas(const svn_test_opts_t *opts,
@@ -1706,15 +1720,17 @@ commit_continue_txn(const svn_test_opts_
}
+
+/* A baton for check_location_segments(). */
struct nls_receiver_baton
{
int count;
- svn_location_segment_t *expected_segments;
+ const svn_location_segment_t *expected_segments;
};
-
+/* Return a pretty-printed string representing SEGMENT. */
static const char *
-format_segment(svn_location_segment_t *segment,
+format_segment(const svn_location_segment_t *segment,
apr_pool_t *pool)
{
return apr_psprintf(pool, "[r%ld-r%ld: /%s]",
@@ -1723,14 +1739,15 @@ format_segment(svn_location_segment_t *s
segment->path ? segment->path : "(null)");
}
-
+/* A location segment receiver for check_location_segments().
+ * Implements svn_location_segment_receiver_t. */
static svn_error_t *
nls_receiver(svn_location_segment_t *segment,
void *baton,
apr_pool_t *pool)
{
struct nls_receiver_baton *b = baton;
- svn_location_segment_t *expected_segment = b->expected_segments + b->count;
+ const svn_location_segment_t *expected_segment = b->expected_segments + b->count;
/* expected_segments->range_end can't be 0, so if we see that, it's
our end-of-the-list sentry. */
@@ -1739,7 +1756,9 @@ nls_receiver(svn_location_segment_t *seg
"Got unexpected location segment: %s",
format_segment(segment, pool));
- if (expected_segment->range_start != segment->range_start)
+ if (expected_segment->range_start != segment->range_start
+ || expected_segment->range_end != segment->range_end
+ || strcmp_null(expected_segment->path, segment->path) != 0)
return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
"Location segments differ\n"
" Expected location segment: %s\n"
@@ -1750,18 +1769,22 @@ nls_receiver(svn_location_segment_t *seg
return SVN_NO_ERROR;
}
-
+/* Run a svn_repos_node_location_segments() query with REPOS, PATH, PEG_REV,
+ * START_REV, END_REV. Check that the result exactly matches the list of
+ * segments EXPECTED_SEGMENTS, which is terminated by an entry with
+ * 'range_end'==0.
+ */
static svn_error_t *
check_location_segments(svn_repos_t *repos,
const char *path,
svn_revnum_t peg_rev,
svn_revnum_t start_rev,
svn_revnum_t end_rev,
- svn_location_segment_t *expected_segments,
+ const svn_location_segment_t *expected_segments,
apr_pool_t *pool)
{
struct nls_receiver_baton b;
- svn_location_segment_t *segment;
+ const svn_location_segment_t *segment;
/* Run svn_repos_node_location_segments() with a receiver that
validates against EXPECTED_SEGMENTS. */
@@ -1783,6 +1806,21 @@ check_location_segments(svn_repos_t *rep
return SVN_NO_ERROR;
}
+/* Inputs and expected outputs for svn_repos_node_location_segments() tests.
+ */
+typedef struct location_segment_test_t
+{
+ /* Path and peg revision to query */
+ const char *path;
+ svn_revnum_t peg;
+ /* Start (youngest) and end (oldest) revisions to query */
+ svn_revnum_t start;
+ svn_revnum_t end;
+
+ /* Expected segments */
+ svn_location_segment_t segments[10];
+
+} location_segment_test_t;
static svn_error_t *
node_location_segments(const svn_test_opts_t *opts,
@@ -1795,6 +1833,72 @@ node_location_segments(const svn_test_op
svn_fs_root_t *txn_root, *root;
svn_revnum_t youngest_rev = 0;
+ static const location_segment_test_t subtests[] =
+ {
+ { /* Check locations for /@HEAD. */
+ "", SVN_INVALID_REVNUM, SVN_INVALID_REVNUM, SVN_INVALID_REVNUM,
+ {
+ { 0, 7, "" },
+ { 0 }
+ }
+ },
+ { /* Check locations for A/D@HEAD. */
+ "A/D", SVN_INVALID_REVNUM, SVN_INVALID_REVNUM, SVN_INVALID_REVNUM,
+ {
+ { 7, 7, "A/D" },
+ { 3, 6, "A/D2" },
+ { 1, 2, "A/D" },
+ { 0 }
+ }
+ },
+ { /* Check a subset of the locations for A/D@HEAD. */
+ "A/D", SVN_INVALID_REVNUM, 5, 2,
+ {
+ { 3, 5, "A/D2" },
+ { 2, 2, "A/D" },
+ { 0 }
+ },
+ },
+ { /* Check a subset of locations for A/D2@5. */
+ "A/D2", 5, 3, 2,
+ {
+ { 3, 3, "A/D2" },
+ { 2, 2, "A/D" },
+ { 0 }
+ },
+ },
+ { /* Check locations for A/D@6. */
+ "A/D", 6, 6, SVN_INVALID_REVNUM,
+ {
+ { 1, 6, "A/D" },
+ { 0 }
+ },
+ },
+ { /* Check locations for A/D/G@HEAD. */
+ "A/D/G", SVN_INVALID_REVNUM, SVN_INVALID_REVNUM, SVN_INVALID_REVNUM,
+ {
+ { 7, 7, "A/D/G" },
+ { 6, 6, "A/D2/G" },
+ { 5, 5, NULL },
+ { 3, 4, "A/D2/G" },
+ { 1, 2, "A/D/G" },
+ { 0 }
+ },
+ },
+ { /* Check a subset of the locations for A/D/G@HEAD. */
+ "A/D/G", SVN_INVALID_REVNUM, 3, 2,
+ {
+ { 3, 3, "A/D2/G" },
+ { 2, 2, "A/D/G" },
+ { 0 }
+ },
+ },
+ {
+ NULL
+ },
+ };
+ const location_segment_test_t *subtest;
+
/* Bail (with success) on known-untestable scenarios */
if ((strcmp(opts->fs_type, "bdb") == 0)
&& (opts->server_minor_version == 4))
@@ -1868,117 +1972,19 @@ node_location_segments(const svn_test_op
SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(youngest_rev));
svn_pool_clear(subpool);
- /* Check locations for /@HEAD. */
- {
- svn_location_segment_t expected_segments[] =
- {
- { 0, 7, "" },
- { 0 }
- };
- SVN_ERR(check_location_segments(repos, "",
- SVN_INVALID_REVNUM,
- SVN_INVALID_REVNUM,
- SVN_INVALID_REVNUM,
- expected_segments, pool));
- }
-
- /* Check locations for A/D@HEAD. */
- {
- svn_location_segment_t expected_segments[] =
- {
- { 7, 7, "A/D" },
- { 3, 6, "A/D2" },
- { 1, 2, "A/D" },
- { 0 }
- };
- SVN_ERR(check_location_segments(repos, "A/D",
- SVN_INVALID_REVNUM,
- SVN_INVALID_REVNUM,
- SVN_INVALID_REVNUM,
- expected_segments, pool));
- }
-
- /* Check a subset of the locations for A/D@HEAD. */
- {
- svn_location_segment_t expected_segments[] =
- {
- { 3, 5, "A/D2" },
- { 2, 2, "A/D" },
- { 0 }
- };
- SVN_ERR(check_location_segments(repos, "A/D",
- SVN_INVALID_REVNUM,
- 5,
- 2,
- expected_segments, pool));
- }
-
- /* Check a subset of locations for A/D2@5. */
- {
- svn_location_segment_t expected_segments[] =
- {
- { 3, 3, "A/D2" },
- { 2, 2, "A/D" },
- { 0 }
- };
- SVN_ERR(check_location_segments(repos, "A/D2",
- 5,
- 3,
- 2,
- expected_segments, pool));
- }
-
- /* Check locations for A/D@6. */
- {
- svn_location_segment_t expected_segments[] =
- {
- { 1, 6, "A/D" },
- { 0 }
- };
- SVN_ERR(check_location_segments(repos, "A/D",
- 6,
- 6,
- SVN_INVALID_REVNUM,
- expected_segments, pool));
- }
-
- /* Check locations for A/D/G@HEAD. */
- {
- svn_location_segment_t expected_segments[] =
- {
- { 7, 7, "A/D/G" },
- { 6, 6, "A/D2/G" },
- { 5, 5, NULL },
- { 3, 4, "A/D2/G" },
- { 1, 2, "A/D2/G" },
- { 0 }
- };
- SVN_ERR(check_location_segments(repos, "A/D/G",
- SVN_INVALID_REVNUM,
- SVN_INVALID_REVNUM,
- SVN_INVALID_REVNUM,
- expected_segments, pool));
- }
-
- /* Check a subset of the locations for A/D/G@HEAD. */
- {
- svn_location_segment_t expected_segments[] =
- {
- { 3, 3, "A/D2/G" },
- { 2, 2, "A/D2/G" },
- { 0 }
- };
- SVN_ERR(check_location_segments(repos, "A/D/G",
- SVN_INVALID_REVNUM,
- 3,
- 2,
- expected_segments, pool));
- }
+ /* */
+ for (subtest = subtests; subtest->path; subtest++)
+ {
+ SVN_ERR(check_location_segments(repos, subtest->path, subtest->peg,
+ subtest->start, subtest->end,
+ subtest->segments, pool));
+ }
return SVN_NO_ERROR;
}
+
/* Test that the reporter doesn't send deltas under excluded paths. */
static svn_error_t *
reporter_depth_exclude(const svn_test_opts_t *opts,
Modified: subversion/branches/javahl-ra/subversion/tests/libsvn_subr/error-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/libsvn_subr/error-test.c?rev=1426116&r1=1426115&r2=1426116&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/libsvn_subr/error-test.c (original)
+++ subversion/branches/javahl-ra/subversion/tests/libsvn_subr/error-test.c Thu Dec 27 04:03:49 2012
@@ -125,8 +125,9 @@ test_error_purge_tracing(apr_pool_t *poo
svn_error_malfunction_handler_t orig_handler;
/* For this test, use a random error status. */
- err = svn_error_create(SVN_ERR_BAD_UUID, NULL, SVN_ERR__TRACED);
+ err = svn_error_create(SVN_ERR_BAD_UUID, NULL, "");
err = svn_error_trace(err);
+ err->child->message = err->message;
/* Register a malfunction handler that doesn't call abort() to
check that a new error chain with an assertion error is
Modified: subversion/branches/javahl-ra/subversion/tests/libsvn_subr/path-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/libsvn_subr/path-test.c?rev=1426116&r1=1426115&r2=1426116&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/libsvn_subr/path-test.c (original)
+++ subversion/branches/javahl-ra/subversion/tests/libsvn_subr/path-test.c Thu Dec 27 04:03:49 2012
@@ -21,6 +21,13 @@
* ====================================================================
*/
+#ifdef _MSC_VER
+#include <direct.h>
+#define getcwd _getcwd
+#else
+#include <unistd.h> /* for getcwd() */
+#endif
+
#include <stdio.h>
#include <string.h>
#include <apr_general.h>
@@ -1195,7 +1202,6 @@ test_path_splitext(apr_pool_t *pool)
const char *path;
const char *path_root;
const char *path_ext;
- svn_boolean_t result;
} tests[] = {
{ "no-ext", "no-ext", "" },
{ "test-file.py", "test-file.", "py" },
@@ -1465,6 +1471,160 @@ test_path_internal_style(apr_pool_t *poo
}
+/* The type of a function to be tested by condense_targets_tests_helper().
+ * Matches svn_path_condense_targets().
+ */
+typedef svn_error_t *(*condense_targets_func_t)
+ (const char **pcommon,
+ apr_array_header_t **pcondensed_targets,
+ const apr_array_header_t *targets,
+ svn_boolean_t remove_redundancies,
+ apr_pool_t *pool);
+
+/** Executes function CONDENSE_TARGETS twice - with and without requesting the
+ * condensed targets list - on TEST_TARGETS (comma sep. string) and compares
+ * the results with EXP_COMMON and EXP_TARGETS (comma sep. string).
+ *
+ * @note: a '%' character at the beginning of EXP_COMMON or EXP_TARGETS will
+ * be replaced by the current working directory.
+ *
+ * Returns an error if any of the comparisons fail.
+ */
+static svn_error_t *
+condense_targets_tests_helper(const char* title,
+ const char* test_targets,
+ const char* exp_common,
+ const char* exp_targets,
+ const char* func_name,
+ condense_targets_func_t condense_targets,
+ apr_pool_t *pool)
+{
+ apr_array_header_t *targets;
+ apr_array_header_t *condensed_targets;
+ const char *common_path, *common_path2, *curdir;
+ char *token, *iter;
+ const char *exp_common_abs = exp_common;
+ int i;
+ char buf[8192];
+
+ if (! getcwd(buf, sizeof(buf)))
+ return svn_error_create(SVN_ERR_BASE, NULL, "getcwd() failed");
+ curdir = svn_path_internal_style(buf, pool);
+
+ /* Create the target array */
+ targets = apr_array_make(pool, sizeof(test_targets), sizeof(const char *));
+ token = apr_strtok(apr_pstrdup(pool, test_targets), ",", &iter);
+ while (token)
+ {
+ APR_ARRAY_PUSH(targets, const char *) =
+ svn_path_internal_style(token, pool);
+ token = apr_strtok(NULL, ",", &iter);
+ };
+
+ /* Call the function */
+ SVN_ERR(condense_targets(&common_path, &condensed_targets, targets,
+ TRUE, pool));
+
+ /* Verify the common part with the expected (prefix with cwd). */
+ if (*exp_common == '%')
+ exp_common_abs = apr_pstrcat(pool, curdir, exp_common + 1, (char *)NULL);
+
+ if (strcmp(common_path, exp_common_abs) != 0)
+ {
+ return svn_error_createf
+ (SVN_ERR_TEST_FAILED, NULL,
+ "%s (test %s) returned %s instead of %s",
+ func_name, title,
+ common_path, exp_common_abs);
+ }
+
+ /* Verify the condensed targets */
+ token = apr_strtok(apr_pstrdup(pool, exp_targets), ",", &iter);
+ for (i = 0; i < condensed_targets->nelts; i++)
+ {
+ const char * target = APR_ARRAY_IDX(condensed_targets, i, const char*);
+ if (token && (*token == '%'))
+ token = apr_pstrcat(pool, curdir, token + 1, (char *)NULL);
+ if (! token ||
+ (target && (strcmp(target, token) != 0)))
+ {
+ return svn_error_createf
+ (SVN_ERR_TEST_FAILED, NULL,
+ "%s (test %s) couldn't find %s in expected targets list",
+ func_name, title,
+ target);
+ }
+ token = apr_strtok(NULL, ",", &iter);
+ }
+
+ /* Now ensure it works without the pbasename */
+ SVN_ERR(condense_targets(&common_path2, NULL, targets, TRUE, pool));
+
+ /* Verify the common part again */
+ if (strcmp(common_path, common_path2) != 0)
+ {
+ return svn_error_createf
+ (SVN_ERR_TEST_FAILED, NULL,
+ "%s (test %s): Common path without getting targets %s does not match" \
+ "common path with targets %s",
+ func_name, title,
+ common_path2, common_path);
+ }
+
+ return SVN_NO_ERROR;
+}
+
+
+static svn_error_t *
+test_path_condense_targets(apr_pool_t *pool)
+{
+ int i;
+ struct {
+ const char* title;
+ const char* targets;
+ const char* exp_common;
+ const char* exp_targets;
+ } tests[] = {
+ { "normal use", "z/A/B,z/A,z/A/C,z/D/E,z/D/F,z/D,z/G,z/G/H,z/G/I",
+ "%/z", "A,D,G" },
+ {"identical dirs", "z/A,z/A,z/A,z/A",
+ "%/z/A", "" },
+ {"identical files", "z/A/file,z/A/file,z/A/file,z/A/file",
+ "%/z/A/file", "" },
+ {"single dir", "z/A",
+ "%/z/A", "" },
+ {"single file", "z/A/file",
+ "%/z/A/file", "" },
+ {"URLs", "http://host/A/C,http://host/A/C/D,http://host/A/B/D",
+ "http://host/A", "C,B/D" },
+ {"URLs with no common prefix",
+ "http://host1/A/C,http://host2/A/C/D,http://host3/A/B/D",
+ "", "http://host1/A/C,http://host2/A/C/D,http://host3/A/B/D" },
+ {"file URLs with no common prefix", "file:///A/C,file:///B/D",
+ "", "file:///A/C,file:///B/D" },
+ {"URLs with mixed protocols",
+ "http://host/A/C,file:///B/D,gopher://host/A",
+ "", "http://host/A/C,file:///B/D,gopher://host/A" },
+ {"mixed paths and URLs",
+ "z/A/B,z/A,http://host/A/C/D,http://host/A/C",
+ "", "%/z/A,http://host/A/C" },
+ };
+
+ for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
+ {
+ SVN_ERR(condense_targets_tests_helper(tests[i].title,
+ tests[i].targets,
+ tests[i].exp_common,
+ tests[i].exp_targets,
+ "svn_path_condense_targets",
+ svn_path_condense_targets,
+ pool));
+ }
+
+ return SVN_NO_ERROR;
+}
+
+
/* local define to support XFail-ing tests on Windows/Cygwin only */
#ifdef SVN_USE_DOS_PATHS
#define WINDOWS_OR_CYGWIN TRUE
@@ -1526,5 +1686,7 @@ struct svn_test_descriptor_t test_funcs[
"test svn_path_local_style"),
SVN_TEST_PASS2(test_path_internal_style,
"test svn_path_internal_style"),
+ SVN_TEST_PASS2(test_path_condense_targets,
+ "test svn_path_condense_targets"),
SVN_TEST_NULL
};
Modified: subversion/branches/javahl-ra/subversion/tests/libsvn_subr/spillbuf-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/libsvn_subr/spillbuf-test.c?rev=1426116&r1=1426115&r2=1426116&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/libsvn_subr/spillbuf-test.c (original)
+++ subversion/branches/javahl-ra/subversion/tests/libsvn_subr/spillbuf-test.c Thu Dec 27 04:03:49 2012
@@ -28,9 +28,9 @@
#include "../svn_test.h"
-static const char basic_data[] = ("abcdefghijklmnopqrstuvwxyz"
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "0123456789");
+static const char basic_data[] = "abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "0123456789";
/* Validate that BUF is STARTING_SIZE in length. Then read some data from
Modified: subversion/branches/javahl-ra/subversion/tests/libsvn_subr/string-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/libsvn_subr/string-test.c?rev=1426116&r1=1426115&r2=1426116&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/libsvn_subr/string-test.c (original)
+++ subversion/branches/javahl-ra/subversion/tests/libsvn_subr/string-test.c Thu Dec 27 04:03:49 2012
@@ -612,6 +612,105 @@ test_stringbuf_replace(apr_pool_t *pool)
return expect_stringbuf_equal(a, "test hello, world!!!", pool);
}
+static svn_error_t *
+test_string_similarity(apr_pool_t *pool)
+{
+ const struct sim_score_test_t
+ {
+ const char *stra;
+ const char *strb;
+ apr_size_t lcs;
+ int score;
+ } tests[] =
+ {
+#define SCORE(lcs, len) ((2000 * (lcs) + (len)/2) / (len))
+
+ /* Equality */
+ {"", "", 0, 1000},
+ {"quoth", "quoth", 5, SCORE(5, 5+5)},
+
+ /* Deletion at start */
+ {"quoth", "uoth", 4, SCORE(4, 5+4)},
+ {"uoth", "quoth", 4, SCORE(4, 4+5)},
+
+ /* Deletion at end */
+ {"quoth", "quot", 4, SCORE(4, 5+4)},
+ {"quot", "quoth", 4, SCORE(4, 4+5)},
+
+ /* Insertion at start */
+ {"quoth", "Xquoth", 5, SCORE(5, 5+6)},
+ {"Xquoth", "quoth", 5, SCORE(5, 6+5)},
+
+ /* Insertion at end */
+ {"quoth", "quothX", 5, SCORE(5, 5+6)},
+ {"quothX", "quoth", 5, SCORE(5, 6+5)},
+
+ /* Insertion in middle */
+ {"quoth", "quoXth", 5, SCORE(5, 5+6)},
+ {"quoXth", "quoth", 5, SCORE(5, 6+5)},
+
+ /* Transposition at start */
+ {"quoth", "uqoth", 4, SCORE(4, 5+5)},
+ {"uqoth", "quoth", 4, SCORE(4, 5+5)},
+
+ /* Transposition at end */
+ {"quoth", "quoht", 4, SCORE(4, 5+5)},
+ {"quoht", "quoth", 4, SCORE(4, 5+5)},
+
+ /* Transposition in middle */
+ {"quoth", "qutoh", 4, SCORE(4, 5+5)},
+ {"qutoh", "quoth", 4, SCORE(4, 5+5)},
+
+ /* Difference */
+ {"quoth", "raven", 0, SCORE(0, 5+5)},
+ {"raven", "quoth", 0, SCORE(0, 5+5)},
+ {"x", "", 0, SCORE(0, 1+0)},
+ {"", "x", 0, SCORE(0, 0+1)},
+ {"", "quoth", 0, SCORE(0, 0+5)},
+ {"quoth", "", 0, SCORE(0, 5+0)},
+ {"quoth", "the raven", 2, SCORE(2, 5+9)},
+ {"the raven", "quoth", 2, SCORE(2, 5+9)},
+ {NULL, NULL}
+ };
+
+ const struct sim_score_test_t *t;
+ svn_membuf_t buffer;
+
+ svn_membuf__create(&buffer, 0, pool);
+ for (t = tests; t->stra; ++t)
+ {
+ apr_size_t lcs;
+ const unsigned int score =
+ svn_cstring__similarity(t->stra, t->strb, &buffer, &lcs);
+ /*
+ fprintf(stderr,
+ "lcs %s ~ %s score %.3f (%"APR_SIZE_T_FMT
+ ") expected %.3f (%"APR_SIZE_T_FMT"))\n",
+ t->stra, t->strb, score/1000.0, lcs, t->score/1000.0, t->lcs);
+ */
+ if (score != t->score)
+ return fail(pool, "%s ~ %s score %.3f <> expected %.3f",
+ t->stra, t->strb, score/1000.0, t->score/1000.0);
+
+ if (lcs != t->lcs)
+ return fail(pool,
+ "%s ~ %s lcs %"APR_SIZE_T_FMT
+ " <> expected %"APR_SIZE_T_FMT,
+ t->stra, t->strb, lcs, t->lcs);
+ }
+
+ /* Test partial similarity */
+ {
+ const svn_string_t foo = {"svn:foo", 4};
+ const svn_string_t bar = {"svn:bar", 4};
+ if (1000 != svn_string__similarity(&foo, &bar, &buffer, NULL))
+ return fail(pool, "'%s'[:4] ~ '%s'[:4] found different",
+ foo.data, bar.data);
+ }
+
+ return SVN_NO_ERROR;
+}
+
/*
====================================================================
If you add a new test to this file, update this array.
@@ -677,5 +776,7 @@ struct svn_test_descriptor_t test_funcs[
"check deletion from svn_stringbuf_t"),
SVN_TEST_PASS2(test_stringbuf_replace,
"check replacement in svn_stringbuf_t"),
+ SVN_TEST_PASS2(test_string_similarity,
+ "test string similarity scores"),
SVN_TEST_NULL
};
Propchange: subversion/branches/javahl-ra/subversion/tests/libsvn_wc/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Dec 27 04:03:49 2012
@@ -11,3 +11,4 @@ tree-conflict-data-test
wc-incomplete-tester
wc-lock-tester
wc-queries-test
+wc-test
Modified: subversion/branches/javahl-ra/subversion/tests/libsvn_wc/db-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/libsvn_wc/db-test.c?rev=1426116&r1=1426115&r2=1426116&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/libsvn_wc/db-test.c (original)
+++ subversion/branches/javahl-ra/subversion/tests/libsvn_wc/db-test.c Thu Dec 27 04:03:49 2012
@@ -391,6 +391,7 @@ test_getting_info(apr_pool_t *pool)
const svn_checksum_t *checksum;
const char *target;
svn_boolean_t had_props;
+ apr_hash_t *props;
svn_boolean_t update_root;
svn_wc__db_lock_t *lock;
svn_wc__db_t *db;
@@ -403,7 +404,7 @@ test_getting_info(apr_pool_t *pool)
&status, &kind, &revision,
&repos_relpath, &repos_root_url, &repos_uuid,
&changed_rev, &changed_date, &changed_author,&depth, &checksum,
- &target, &lock, &had_props,
+ &target, &lock, &had_props, &props,
&update_root,
db, local_abspath,
pool, pool));
@@ -420,6 +421,9 @@ test_getting_info(apr_pool_t *pool)
SVN_TEST_ASSERT(checksum == NULL);
SVN_TEST_ASSERT(target == NULL);
SVN_TEST_ASSERT(lock == NULL);
+ SVN_TEST_ASSERT(had_props == FALSE);
+ SVN_TEST_ASSERT(apr_hash_count(props) == 0);
+ /* SVN_TEST_ASSERT(update_root == ???); */
/* Test: file-specific values. */
SVN_ERR(svn_wc__db_base_get_info(
@@ -427,7 +431,7 @@ test_getting_info(apr_pool_t *pool)
&repos_relpath, &repos_root_url, &repos_uuid,
NULL, NULL, NULL, NULL,
&checksum, NULL, NULL,
- NULL, NULL,
+ NULL, NULL, NULL,
db, svn_dirent_join(local_abspath, "A", pool),
pool, pool));
SVN_TEST_ASSERT(kind == svn_kind_file);
@@ -442,7 +446,7 @@ test_getting_info(apr_pool_t *pool)
&repos_relpath, &repos_root_url, &repos_uuid,
&changed_rev, &changed_date, &changed_author,
&depth, &checksum, &target, &lock,
- NULL, NULL,
+ NULL, NULL, NULL,
db, svn_dirent_join(local_abspath, "B", pool),
pool, pool));
SVN_TEST_ASSERT(kind == svn_kind_symlink);
@@ -465,7 +469,7 @@ test_getting_info(apr_pool_t *pool)
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
- NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
db, svn_dirent_join(local_abspath, "C", pool),
pool, pool));
SVN_TEST_ASSERT(kind == svn_kind_unknown);
@@ -477,7 +481,7 @@ test_getting_info(apr_pool_t *pool)
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
- NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
db, svn_dirent_join(local_abspath, "D", pool),
pool, pool));
SVN_TEST_ASSERT(status == svn_wc__db_status_not_present);
@@ -488,7 +492,7 @@ test_getting_info(apr_pool_t *pool)
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
- NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
db, svn_dirent_join(local_abspath, "E", pool),
pool, pool));
SVN_TEST_ASSERT(status == svn_wc__db_status_incomplete);
@@ -499,7 +503,7 @@ test_getting_info(apr_pool_t *pool)
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, &checksum, NULL,
- NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
db, svn_dirent_join(local_abspath, "F", pool),
pool, pool));
SVN_TEST_STRING_ASSERT(SHA1_1,
@@ -511,7 +515,7 @@ test_getting_info(apr_pool_t *pool)
&repos_relpath, &repos_root_url, &repos_uuid,
&changed_rev, &changed_date, &changed_author,
NULL, NULL, NULL,
- NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
db, svn_dirent_join(local_abspath, "G", pool),
pool, pool));
SVN_TEST_STRING_ASSERT(repos_relpath, "G-alt");
@@ -527,7 +531,7 @@ test_getting_info(apr_pool_t *pool)
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, &checksum, &target,
- NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
db, svn_dirent_join(local_abspath, "H", pool),
pool, pool));
SVN_TEST_ASSERT(checksum == NULL);
@@ -539,7 +543,7 @@ test_getting_info(apr_pool_t *pool)
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
- NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
db, svn_dirent_join(local_abspath, "missing-file", pool),
pool, pool);
SVN_TEST_ASSERT(err != NULL && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND);
@@ -568,14 +572,12 @@ validate_node(svn_wc__db_t *db,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
- NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
db, path,
scratch_pool, scratch_pool));
SVN_TEST_ASSERT(kind == expected_kind);
SVN_TEST_ASSERT(status == expected_status);
- SVN_ERR(svn_wc__db_base_get_props(&props, db, path,
- scratch_pool, scratch_pool));
switch (status)
{
case svn_wc__db_status_server_excluded:
@@ -583,13 +585,18 @@ validate_node(svn_wc__db_t *db,
case svn_wc__db_status_incomplete:
case svn_wc__db_status_not_present:
/* Our tests aren't setting properties on these node types, so
- short-circuit examination of name/value pairs. */
+ short-circuit examination of name/value pairs, to avoid having
+ to handle the error from svn_wc__db_base_get_props(). */
return SVN_NO_ERROR;
-
default:
- SVN_TEST_ASSERT(props != NULL);
+ break; /* Fall through */
}
+ SVN_ERR(svn_wc__db_base_get_props(&props, db, path,
+ scratch_pool, scratch_pool));
+
+ SVN_TEST_ASSERT(props != NULL);
+
value = apr_hash_get(props, "p1", APR_HASH_KEY_STRING);
SVN_TEST_STRING_ASSERT(value->data, "v1");
@@ -664,7 +671,7 @@ test_inserting_nodes(apr_pool_t *pool)
props,
1, TIME_1a, AUTHOR_1,
checksum,
- NULL, FALSE, FALSE, NULL, FALSE, FALSE,
+ NULL, FALSE, FALSE, NULL, NULL, FALSE, FALSE,
NULL, NULL,
pool));
@@ -677,7 +684,7 @@ test_inserting_nodes(apr_pool_t *pool)
props,
1, TIME_1a, AUTHOR_1,
"O-target",
- NULL, FALSE, FALSE, NULL, FALSE, FALSE,
+ NULL, FALSE, FALSE, NULL, NULL, FALSE, FALSE,
NULL, NULL,
pool));
@@ -803,10 +810,10 @@ test_working_info(apr_pool_t *pool)
svn_revnum_t changed_rev;
apr_time_t changed_date;
const char *changed_author;
- apr_time_t last_mod_time;
+ apr_time_t recorded_time;
svn_depth_t depth;
const svn_checksum_t *checksum;
- svn_filesize_t translated_size;
+ svn_filesize_t recorded_size;
const char *target;
const char *changelist;
const char *original_repos_relpath;
@@ -832,7 +839,7 @@ test_working_info(apr_pool_t *pool)
&changed_rev, &changed_date, &changed_author,
&depth, &checksum, &target, &original_repos_relpath,
&original_root_url, &original_uuid, &original_revnum,
- &lock, &translated_size, &last_mod_time, &changelist,
+ &lock, &recorded_size, &recorded_time, &changelist,
&conflicted, &op_root, &had_props, &props_mod,
&have_base, &have_more_work, &have_work,
db, svn_dirent_join(local_abspath, "I", pool),
@@ -848,18 +855,22 @@ test_working_info(apr_pool_t *pool)
SVN_TEST_STRING_ASSERT(changed_author, AUTHOR_2);
SVN_TEST_ASSERT(depth == svn_depth_immediates);
SVN_TEST_ASSERT(checksum == NULL);
- SVN_TEST_ASSERT(translated_size == SVN_INVALID_FILESIZE);
+ SVN_TEST_ASSERT(recorded_size == SVN_INVALID_FILESIZE);
SVN_TEST_ASSERT(target == NULL);
SVN_TEST_STRING_ASSERT(changelist, "changelist");
SVN_TEST_STRING_ASSERT(original_repos_relpath, "some/dir");
SVN_TEST_STRING_ASSERT(original_root_url, ROOT_TWO);
SVN_TEST_STRING_ASSERT(original_uuid, UUID_TWO);
SVN_TEST_ASSERT(original_revnum == 2);
+ SVN_TEST_ASSERT(had_props == FALSE);
SVN_TEST_ASSERT(props_mod == FALSE);
SVN_TEST_ASSERT(have_base == TRUE);
+ /* SVN_TEST_ASSERT(have_more_work...); */
SVN_TEST_ASSERT(have_work == TRUE);
SVN_TEST_ASSERT(conflicted == FALSE);
SVN_TEST_ASSERT(lock == NULL);
+ /* SVN_TEST_ASSERT(last_mod_time...); */
+ /* SVN_TEST_ASSERT(op_root...); */
/* ### we need a hojillion more tests in here. I just want to get this
Modified: subversion/branches/javahl-ra/subversion/tests/libsvn_wc/entries-compat.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/libsvn_wc/entries-compat.c?rev=1426116&r1=1426115&r2=1426116&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/libsvn_wc/entries-compat.c (original)
+++ subversion/branches/javahl-ra/subversion/tests/libsvn_wc/entries-compat.c Thu Dec 27 04:03:49 2012
@@ -614,13 +614,13 @@ test_access_baton_like_locking(apr_pool_
repos_root_url, 0, svn_depth_infinity,
pool));
- SVN_ERR(svn_wc__check_wc_root(&is_root, NULL, NULL, wc_ctx->db, subdir,
- pool));
+ SVN_ERR(svn_wc__db_is_switched(&is_root, NULL, NULL, wc_ctx->db, subdir,
+ pool));
SVN_TEST_ASSERT(is_root);
- SVN_ERR(svn_wc__check_wc_root(&is_root, NULL, NULL, wc_ctx2->db, subdir,
- pool));
+ SVN_ERR(svn_wc__db_is_switched(&is_root, NULL, NULL, wc_ctx2->db, subdir,
+ pool));
/* This test was added to show a regression where the next check failed,
but the check above this succeeded */