You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2012/04/23 14:33:03 UTC
svn commit: r1329209 [35/38] - in /subversion/branches/javahl-ra: ./ build/
build/ac-macros/ build/generator/ build/generator/templates/ build/win32/
contrib/client-side/emacs/ contrib/client-side/vim/
contrib/server-side/mod_dontdothat/ notes/ notes/a...
Modified: subversion/branches/javahl-ra/subversion/tests/cmdline/tree_conflict_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/cmdline/tree_conflict_tests.py?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/cmdline/tree_conflict_tests.py (original)
+++ subversion/branches/javahl-ra/subversion/tests/cmdline/tree_conflict_tests.py Mon Apr 23 12:32:48 2012
@@ -38,6 +38,7 @@ from svntest.actions import run_and_veri
from svntest.actions import run_and_verify_info
from svntest.actions import get_virginal_state
import shutil
+import logging
# (abbreviation)
Skip = svntest.testcase.Skip_deco
@@ -49,16 +50,7 @@ Wimp = svntest.testcase.Wimp_deco
Item = svntest.wc.StateItem
AnyOutput = svntest.verify.AnyOutput
-# If verbose mode is enabled, print the LINE and a newline.
-def verbose_print(line):
- if main.options.verbose:
- print(line)
-
-# If verbose mode is enabled, print the (assumed newline-terminated) LINES.
-def verbose_printlines(lines):
- if main.options.verbose:
- for line in lines:
- sys.stdout.write(line)
+logger = logging.getLogger()
######################################################################
# Tests
@@ -388,14 +380,14 @@ def ensure_tree_conflict(sbox, operation
def url_of(repo_relative_path):
return sbox.repo_url + '/' + repo_relative_path
- verbose_print("")
- verbose_print("=== Starting a set of '" + operation + "' tests.")
+ logger.debug("")
+ logger.debug("=== Starting a set of '" + operation + "' tests.")
# Path to source branch, relative to wc_dir.
# Source is where the "incoming" mods are made.
source_br = "branch1"
- verbose_print("--- Creating changes in repos")
+ logger.debug("--- Creating changes in repos")
source_wc_dir = os.path.join(wc_dir, source_br)
source_left_rev, source_right_rev = set_up_repos(wc_dir, source_wc_dir,
incoming_scenarios)
@@ -430,9 +422,9 @@ def ensure_tree_conflict(sbox, operation
source_url = url_of(source_br + '/' + scen_name)
target_path = os.path.join(target_br, scen_name)
- verbose_print("=== " + str(inc_action) + " onto " + str(loc_action))
+ logger.debug("=== " + str(inc_action) + " onto " + str(loc_action))
- verbose_print("--- Making local mods")
+ logger.debug("--- Making local mods")
for modaction in loc_action:
modify(modaction, localmod_paths(".", target_path), is_init=False)
if commit_local_mods:
@@ -444,7 +436,7 @@ def ensure_tree_conflict(sbox, operation
# For update, verify the pre-condition that WC is out of date.
# For switch/merge, there is no such precondition.
if operation == 'update':
- verbose_print("--- Trying to commit (expecting 'out-of-date' error)")
+ logger.debug("--- Trying to commit (expecting 'out-of-date' error)")
run_and_verify_commit(".", None, None, "Commit failed",
target_path)
@@ -462,15 +454,15 @@ def ensure_tree_conflict(sbox, operation
match_all=False)
# Do the main action
if operation == 'update':
- verbose_print("--- Updating")
+ logger.debug("--- Updating")
run_and_verify_svn(None, expected_stdout, [],
'update', target_path)
elif operation == 'switch':
- verbose_print("--- Switching")
+ logger.debug("--- Switching")
run_and_verify_svn(None, expected_stdout, [],
'switch', source_url, target_path)
elif operation == 'merge':
- verbose_print("--- Merging")
+ logger.debug("--- Merging")
run_and_verify_svn(None, expected_stdout, [],
'merge', '--ignore-ancestry',
'--allow-mixed-revisions',
@@ -479,7 +471,7 @@ def ensure_tree_conflict(sbox, operation
else:
raise Exception("unknown operation: '" + operation + "'")
- verbose_print("--- Checking that 'info' reports the conflict")
+ logger.debug("--- Checking that 'info' reports the conflict")
if operation == 'update' or operation == 'switch':
incoming_left_rev = target_start_rev
else:
@@ -495,39 +487,39 @@ def ensure_tree_conflict(sbox, operation
re.escape(victim_name + '@' + str(incoming_right_rev)) + r')' }
run_and_verify_info([expected_info], victim_path)
- verbose_print("--- Trying to commit (expecting 'conflict' error)")
+ logger.debug("--- Trying to commit (expecting 'conflict' error)")
### run_and_verify_commit() requires an "output_tree" argument, but
# here we get away with passing None because we know an implementation
# detail: namely that it's not going to look at that argument if it
# gets the stderr that we're expecting.
run_and_verify_commit(".", None, None, ".*conflict.*", victim_path)
- verbose_print("--- Checking that 'status' reports the conflict")
+ logger.debug("--- Checking that 'status' reports the conflict")
expected_stdout = svntest.verify.RegexOutput("^......C.* " +
re.escape(victim_path) + "$",
match_all=False)
run_and_verify_svn(None, expected_stdout, [],
'status', victim_path)
- verbose_print("--- Resolving the conflict")
+ logger.debug("--- Resolving the conflict")
# Make sure resolving the parent does nothing.
run_and_verify_resolved([], os.path.dirname(victim_path))
# The real resolved call.
run_and_verify_resolved([victim_path])
- verbose_print("--- Checking that 'status' does not report a conflict")
+ logger.debug("--- Checking that 'status' does not report a conflict")
exitcode, stdout, stderr = run_and_verify_svn(None, None, [],
'status', victim_path)
for line in stdout:
if line[6] == 'C': # and line.endswith(victim_path + '\n'):
raise svntest.Failure("unexpected status C") # on victim_path
- # verbose_print("--- Committing (should now succeed)")
+ # logger.debug("--- Committing (should now succeed)")
# run_and_verify_svn(None, None, [],
# 'commit', '-m', '', target_path)
# target_start_rev += 1
- verbose_print("")
+ logger.debug("")
os.chdir(saved_cwd)
@@ -1224,7 +1216,7 @@ def actual_only_node_behaviour(sbox):
"export", foo_path, sbox.get_tempname())
# import
expected_stdout = None
- expected_stderr = ".*foo.*does not exist.*"
+ expected_stderr = ".*(foo.*does not exist|Can't stat.*foo).*"
run_and_verify_svn(None, expected_stdout, expected_stderr,
"import", '-m', svntest.main.make_log_msg(),
foo_path, sbox.repo_url + '/foo_imported')
@@ -1258,7 +1250,7 @@ def actual_only_node_behaviour(sbox):
# merge
# note: this is intentionally a no-op merge that does not record mergeinfo
expected_stdout = None
- expected_stderr = ".*foo.*does not exist.*"
+ expected_stderr = ".*foo.*was not found.*"
run_and_verify_svn(None, expected_stdout, expected_stderr,
"merge", '--ignore-ancestry', '-c', '4',
A_copy_url + '/mu', foo_path)
@@ -1406,7 +1398,8 @@ def update_dir_with_not_present(sbox):
sbox.simple_rm('A/B')
# We can't commit this without updating (ra_svn produces its own error)
- run_and_verify_svn(None, None, "svn: (E155011|E160028): Dir.*B.*out of date",
+ run_and_verify_svn(None, None,
+ "svn: (E155011|E160028|E170004): (Dir|Item).*B.*out of date",
'ci', '-m', '', wc_dir)
# So we run update
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=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/cmdline/update_tests.py (original)
+++ subversion/branches/javahl-ra/subversion/tests/cmdline/update_tests.py Mon Apr 23 12:32:48 2012
@@ -27,6 +27,9 @@
# General modules
import sys, re, os, subprocess
import time
+import logging
+
+logger = logging.getLogger()
# Our testing module
import svntest
@@ -92,7 +95,7 @@ def detect_extra_files(node, extra_files
extra_files.pop(extra_files.index(fdata)) # delete pattern from list
return
- print("Found unexpected object: %s" % node.name)
+ logger.warn("Found unexpected object: %s", node.name)
raise svntest.tree.SVNTreeUnequal
@@ -197,8 +200,8 @@ def update_binary_file(sbox):
# verify that the extra_files list is now empty.
if len(extra_files) != 0:
- print("Not all extra reject files have been accounted for:")
- print(extra_files)
+ logger.warn("Not all extra reject files have been accounted for:")
+ logger.warn(extra_files)
raise svntest.Failure
#----------------------------------------------------------------------
@@ -307,6 +310,92 @@ def update_binary_file_2(sbox):
#----------------------------------------------------------------------
+@XFail()
+@Issue(4128)
+def update_binary_file_3(sbox):
+ "update locally modified file to equal versions"
+
+ sbox.build()
+ wc_dir = sbox.wc_dir
+
+ # Suck up contents of a test .png file.
+ theta_contents = open(os.path.join(sys.path[0], "theta.bin"), 'rb').read()
+
+ # Write our files contents out to disk, in A/theta.
+ theta_path = os.path.join(wc_dir, 'A', 'theta')
+ svntest.main.file_write(theta_path, theta_contents, 'wb')
+
+ # Now, `svn add' that file.
+ svntest.main.run_svn(None, 'add', theta_path)
+
+ # Created expected output tree for 'svn ci'
+ expected_output = svntest.wc.State(wc_dir, {
+ 'A/theta' : Item(verb='Adding (bin)'),
+ })
+
+ # Create expected status tree
+ expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+ expected_status.add({
+ 'A/theta' : Item(status=' ', wc_rev=2),
+ })
+
+ # Commit the new binary file, creating revision 2.
+ svntest.actions.run_and_verify_commit(wc_dir, expected_output,
+ expected_status, None, wc_dir)
+
+ # Make some mods to the binary files.
+ svntest.main.file_append(theta_path, "foobar")
+ new_theta_contents = theta_contents + "foobar"
+
+ # Created expected output tree for 'svn ci'
+ expected_output = svntest.wc.State(wc_dir, {
+ 'A/theta' : Item(verb='Sending'),
+ })
+
+ # Create expected status tree
+ expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+ expected_status.add({
+ 'A/theta' : Item(status=' ', wc_rev=3),
+ })
+
+ # Commit modified working copy, creating revision 3.
+ svntest.actions.run_and_verify_commit(wc_dir, expected_output,
+ expected_status, None, wc_dir)
+
+ # Now we locally modify the file back to the old version.
+ svntest.main.file_write(theta_path, theta_contents, 'wb')
+
+ # Create expected output tree for an update to rev 2.
+ expected_output = svntest.wc.State(wc_dir, {
+ 'A/theta' : Item(status=' '),
+ })
+
+ # Create expected disk tree for the update
+ expected_disk = svntest.main.greek_state.copy()
+ expected_disk.add({
+ 'A/theta' : Item(theta_contents,
+ props={'svn:mime-type' : 'application/octet-stream'}),
+ })
+
+ # Create expected status tree for the update.
+ expected_status = svntest.actions.get_virginal_state(wc_dir, 2)
+ expected_status.add({
+ 'A/theta' : Item(status=' ', wc_rev=2),
+ })
+
+ # Do an update from revision 2 and make sure that our binary file
+ # gets reverted to its original contents.
+ # This used to raise a conflict.
+ svntest.actions.run_and_verify_update(wc_dir,
+ expected_output,
+ expected_disk,
+ expected_status,
+ None, None, None,
+ None, None, 1,
+ '-r', '2', wc_dir)
+
+#----------------------------------------------------------------------
+
def update_missing(sbox):
"update missing items (by name) in working copy"
@@ -609,7 +698,7 @@ def update_to_resolve_text_conflicts(sbo
# verify that the extra_files list is now empty.
if len(extra_files) != 0:
- print("didn't get expected extra files")
+ logger.warn("didn't get expected extra files")
raise svntest.Failure
# remove the conflicting files to clear text conflict but not props conflict
@@ -622,7 +711,7 @@ def update_to_resolve_text_conflicts(sbo
exit_code, stdout_lines, stdout_lines = svntest.main.run_svn(None, 'up',
wc_backup)
if len (stdout_lines) > 0:
- print("update 2 failed")
+ logger.warn("update 2 failed")
raise svntest.Failure
# Create expected status tree
@@ -1189,6 +1278,7 @@ def another_hudson_problem(sbox):
# Sigh, I can't get run_and_verify_update to work (but not because
# of issue 919 as far as I can tell)
+ expected_output = svntest.verify.UnorderedOutput(expected_output)
svntest.actions.run_and_verify_svn(None,
expected_output, [],
'up', G_path)
@@ -3142,19 +3232,17 @@ def mergeinfo_update_elision(sbox):
lambda_path = os.path.join(wc_dir, "A", "B", "lambda")
# Make a branch A/B_COPY
- svntest.actions.run_and_verify_svn(
- None,
- ["A " + os.path.join(wc_dir, "A", "B_COPY", "lambda") + "\n",
+ expected_stdout = verify.UnorderedOutput([
+ "A " + os.path.join(wc_dir, "A", "B_COPY", "lambda") + "\n",
"A " + os.path.join(wc_dir, "A", "B_COPY", "E") + "\n",
"A " + os.path.join(wc_dir, "A", "B_COPY", "E", "alpha") + "\n",
"A " + os.path.join(wc_dir, "A", "B_COPY", "E", "beta") + "\n",
"A " + os.path.join(wc_dir, "A", "B_COPY", "F") + "\n",
"Checked out revision 1.\n",
- "A " + B_COPY_path + "\n"],
- [],
- 'copy',
- sbox.repo_url + "/A/B",
- B_COPY_path)
+ "A " + B_COPY_path + "\n",
+ ])
+ svntest.actions.run_and_verify_svn(None, expected_stdout, [], 'copy',
+ sbox.repo_url + "/A/B", B_COPY_path)
expected_output = wc.State(wc_dir, {'A/B_COPY' : Item(verb='Adding')})
@@ -5290,7 +5378,7 @@ def update_with_file_lock_and_keywords_p
sbox.simple_update()
mu_ts_after_update = os.path.getmtime(mu_path)
if (mu_ts_before_update != mu_ts_after_update):
- print("The timestamp of 'mu' before and after update does not match.")
+ logger.warn("The timestamp of 'mu' before and after update does not match.")
raise svntest.Failure
#----------------------------------------------------------------------
@@ -5611,6 +5699,101 @@ def update_moved_dir_file_move(sbox):
None, None, None,
None, None, 1)
+@XFail()
+def update_move_text_mod(sbox):
+ "text mod to moved files"
+
+ sbox.build()
+ wc_dir = sbox.wc_dir
+ svntest.main.file_append(sbox.ospath('A/B/lambda'), "modified\n")
+ svntest.main.file_append(sbox.ospath('A/B/E/beta'), "modified\n")
+ sbox.simple_commit()
+ sbox.simple_update(revision=1)
+
+ sbox.simple_move("A/B/E", "A/E2")
+ sbox.simple_move("A/B/lambda", "A/lambda2")
+
+ expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+ expected_status.tweak('A/B/E', 'A/B/E/alpha', 'A/B/E/beta', 'A/B/lambda',
+ status='D ')
+ expected_status.add({
+ 'A/E2' : Item(status='A ', copied='+', wc_rev='-'),
+ 'A/E2/alpha' : Item(status=' ', copied='+', wc_rev='-'),
+ 'A/E2/beta' : Item(status=' ', copied='+', wc_rev='-'),
+ 'A/lambda2' : Item(status='A ', copied='+', wc_rev='-'),
+ })
+
+ svntest.actions.run_and_verify_status(wc_dir, expected_status)
+
+ expected_output = svntest.wc.State(wc_dir, {
+ 'A/lambda2' : Item(status='U '),
+ 'A/E2/beta' : Item(status='U '),
+ })
+ expected_disk = svntest.main.greek_state.copy()
+ expected_disk.remove('A/B/E/alpha', 'A/B/E/beta', 'A/B/E', 'A/B/lambda')
+ expected_disk.add({
+ 'A/E2' : Item(),
+ 'A/E2/alpha' : Item(contents="This is the file 'alpha'.\n"),
+ 'A/E2/beta' : Item(contents="This is the file 'beta'.\nmodified\n"),
+ 'A/lambda2' : Item(contents="This is the file 'lambda'.\nmodified\n"),
+ })
+ expected_status.tweak(wc_rev=2)
+ expected_status.tweak('A/E2', 'A/E2/alpha', 'A/E2/beta', 'A/lambda2',
+ wc_rev='-')
+ ### XFAIL 'A/E2/beta' is status R but should be ' '
+ svntest.actions.run_and_verify_update(wc_dir,
+ expected_output,
+ expected_disk,
+ expected_status,
+ None, None, None,
+ None, None, 1)
+
+@XFail()
+def update_nested_move_text_mod(sbox):
+ "text mod to moved file in moved dir"
+
+ sbox.build()
+ wc_dir = sbox.wc_dir
+ svntest.main.file_append(sbox.ospath('A/B/E/alpha'), "modified\n")
+ sbox.simple_commit()
+ sbox.simple_update(revision=1)
+
+ sbox.simple_move("A/B/E", "A/E2")
+ sbox.simple_move("A/E2/alpha", "A/alpha2")
+
+ expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+ expected_status.tweak('A/B/E', 'A/B/E/alpha', 'A/B/E/beta', status='D ')
+ expected_status.add({
+ 'A/E2' : Item(status='A ', copied='+', wc_rev='-'),
+ 'A/E2/alpha' : Item(status='D ', copied='+', wc_rev='-'),
+ 'A/E2/beta' : Item(status=' ', copied='+', wc_rev='-'),
+ 'A/alpha2' : Item(status='A ', copied='+', wc_rev='-'),
+ })
+
+ svntest.actions.run_and_verify_status(wc_dir, expected_status)
+
+ expected_output = svntest.wc.State(wc_dir, {
+ 'A/alpha2' : Item(status='U '),
+ })
+ expected_disk = svntest.main.greek_state.copy()
+ expected_disk.remove('A/B/E/alpha', 'A/B/E/beta', 'A/B/E')
+ expected_disk.add({
+ 'A/E2' : Item(),
+ 'A/E2/beta' : Item(contents="This is the file 'beta'.\n"),
+ 'A/alpha2' : Item(contents="This is the file 'alpha'.\nmodified\n"),
+ })
+ expected_status.tweak(wc_rev=2)
+ expected_status.tweak('A/E2', 'A/E2/alpha', 'A/E2/beta', 'A/alpha2',
+ wc_rev='-')
+ ### XFAIL update fails 'No such file'
+ svntest.actions.run_and_verify_update(wc_dir,
+ expected_output,
+ expected_disk,
+ expected_status,
+ None, None, None,
+ None, None, 1)
+
+
#######################################################################
# Run the tests
@@ -5682,6 +5865,9 @@ test_list = [ None,
update_moved_dir_file_add,
update_moved_dir_dir_add,
update_moved_dir_file_move,
+ update_binary_file_3,
+ update_move_text_mod,
+ update_nested_move_text_mod,
]
if __name__ == '__main__':
Modified: subversion/branches/javahl-ra/subversion/tests/cmdline/upgrade_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/cmdline/upgrade_tests.py?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/cmdline/upgrade_tests.py (original)
+++ subversion/branches/javahl-ra/subversion/tests/cmdline/upgrade_tests.py Mon Apr 23 12:32:48 2012
@@ -35,6 +35,9 @@ import shutil
import sys
import tarfile
import tempfile
+import logging
+
+logger = logging.getLogger()
import svntest
from svntest import wc
@@ -83,7 +86,7 @@ def replace_sbox_repo_with_tarfile(sbox,
if not dir:
dir = tar_filename.split('.')[0]
-
+
tarpath = os.path.join(os.path.dirname(sys.argv[0]), 'upgrade_tests_data',
tar_filename)
t = tarfile.open(tarpath, 'r:bz2')
@@ -179,15 +182,15 @@ def simple_property_verify(dir_path, exp
v2 = node2.get(prop, None)
if not v2:
- print('\'%s\' property on \'%s\' not found in %s' %
- (prop, key, name))
+ logger.warn('\'%s\' property on \'%s\' not found in %s',
+ prop, key, name)
equal = False
if match and v1 != v2:
- print('Expected \'%s\' on \'%s\' to be \'%s\', but found \'%s\'' %
- (prop, key, v1, v2))
+ logger.warn('Expected \'%s\' on \'%s\' to be \'%s\', but found \'%s\'',
+ prop, key, v1, v2)
equal = False
else:
- print('\'%s\': %s not found in %s' % (key, dict1[key], name))
+ logger.warn('\'%s\': %s not found in %s', key, dict1[key], name)
equal = False
return equal
@@ -214,7 +217,7 @@ def simple_property_verify(dir_path, exp
v2 = diff_props(actual_props, expected_props, 'expected', False)
if not v1 or not v2:
- print('Actual properties: %s' % actual_props)
+ logger.warn('Actual properties: %s', actual_props)
raise svntest.Failure("Properties unequal")
def simple_checksum_verify(expected_checksums):
@@ -244,7 +247,7 @@ def run_and_verify_status_no_server(wc_d
except svntest.tree.SVNTreeError:
svntest.verify.display_trees(None, 'STATUS OUTPUT TREE',
expected_status.old_tree(), actual)
- print("ACTUAL STATUS TREE:")
+ logger.warn("ACTUAL STATUS TREE:")
svntest.tree.dump_tree_script(actual, wc_dir + os.sep)
raise
@@ -1079,7 +1082,7 @@ def upgrade_with_missing_subdir(sbox):
svntest.main.safe_rmtree(sbox.ospath('A/B'))
# Now upgrade the working copy and expect a missing subdir
- expected_output = [
+ expected_output = svntest.verify.UnorderedOutput([
"Upgraded '%s'\n" % sbox.wc_dir,
"Upgraded '%s'\n" % sbox.ospath('A'),
"Skipped '%s'\n" % sbox.ospath('A/B'),
@@ -1087,7 +1090,7 @@ def upgrade_with_missing_subdir(sbox):
"Upgraded '%s'\n" % sbox.ospath('A/D'),
"Upgraded '%s'\n" % sbox.ospath('A/D/G'),
"Upgraded '%s'\n" % sbox.ospath('A/D/H'),
- ]
+ ])
svntest.actions.run_and_verify_svn(None, expected_output, [],
'upgrade', sbox.wc_dir)
@@ -1163,7 +1166,7 @@ def upgrade_file_externals(sbox):
svntest.actions.run_and_verify_svn(None, None, [], 'relocate',
'file:///tmp/repo', sbox.repo_url,
sbox.wc_dir)
-
+
expected_output = svntest.wc.State(sbox.wc_dir, {
'A/mu' : Item(status=' U'),
'A/B/lambda' : Item(status=' U'),
Propchange: subversion/branches/javahl-ra/subversion/tests/libsvn_client/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Apr 23 12:32:48 2012
@@ -4,3 +4,4 @@ client-test
test-patch*
test-wc*
test-copy-crash
+test-youngest-common-ancestor
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=1329209&r1=1329208&r2=1329209&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 Mon Apr 23 12:32:48 2012
@@ -28,6 +28,7 @@
#include <limits.h>
#include "svn_mergeinfo.h"
#include "../../libsvn_client/mergeinfo.h"
+#include "../../libsvn_client/client.h"
#include "svn_pools.h"
#include "svn_client.h"
#include "svn_repos.h"
@@ -102,26 +103,28 @@ test_elide_mergeinfo_catalog(apr_pool_t
i < sizeof(elide_testcases) / sizeof(elide_testcases[0]);
i++)
{
- apr_hash_t *catalog;
+ svn_mergeinfo_catalog_t mergeinfo_catalog;
mergeinfo_catalog_item *item;
svn_pool_clear(iterpool);
- catalog = apr_hash_make(iterpool);
+ mergeinfo_catalog = apr_hash_make(iterpool);
for (item = elide_testcases[i]; item->path; item++)
{
- apr_hash_t *mergeinfo;
+ svn_mergeinfo_t mergeinfo;
SVN_ERR(svn_mergeinfo_parse(&mergeinfo, item->unparsed_mergeinfo,
iterpool));
- apr_hash_set(catalog, item->path, APR_HASH_KEY_STRING, mergeinfo);
+ apr_hash_set(mergeinfo_catalog, item->path, APR_HASH_KEY_STRING,
+ mergeinfo);
}
- SVN_ERR(svn_client__elide_mergeinfo_catalog(catalog, iterpool));
+ SVN_ERR(svn_client__elide_mergeinfo_catalog(mergeinfo_catalog,
+ iterpool));
for (item = elide_testcases[i]; item->path; item++)
{
- apr_hash_t *mergeinfo = apr_hash_get(catalog, item->path,
+ apr_hash_t *mergeinfo = apr_hash_get(mergeinfo_catalog, item->path,
APR_HASH_KEY_STRING);
if (item->remains && !mergeinfo)
return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
@@ -569,7 +572,7 @@ test_copy_crash(const svn_test_opts_t *o
/* Create a filesytem and repository containing the Greek tree. */
SVN_ERR(create_greek_repos(&repos_url, "test-copy-crash", opts, pool));
- svn_client_create_context(&ctx, pool);
+ SVN_ERR(svn_client_create_context(&ctx, pool));
rev.kind = svn_opt_revision_head;
dest = svn_path_url_add_component2(repos_url, "A/E", pool);
@@ -648,6 +651,76 @@ test_16k_add(const svn_test_opts_t *opts
}
#endif
+static svn_error_t *
+test_youngest_common_ancestor(const svn_test_opts_t *opts,
+ apr_pool_t *pool)
+{
+ const char *repos_url;
+ const char *repos_uuid = "fake-uuid"; /* the functions we call don't care */
+ svn_client_ctx_t *ctx;
+ svn_opt_revision_t head_rev = { svn_opt_revision_head, { 0 } };
+ svn_opt_revision_t zero_rev = { svn_opt_revision_number, { 0 } };
+ svn_client_copy_source_t source;
+ apr_array_header_t *sources;
+ const char *dest;
+ svn_client__pathrev_t *yc_ancestor;
+
+ /* Create a filesytem and repository containing the Greek tree. */
+ SVN_ERR(create_greek_repos(&repos_url, "test-youngest-common-ancestor", opts, pool));
+
+ SVN_ERR(svn_client_create_context(&ctx, pool));
+
+ /* Copy a file into dir 'A', keeping its own basename. */
+ sources = apr_array_make(pool, 1, sizeof(svn_client_copy_source_t *));
+ source.path = svn_path_url_add_component2(repos_url, "iota", pool);
+ source.peg_revision = &head_rev;
+ source.revision = &head_rev;
+ APR_ARRAY_PUSH(sources, svn_client_copy_source_t *) = &source;
+ dest = svn_path_url_add_component2(repos_url, "A", pool);
+ SVN_ERR(svn_client_copy6(sources, dest, TRUE /* copy_as_child */,
+ FALSE /* make_parents */,
+ FALSE /* ignore_externals */,
+ NULL, NULL, NULL, ctx, pool));
+
+ /* Test: YCA(iota@2, A/iota@2) is iota@1. */
+ SVN_ERR(svn_client__get_youngest_common_ancestor(
+ &yc_ancestor,
+ svn_client__pathrev_create_with_relpath(
+ repos_url, repos_uuid, 2, "iota", pool),
+ svn_client__pathrev_create_with_relpath(
+ repos_url, repos_uuid, 2, "A/iota", pool),
+ ctx, pool, pool));
+ SVN_TEST_STRING_ASSERT(svn_client__pathrev_relpath(yc_ancestor, pool),
+ "iota");
+ SVN_TEST_ASSERT(yc_ancestor->rev == 1);
+
+ /* Copy the root directory (at revision 0) into A as 'ROOT'. */
+ sources = apr_array_make(pool, 1, sizeof(svn_client_copy_source_t *));
+ source.path = repos_url;
+ source.peg_revision = &zero_rev;
+ source.revision = &zero_rev;
+ APR_ARRAY_PUSH(sources, svn_client_copy_source_t *) = &source;
+ dest = svn_path_url_add_component2(repos_url, "A/ROOT", pool);
+ SVN_ERR(svn_client_copy6(sources, dest, FALSE /* copy_as_child */,
+ FALSE /* make_parents */,
+ FALSE /* ignore_externals */,
+ NULL, NULL, NULL, ctx, pool));
+
+ /* Test: YCA(''@0, A/ROOT@3) is ''@0 (handled as a special case). */
+ SVN_ERR(svn_client__get_youngest_common_ancestor(
+ &yc_ancestor,
+ svn_client__pathrev_create_with_relpath(
+ repos_url, repos_uuid, 0, "", pool),
+ svn_client__pathrev_create_with_relpath(
+ repos_url, repos_uuid, 3, "A/ROOT", pool),
+ ctx, pool, pool));
+ SVN_TEST_STRING_ASSERT(svn_client__pathrev_relpath(yc_ancestor, pool), "");
+ SVN_TEST_ASSERT(yc_ancestor->rev == 0);
+
+ return SVN_NO_ERROR;
+}
+
+
/* ========================================================================== */
struct svn_test_descriptor_t test_funcs[] =
@@ -663,5 +736,6 @@ struct svn_test_descriptor_t test_funcs[
#ifdef TEST16K_ADD
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_NULL
};
Modified: subversion/branches/javahl-ra/subversion/tests/libsvn_delta/random-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/libsvn_delta/random-test.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/libsvn_delta/random-test.c (original)
+++ subversion/branches/javahl-ra/subversion/tests/libsvn_delta/random-test.c Mon Apr 23 12:32:48 2012
@@ -57,7 +57,7 @@ static void init_params(apr_uint32_t *se
apr_uint32_t *maxlen, int *iterations,
int *dump_files, int *print_windows,
const char **random_bytes,
- apr_uint32_t *bytes_range,
+ apr_size_t *bytes_range,
apr_pool_t *pool)
{
apr_getopt_t *opt;
@@ -80,7 +80,7 @@ static void init_params(apr_uint32_t *se
switch (optch)
{
case 's':
- *seed = atol(opt_arg);
+ *seed = (apr_uint32_t) atol(opt_arg);
break;
case 'l':
*maxlen = atoi(opt_arg);
@@ -160,7 +160,7 @@ generate_random_file(apr_uint32_t maxlen
apr_uint32_t subseed_base,
apr_uint32_t *seed,
const char *random_bytes,
- apr_uint32_t bytes_range,
+ apr_size_t bytes_range,
int dump_files,
apr_pool_t *pool)
{
@@ -287,7 +287,8 @@ copy_tempfile(apr_file_t *fp, apr_pool_t
static svn_error_t *
random_test(apr_pool_t *pool)
{
- apr_uint32_t seed, bytes_range, maxlen;
+ apr_uint32_t seed, maxlen;
+ apr_size_t bytes_range;
int i, iterations, dump_files, print_windows;
const char *random_bytes;
@@ -365,7 +366,8 @@ static svn_error_t *
do_random_combine_test(apr_pool_t *pool,
apr_uint32_t *last_seed)
{
- apr_uint32_t seed, bytes_range, maxlen;
+ apr_uint32_t seed, maxlen;
+ apr_size_t bytes_range;
int i, iterations, dump_files, print_windows;
const char *random_bytes;
Modified: subversion/branches/javahl-ra/subversion/tests/libsvn_delta/window-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/libsvn_delta/window-test.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/libsvn_delta/window-test.c (original)
+++ subversion/branches/javahl-ra/subversion/tests/libsvn_delta/window-test.c Mon Apr 23 12:32:48 2012
@@ -29,6 +29,7 @@
#include "svn_error.h"
#include "svn_delta.h"
+#include "private/svn_subr_private.h"
static svn_error_t *
stream_window_test(apr_pool_t *pool)
@@ -82,8 +83,8 @@ stream_window_test(apr_pool_t *pool)
/* ### examine the window */
}
- actual = svn_checksum__from_digest(svn_txdelta_md5_digest(txstream),
- svn_checksum_md5, pool);
+ actual = svn_checksum__from_digest_md5(svn_txdelta_md5_digest(txstream),
+ pool);
printf(" actual: %s\n", svn_checksum_to_cstring(actual, pool));
if (!svn_checksum_match(expected, actual))
Modified: subversion/branches/javahl-ra/subversion/tests/libsvn_diff/diff-diff3-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/libsvn_diff/diff-diff3-test.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/libsvn_diff/diff-diff3-test.c (original)
+++ subversion/branches/javahl-ra/subversion/tests/libsvn_diff/diff-diff3-test.c Mon Apr 23 12:32:48 2012
@@ -2394,7 +2394,40 @@ merge_adjacent_changes(apr_pool_t *pool)
return SVN_NO_ERROR;
}
+/* Issue #4133, '"diff -x -w" showing wrong change'.
+ The magic number used in this test, 1<<17, is
+ CHUNK_SIZE from ../../libsvn_diff/diff_file.c
+ */
+static svn_error_t *
+test_wrap(apr_pool_t *pool)
+{
+ char ldata[(1<<17) + 4+4+3+1];
+ char rdata[(1<<17) + 4+3+3+1];
+ svn_string_t left, right;
+ svn_diff_file_options_t *diff_opts = svn_diff_file_options_create(pool);
+ diff_opts->ignore_space = TRUE;
+ /* Two long lines. */
+ memset(ldata, '@', 1<<17);
+ memset(rdata, '@', 1<<17);
+ strcpy(&ldata[1<<17], "foo\n" "ba \n" "x \n");
+ strcpy(&rdata[1<<17], "foo\n" "ba\n" "x\t\n");
+
+ /* Cast them to svn_string_t. */
+ left.data = ldata;
+ right.data = rdata;
+ left.len = sizeof(ldata)-1;
+ right.len = sizeof(rdata)-1;
+
+ /* Diff them. Modulo whitespace, they are identical. */
+ {
+ svn_diff_t *diff;
+ SVN_ERR(svn_diff_mem_string_diff(&diff, &left, &right, diff_opts, pool));
+ SVN_TEST_ASSERT(FALSE == svn_diff_contains_diffs(diff));
+ }
+
+ return SVN_NO_ERROR;
+}
/* ========================================================================== */
@@ -2425,5 +2458,7 @@ struct svn_test_descriptor_t test_funcs[
"3-way merge with conflict styles"),
SVN_TEST_PASS2(test_diff4,
"4-way merge; see variance-adjusted-patching.html"),
+ SVN_TEST_XFAIL2(test_wrap,
+ "difference at the start of a 128KB window"),
SVN_TEST_NULL
};
Modified: subversion/branches/javahl-ra/subversion/tests/libsvn_diff/parse-diff-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/libsvn_diff/parse-diff-test.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/libsvn_diff/parse-diff-test.c (original)
+++ subversion/branches/javahl-ra/subversion/tests/libsvn_diff/parse-diff-test.c Mon Apr 23 12:32:48 2012
@@ -314,7 +314,8 @@ check_content(svn_diff_hunk_t *hunk, svn
SVN_TEST_STRING_ASSERT(exp_buf->data, hunk_buf->data);
}
- SVN_TEST_ASSERT(hunk_buf->len == 0);
+ if (!hunk_eof)
+ SVN_TEST_ASSERT(hunk_buf->len == 0);
return SVN_NO_ERROR;
}
@@ -946,11 +947,9 @@ test_parse_unidiff_lacking_trailing_eol(
"This is the file 'gamma'." NL,
pool));
- /* Verify that the contents are as expected, with a NL appended.
- TODO: test for notification about the NL silently appended */
SVN_ERR(check_content(hunk, reverse,
"This is the file 'gamma'." NL
- "some more bytes to 'gamma'" NL,
+ "some more bytes to 'gamma'",
pool));
reverse = !reverse;
@@ -981,7 +980,7 @@ struct svn_test_descriptor_t test_funcs[
"test property diffs with odd symbols"),
SVN_TEST_PASS2(test_git_diffs_with_spaces_diff,
"test git diffs with spaces in paths"),
- SVN_TEST_XFAIL2(test_parse_unidiff_lacking_trailing_eol,
+ SVN_TEST_PASS2(test_parse_unidiff_lacking_trailing_eol,
"test parsing unidiffs lacking trailing eol"),
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=1329209&r1=1329208&r2=1329209&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 Mon Apr 23 12:32:48 2012
@@ -3529,7 +3529,7 @@ get_file_checksum(svn_checksum_t **check
/* Return a pseudo-random number in the range [0,SCALAR) i.e. return
a number N such that 0 <= N < SCALAR */
-static int my_rand(int scalar, apr_uint32_t *seed)
+static int my_rand(apr_uint64_t scalar, apr_uint32_t *seed)
{
static const apr_uint32_t TEST_RAND_MAX = 0xffffffffUL;
/* Assumes TEST_RAND_MAX+1 can be exactly represented in a double */
@@ -3555,7 +3555,7 @@ random_data_to_buffer(char *buf,
int ds_off = 0;
const char *dataset = "0123456789";
- int dataset_size = strlen(dataset);
+ apr_size_t dataset_size = strlen(dataset);
if (full)
{
Modified: subversion/branches/javahl-ra/subversion/tests/libsvn_fs/locks-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/libsvn_fs/locks-test.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/libsvn_fs/locks-test.c (original)
+++ subversion/branches/javahl-ra/subversion/tests/libsvn_fs/locks-test.c Mon Apr 23 12:32:48 2012
@@ -358,6 +358,18 @@ get_locks(const svn_test_opts_t *opts,
num_expected_paths, pool));
}
+ /* A path that is longer and alphabetically earlier than some locked
+ paths, this exercises the r1205848 BDB lock code. */
+ {
+ static const char *expected_paths[] = { 0 };
+ num_expected_paths = 0;
+ get_locks_baton = make_get_locks_baton(pool);
+ SVN_ERR(svn_fs_get_locks(fs, "A/D/H/ABCDEFGHIJKLMNOPQR", get_locks_callback,
+ get_locks_baton, pool));
+ SVN_ERR(verify_matching_lock_paths(get_locks_baton, expected_paths,
+ num_expected_paths, pool));
+ }
+
return SVN_NO_ERROR;
}
Modified: subversion/branches/javahl-ra/subversion/tests/libsvn_ra_local/ra-local-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/libsvn_ra_local/ra-local-test.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/libsvn_ra_local/ra-local-test.c (original)
+++ subversion/branches/javahl-ra/subversion/tests/libsvn_ra_local/ra-local-test.c Mon Apr 23 12:32:48 2012
@@ -125,7 +125,7 @@ try_split_url(const char *url, apr_pool_
err = svn_ra_local__split_URL(&repos, &repos_path, &fs_path, url, pool);
if (! err)
- return SVN_NO_ERROR;
+ return APR_SUCCESS;
apr_err = err->apr_err;
svn_error_clear(err);
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=1329209&r1=1329208&r2=1329209&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 Mon Apr 23 12:32:48 2012
@@ -1318,9 +1318,8 @@ authz(apr_pool_t *pool)
contents =
"[greek:/dir2//secret]" NL
"* =" NL;
- err = authz_get_handle(&authz_cfg, contents, subpool);
- SVN_TEST_ASSERT_ERROR(err, SVN_ERR_AUTHZ_INVALID_CONFIG);
- svn_error_clear(err);
+ SVN_TEST_ASSERT_ERROR(authz_get_handle(&authz_cfg, contents, subpool),
+ SVN_ERR_AUTHZ_INVALID_CONFIG);
/* That's a wrap! */
svn_pool_destroy(subpool);
@@ -1480,10 +1479,7 @@ test_path_authz(svn_repos_t *repos,
/* Check for potential errors. */
if (path_action->authz_error_expected)
- {
- SVN_TEST_ASSERT_ERROR(err, SVN_ERR_AUTHZ_UNWRITABLE);
- svn_error_clear(err);
- }
+ SVN_TEST_ASSERT_ERROR(err, SVN_ERR_AUTHZ_UNWRITABLE);
else
SVN_ERR(err);
@@ -2521,6 +2517,45 @@ test_get_file_revs(const svn_test_opts_t
return SVN_NO_ERROR;
}
+static svn_error_t *
+issue_4060(const svn_test_opts_t *opts,
+ apr_pool_t *pool)
+{
+ apr_pool_t *subpool = svn_pool_create(pool);
+ svn_authz_t *authz_cfg;
+ svn_boolean_t allowed;
+ const char *authz_contents =
+ "[/A/B]" NL
+ "ozymandias = rw" NL
+ "[/]" NL
+ "ozymandias = r" NL
+ "" NL;
+
+ SVN_ERR(authz_get_handle(&authz_cfg, authz_contents, subpool));
+
+ SVN_ERR(svn_repos_authz_check_access(authz_cfg, "babylon",
+ "/A/B/C", "ozymandias",
+ svn_authz_write | svn_authz_recursive,
+ &allowed, subpool));
+ SVN_TEST_ASSERT(allowed);
+
+ SVN_ERR(svn_repos_authz_check_access(authz_cfg, "",
+ "/A/B/C", "ozymandias",
+ svn_authz_write | svn_authz_recursive,
+ &allowed, subpool));
+ SVN_TEST_ASSERT(allowed);
+
+ SVN_ERR(svn_repos_authz_check_access(authz_cfg, NULL,
+ "/A/B/C", "ozymandias",
+ svn_authz_write | svn_authz_recursive,
+ &allowed, subpool));
+ SVN_TEST_ASSERT(allowed);
+
+ svn_pool_destroy(subpool);
+
+ return SVN_NO_ERROR;
+}
+
/* The test table. */
@@ -2555,5 +2590,7 @@ struct svn_test_descriptor_t test_funcs[
"test svn_repos_get_logs ranges and limits"),
SVN_TEST_OPTS_PASS(test_get_file_revs,
"test svn_repos_get_file_revsN"),
+ SVN_TEST_OPTS_PASS(issue_4060,
+ "test issue 4060"),
SVN_TEST_NULL
};
Propchange: subversion/branches/javahl-ra/subversion/tests/libsvn_subr/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Apr 23 12:32:48 2012
@@ -11,6 +11,7 @@ Release
checksum-test
compat-test
config-test
+crypto-test
error-test
hashdump-test
hashdump.out
@@ -35,3 +36,5 @@ auth-test
eol-test
subst_translate-test
spillbuf-test
+named_atomic-test
+named_atomic-proc-test
Modified: subversion/branches/javahl-ra/subversion/tests/libsvn_subr/cache-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/libsvn_subr/cache-test.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/libsvn_subr/cache-test.c (original)
+++ subversion/branches/javahl-ra/subversion/tests/libsvn_subr/cache-test.c Mon Apr 23 12:32:48 2012
@@ -36,7 +36,7 @@
/* Implements svn_cache__serialize_func_t */
static svn_error_t *
-serialize_revnum(char **data,
+serialize_revnum(void **data,
apr_size_t *data_len,
void *in,
apr_pool_t *pool)
@@ -51,7 +51,7 @@ serialize_revnum(char **data,
/* Implements svn_cache__deserialize_func_t */
static svn_error_t *
deserialize_revnum(void **out,
- char *data,
+ void *data,
apr_size_t data_len,
apr_pool_t *pool)
{
@@ -193,6 +193,7 @@ test_membuffer_cache_basic(apr_pool_t *p
deserialize_revnum,
APR_HASH_KEY_STRING,
"cache:",
+ FALSE,
pool));
return basic_cache_test(cache, FALSE, pool);
Modified: subversion/branches/javahl-ra/subversion/tests/libsvn_subr/checksum-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/libsvn_subr/checksum-test.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/libsvn_subr/checksum-test.c (original)
+++ subversion/branches/javahl-ra/subversion/tests/libsvn_subr/checksum-test.c Mon Apr 23 12:32:48 2012
@@ -59,11 +59,34 @@ test_checksum_parse(apr_pool_t *pool)
return SVN_NO_ERROR;
}
+static svn_error_t *
+test_checksum_empty(apr_pool_t *pool)
+{
+ svn_checksum_t *checksum;
+ char data = '\0';
+
+ checksum = svn_checksum_empty_checksum(svn_checksum_md5, pool);
+ SVN_TEST_ASSERT(svn_checksum_is_empty_checksum(checksum));
+
+ checksum = svn_checksum_empty_checksum(svn_checksum_sha1, pool);
+ SVN_TEST_ASSERT(svn_checksum_is_empty_checksum(checksum));
+
+ SVN_ERR(svn_checksum(&checksum, svn_checksum_md5, &data, 0, pool));
+ SVN_TEST_ASSERT(svn_checksum_is_empty_checksum(checksum));
+
+ SVN_ERR(svn_checksum(&checksum, svn_checksum_sha1, &data, 0, pool));
+ SVN_TEST_ASSERT(svn_checksum_is_empty_checksum(checksum));
+
+ return SVN_NO_ERROR;
+}
+
/* An array of all test functions */
struct svn_test_descriptor_t test_funcs[] =
{
SVN_TEST_NULL,
SVN_TEST_PASS2(test_checksum_parse,
"checksum parse"),
+ SVN_TEST_PASS2(test_checksum_empty,
+ "checksum emptiness"),
SVN_TEST_NULL
};
Modified: subversion/branches/javahl-ra/subversion/tests/libsvn_subr/config-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/libsvn_subr/config-test.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/libsvn_subr/config-test.c (original)
+++ subversion/branches/javahl-ra/subversion/tests/libsvn_subr/config-test.c Mon Apr 23 12:32:48 2012
@@ -211,7 +211,7 @@ test_boolean_retrieval(apr_pool_t *pool)
}
static svn_error_t *
-test_has_section(apr_pool_t *pool)
+test_has_section_case_insensitive(apr_pool_t *pool)
{
svn_config_t *cfg;
const char *cfg_file;
@@ -225,12 +225,50 @@ test_has_section(apr_pool_t *pool)
if (! svn_config_has_section(cfg, "section1"))
return fail(pool, "Failed to find section1");
+ if (! svn_config_has_section(cfg, "SECTION1"))
+ return fail(pool, "Failed to find SECTION1");
+
+ if (! svn_config_has_section(cfg, "UpperCaseSection"))
+ return fail(pool, "Failed to find UpperCaseSection");
+
+ if (! svn_config_has_section(cfg, "uppercasesection"))
+ return fail(pool, "Failed to find UpperCaseSection");
+
if (svn_config_has_section(cfg, "notthere"))
return fail(pool, "Returned true on missing section");
return SVN_NO_ERROR;
}
+static svn_error_t *
+test_has_section_case_sensitive(apr_pool_t *pool)
+{
+ svn_config_t *cfg;
+ const char *cfg_file;
+
+ if (!srcdir)
+ SVN_ERR(init_params(pool));
+
+ cfg_file = apr_pstrcat(pool, srcdir, "/", "config-test.cfg", (char *)NULL);
+ SVN_ERR(svn_config_read2(&cfg, cfg_file, TRUE, TRUE, pool));
+
+ if (! svn_config_has_section(cfg, "section1"))
+ return fail(pool, "Failed to find section1");
+
+ if (svn_config_has_section(cfg, "SECTION1"))
+ return fail(pool, "Returned true on missing section");
+
+ if (! svn_config_has_section(cfg, "UpperCaseSection"))
+ return fail(pool, "Failed to find UpperCaseSection");
+
+ if (svn_config_has_section(cfg, "uppercasesection"))
+ return fail(pool, "Returned true on missing section");
+
+ if (svn_config_has_section(cfg, "notthere"))
+ return fail(pool, "Returned true on missing section");
+
+ return SVN_NO_ERROR;
+}
/*
====================================================================
If you add a new test to this file, update this array.
@@ -246,7 +284,9 @@ struct svn_test_descriptor_t test_funcs[
"test svn_config"),
SVN_TEST_PASS2(test_boolean_retrieval,
"test svn_config boolean conversion"),
- SVN_TEST_PASS2(test_has_section,
- "test svn_config_has_section"),
+ SVN_TEST_PASS2(test_has_section_case_insensitive,
+ "test svn_config_has_section (case insensitive)"),
+ SVN_TEST_PASS2(test_has_section_case_sensitive,
+ "test svn_config_has_section (case sensitive)"),
SVN_TEST_NULL
};
Modified: subversion/branches/javahl-ra/subversion/tests/libsvn_subr/config-test.cfg
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/libsvn_subr/config-test.cfg?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/libsvn_subr/config-test.cfg (original)
+++ subversion/branches/javahl-ra/subversion/tests/libsvn_subr/config-test.cfg Mon Apr 23 12:32:48 2012
@@ -41,6 +41,9 @@ h= %(unterminated
# Multiple expansions
i=%(a)s %(b)s
+[UpperCaseSection]
+a=Aa
+
[booleans]
true1 = true
true2 = Yes
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=1329209&r1=1329208&r2=1329209&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 Mon Apr 23 12:32:48 2012
@@ -33,42 +33,55 @@ static const char basic_data[] = ("abcde
"0123456789");
+/* Validate that BUF is STARTING_SIZE in length. Then read some data from
+ the buffer, which should match EXPECTED. The EXPECTED value must be
+ NUL-terminated, but the NUL is not part of the expected/verified value. */
+#define CHECK_READ(b, s, e, p) SVN_ERR(check_read(b, s, e, p))
+static svn_error_t *
+check_read(svn_spillbuf_t *buf,
+ svn_filesize_t starting_size,
+ const char *expected,
+ apr_pool_t *scratch_pool)
+{
+ apr_size_t expected_len = strlen(expected);
+ const char *readptr;
+ apr_size_t readlen;
+
+ SVN_TEST_ASSERT(svn_spillbuf__get_size(buf) == starting_size);
+ SVN_ERR(svn_spillbuf__read(&readptr, &readlen, buf, scratch_pool));
+ SVN_TEST_ASSERT(readptr != NULL
+ && readlen == expected_len
+ && memcmp(readptr, expected, expected_len) == 0);
+ return SVN_NO_ERROR;
+}
+
+
static svn_error_t *
test_spillbuf_basic(apr_pool_t *pool)
{
- svn_spillbuf_t *buf = svn_spillbuf__create(
- sizeof(basic_data) /* blocksize */,
- 10 * sizeof(basic_data) /* maxsize */,
- pool);
+ apr_size_t len = strlen(basic_data); /* Don't include basic_data's NUL */
+ svn_spillbuf_t *buf = svn_spillbuf__create(len, 10 * len, pool);
int i;
+ const char *readptr;
+ apr_size_t readlen;
/* It starts empty. */
SVN_TEST_ASSERT(svn_spillbuf__get_size(buf) == 0);
/* Place enough data into the buffer to cause a spill to disk. */
for (i = 20; i--; )
- SVN_ERR(svn_spillbuf__write(buf, basic_data, sizeof(basic_data), pool));
+ SVN_ERR(svn_spillbuf__write(buf, basic_data, len, pool));
/* And now has content. */
SVN_TEST_ASSERT(svn_spillbuf__get_size(buf) > 0);
- while (TRUE)
- {
- const char *readptr;
- apr_size_t readlen;
-
- SVN_ERR(svn_spillbuf__read(&readptr, &readlen, buf, pool));
- if (readptr == NULL)
- break;
-
- /* We happen to know that the spill buffer reads data in lengths
- of BLOCKSIZE. */
- SVN_TEST_ASSERT(readlen == sizeof(basic_data));
-
- /* And it should match each block of data we put in. */
- SVN_TEST_ASSERT(memcmp(readptr, basic_data, readlen) == 0);
- }
+ /* Verify that we can read 20 copies of basic_data from the buffer. */
+ for (i = 20; i--; )
+ CHECK_READ(buf, (i + 1) * len, basic_data, pool);
+ /* And after precisely 20 reads, it should be empty. */
+ SVN_ERR(svn_spillbuf__read(&readptr, &readlen, buf, pool));
+ SVN_TEST_ASSERT(readptr == NULL);
SVN_TEST_ASSERT(svn_spillbuf__get_size(buf) == 0);
return SVN_NO_ERROR;
@@ -112,7 +125,7 @@ test_spillbuf_callback(apr_pool_t *pool)
SVN_ERR(svn_spillbuf__process(&exhausted, buf, read_callback, &counter,
pool));
SVN_TEST_ASSERT(!exhausted);
-
+
SVN_ERR(svn_spillbuf__process(&exhausted, buf, read_callback, &counter,
pool));
SVN_TEST_ASSERT(exhausted);
@@ -132,7 +145,7 @@ test_spillbuf_file(apr_pool_t *pool)
int i;
const char *readptr;
apr_size_t readlen;
- int cur_index;
+ apr_size_t cur_index;
/* Place enough data into the buffer to cause a spill to disk. Note that
we are writing data that is *smaller* than the blocksize. */
@@ -197,48 +210,29 @@ test_spillbuf_interleaving(apr_pool_t *p
svn_spillbuf_t *buf = svn_spillbuf__create(8 /* blocksize */,
15 /* maxsize */,
pool);
- const char *readptr;
- apr_size_t readlen;
SVN_ERR(svn_spillbuf__write(buf, "abcdef", 6, pool));
SVN_ERR(svn_spillbuf__write(buf, "ghijkl", 6, pool));
- /* now: two blocks of 8 and 4 bytes */
+ /* now: two blocks: 8 and 4 bytes */
- SVN_ERR(svn_spillbuf__read(&readptr, &readlen, buf, pool));
- SVN_TEST_ASSERT(readptr != NULL
- && readlen == 8
- && memcmp(readptr, "abcdefgh", 8) == 0);
- /* now: one block of 4 bytes */
+ CHECK_READ(buf, 12, "abcdefgh", pool);
+ /* now: one block: 4 bytes */
SVN_ERR(svn_spillbuf__write(buf, "mnopqr", 6, pool));
- /* now: two blocks of 8 and 2 bytes */
+ /* now: two blocks: 8 and 2 bytes */
- SVN_ERR(svn_spillbuf__read(&readptr, &readlen, buf, pool));
- SVN_TEST_ASSERT(readptr != NULL
- && readlen == 8
- && memcmp(readptr, "ijklmnop", 8) == 0);
- /* now: one block of 2 bytes */
+ CHECK_READ(buf, 10, "ijklmnop", pool);
+ /* now: one block: 2 bytes */
SVN_ERR(svn_spillbuf__write(buf, "stuvwx", 6, pool));
SVN_ERR(svn_spillbuf__write(buf, "ABCDEF", 6, pool));
SVN_ERR(svn_spillbuf__write(buf, "GHIJKL", 6, pool));
- /* now: two blocks of 8 and 6 bytes, and 6 bytes spilled to a file */
+ /* now: two blocks: 8 and 6 bytes, and 6 bytes spilled to a file */
+
+ CHECK_READ(buf, 20, "qrstuvwx", pool);
+ CHECK_READ(buf, 12, "ABCDEF", pool);
+ CHECK_READ(buf, 6, "GHIJKL", pool);
- SVN_TEST_ASSERT(svn_spillbuf__get_size(buf) > 0);
- SVN_ERR(svn_spillbuf__read(&readptr, &readlen, buf, pool));
- SVN_TEST_ASSERT(readptr != NULL
- && readlen == 8
- && memcmp(readptr, "qrstuvwx", 8) == 0);
- SVN_TEST_ASSERT(svn_spillbuf__get_size(buf) > 0);
- SVN_ERR(svn_spillbuf__read(&readptr, &readlen, buf, pool));
- SVN_TEST_ASSERT(readptr != NULL
- && readlen == 6
- && memcmp(readptr, "ABCDEF", 6) == 0);
- SVN_TEST_ASSERT(svn_spillbuf__get_size(buf) > 0);
- SVN_ERR(svn_spillbuf__read(&readptr, &readlen, buf, pool));
- SVN_TEST_ASSERT(readptr != NULL
- && readlen == 6
- && memcmp(readptr, "GHIJKL", 6) == 0);
SVN_TEST_ASSERT(svn_spillbuf__get_size(buf) == 0);
return SVN_NO_ERROR;
@@ -277,6 +271,151 @@ test_spillbuf_reader(apr_pool_t *pool)
}
+static svn_error_t *
+test_spillbuf_stream(apr_pool_t *pool)
+{
+ svn_stream_t *stream = svn_stream__from_spillbuf(8 /* blocksize */,
+ 15 /* maxsize */,
+ pool);
+ char readbuf[256];
+ apr_size_t readlen;
+ apr_size_t writelen;
+
+ writelen = 6;
+ SVN_ERR(svn_stream_write(stream, "abcdef", &writelen));
+ SVN_ERR(svn_stream_write(stream, "ghijkl", &writelen));
+ /* now: two blocks: 8 and 4 bytes */
+
+ readlen = 8;
+ SVN_ERR(svn_stream_read(stream, readbuf, &readlen));
+ SVN_TEST_ASSERT(readlen == 8
+ && memcmp(readbuf, "abcdefgh", 8) == 0);
+ /* now: one block: 4 bytes */
+
+ SVN_ERR(svn_stream_write(stream, "mnopqr", &writelen));
+ /* now: two blocks: 8 and 2 bytes */
+
+ SVN_ERR(svn_stream_read(stream, readbuf, &readlen));
+ SVN_TEST_ASSERT(readlen == 8
+ && memcmp(readbuf, "ijklmnop", 8) == 0);
+ /* now: one block: 2 bytes */
+
+ SVN_ERR(svn_stream_write(stream, "stuvwx", &writelen));
+ SVN_ERR(svn_stream_write(stream, "ABCDEF", &writelen));
+ SVN_ERR(svn_stream_write(stream, "GHIJKL", &writelen));
+ /* now: two blocks: 8 and 6 bytes, and 6 bytes spilled to a file */
+
+ SVN_ERR(svn_stream_read(stream, readbuf, &readlen));
+ SVN_TEST_ASSERT(readlen == 8
+ && memcmp(readbuf, "qrstuvwx", 8) == 0);
+ readlen = 6;
+ SVN_ERR(svn_stream_read(stream, readbuf, &readlen));
+ SVN_TEST_ASSERT(readlen == 6
+ && memcmp(readbuf, "ABCDEF", 6) == 0);
+ SVN_ERR(svn_stream_read(stream, readbuf, &readlen));
+ SVN_TEST_ASSERT(readlen == 6
+ && memcmp(readbuf, "GHIJKL", 6) == 0);
+
+ return SVN_NO_ERROR;
+}
+
+
+static svn_error_t *
+test_spillbuf_rwfile(apr_pool_t *pool)
+{
+ svn_spillbuf_t *buf = svn_spillbuf__create(4 /* blocksize */,
+ 10 /* maxsize */,
+ pool);
+
+ SVN_ERR(svn_spillbuf__write(buf, "abcdef", 6, pool));
+ SVN_ERR(svn_spillbuf__write(buf, "ghijkl", 6, pool));
+ SVN_ERR(svn_spillbuf__write(buf, "mnopqr", 6, pool));
+ /* now: two blocks: 4 and 2 bytes, and 12 bytes in spill file. */
+
+ CHECK_READ(buf, 18, "abcd", pool);
+ /* now: one block: 2 bytes, and 12 bytes in spill file. */
+
+ CHECK_READ(buf, 14, "ef", pool);
+ /* now: no blocks, and 12 bytes in spill file. */
+
+ CHECK_READ(buf, 12, "ghij", pool);
+ /* now: no blocks, and 8 bytes in spill file. */
+
+ /* Write more data. It should be appended to the spill file. */
+ SVN_ERR(svn_spillbuf__write(buf, "stuvwx", 6, pool));
+ /* now: no blocks, and 14 bytes in spill file. */
+
+ CHECK_READ(buf, 14, "klmn", pool);
+ /* now: no blocks, and 10 bytes in spill file. */
+
+ CHECK_READ(buf, 10, "opqr", pool);
+ /* now: no blocks, and 6 bytes in spill file. */
+
+ CHECK_READ(buf, 6, "stuv", pool);
+ /* now: no blocks, and 2 bytes in spill file. */
+
+ CHECK_READ(buf, 2, "wx", pool);
+ /* now: no blocks, and no spill file. */
+
+ return SVN_NO_ERROR;
+}
+
+
+static svn_error_t *
+test_spillbuf_eof(apr_pool_t *pool)
+{
+ svn_spillbuf_t *buf = svn_spillbuf__create(4 /* blocksize */,
+ 10 /* maxsize */,
+ pool);
+
+ SVN_ERR(svn_spillbuf__write(buf, "abcdef", 6, pool));
+ SVN_ERR(svn_spillbuf__write(buf, "ghijkl", 6, pool));
+ /* now: two blocks: 4 and 2 bytes, and 6 bytes in spill file. */
+
+ CHECK_READ(buf, 12, "abcd", pool);
+ CHECK_READ(buf, 8, "ef", pool);
+ CHECK_READ(buf, 6, "ghij", pool);
+ CHECK_READ(buf, 2, "kl", pool);
+ /* The spill file should have been emptied and forgotten. */
+
+ /* Assuming the spill file has been forgotten, this should result in
+ precisely the same behavior. Specifically: the initial write should
+ create two blocks, and the second write should be spilled. If there
+ *was* a spill file, then this written data would go into the file. */
+ SVN_ERR(svn_spillbuf__write(buf, "abcdef", 6, pool));
+ SVN_ERR(svn_spillbuf__write(buf, "ghijkl", 6, pool));
+ CHECK_READ(buf, 12, "abcd", pool);
+ CHECK_READ(buf, 8, "ef", pool);
+ CHECK_READ(buf, 6, "ghij", pool);
+ CHECK_READ(buf, 2, "kl", pool);
+ /* The spill file should have been emptied and forgotten. */
+
+ /* Now, let's do a sequence where we arrange to hit EOF precisely on
+ a block-sized read. Note: the second write must be more than 4 bytes,
+ or it will not cause a spill. We use 8 to get the right boundary. */
+ SVN_ERR(svn_spillbuf__write(buf, "abcdef", 6, pool));
+ SVN_ERR(svn_spillbuf__write(buf, "ghijklmn", 8, pool));
+ CHECK_READ(buf, 14, "abcd", pool);
+ CHECK_READ(buf, 10, "ef", pool);
+ CHECK_READ(buf, 8, "ghij", pool);
+ CHECK_READ(buf, 4, "klmn", pool);
+ /* We discard the spill file when we know it has no data, rather than
+ upon hitting EOF (upon a read attempt). Thus, the spill file should
+ be gone. */
+
+ /* Verify the forgotten spill file. */
+ SVN_ERR(svn_spillbuf__write(buf, "abcdef", 6, pool));
+ SVN_ERR(svn_spillbuf__write(buf, "ghijkl", 6, pool));
+ CHECK_READ(buf, 12, "abcd", pool);
+ CHECK_READ(buf, 8, "ef", pool);
+ CHECK_READ(buf, 6, "ghij", pool);
+ /* Two unread bytes remaining in the spill file. */
+ SVN_TEST_ASSERT(svn_spillbuf__get_size(buf) == 2);
+
+ return SVN_NO_ERROR;
+}
+
+
/* The test table. */
struct svn_test_descriptor_t test_funcs[] =
{
@@ -287,5 +426,8 @@ struct svn_test_descriptor_t test_funcs[
SVN_TEST_PASS2(test_spillbuf_interleaving,
"interleaving reads and writes"),
SVN_TEST_PASS2(test_spillbuf_reader, "spill buffer reader test"),
+ SVN_TEST_PASS2(test_spillbuf_stream, "spill buffer stream test"),
+ SVN_TEST_PASS2(test_spillbuf_rwfile, "read/write spill file"),
+ SVN_TEST_PASS2(test_spillbuf_eof, "validate reaching EOF of spill file"),
SVN_TEST_NULL
};
Propchange: subversion/branches/javahl-ra/subversion/tests/libsvn_subr/spillbuf-test.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: subversion/branches/javahl-ra/subversion/tests/libsvn_subr/stream-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/tests/libsvn_subr/stream-test.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/tests/libsvn_subr/stream-test.c (original)
+++ subversion/branches/javahl-ra/subversion/tests/libsvn_subr/stream-test.c Mon Apr 23 12:32:48 2012
@@ -568,6 +568,165 @@ test_stream_base64(apr_pool_t *pool)
return SVN_NO_ERROR;
}
+/* This test doesn't test much unless run under valgrind when it
+ triggers the problem reported here:
+
+ http://mail-archives.apache.org/mod_mbox/subversion-dev/201202.mbox/%3C87sjik3m8q.fsf@stat.home.lan%3E
+
+ The two data writes caused the base 64 code to allocate a buffer
+ that was a byte short but exactly matched a stringbuf blocksize.
+ That meant the stringbuf didn't overallocate and a write beyond
+ the end of the buffer occured.
+ */
+static svn_error_t *
+test_stream_base64_2(apr_pool_t *pool)
+{
+ const struct data_t {
+ const char *encoded1;
+ const char *encoded2;
+ } data[] = {
+ {
+ "MTI",
+ "123456789A123456789B123456789C123456789D123456789E"
+ "223456789A123456789B123456789C123456789D123456789E"
+ "323456789A123456789B123456789C123456789D123456789E"
+ "423456789A123456789B123456789C123456789D123456789E"
+ "523456789A123456789B123456789C123456789D123456789E"
+ "623456789A123456789B123456789C123456789D123456789E"
+ "723456789A123456789B123456789C123456789D123456789E"
+ "823456789A123456789B123456789C123456789D123456789E"
+ "923456789A123456789B123456789C123456789D123456789E"
+ "A23456789A123456789B123456789C123456789D123456789E"
+ "123456789A123456789B123456789C123456789D123456789E"
+ "223456789A123456789B123456789C123456789D123456789E"
+ "323456789A123456789B123456789C123456789D123456789E"
+ "423456789A123456789B123456789C123456789D123456789E"
+ "523456789A123456789B123456789C123456789D123456789E"
+ "623456789A123456789B123456789C123456789D123456789E"
+ "723456789A123456789B123456789C123456789D123456789E"
+ "823456789A123456789B123456789C123456789D123456789E"
+ "923456789A123456789B123456789C123456789D123456789E"
+ "B23456789A123456789B123456789C123456789D123456789E"
+ "123456789A123456789B123456789C123456789D123456789E"
+ "223456789A123456789B123456789C123456789D123456789E"
+ "323456789A123456789B123456789C123456789D123456789E"
+ "423456789A123456789B123456789C123456789D123456789E"
+ "523456789A123456789B123456789C123456789D123456789E"
+ "623456789A123456789B123456789C123456789D123456789E"
+ "723456789A123456789B123456789C123456789D123456789E"
+ "823456789A123456789B123456789C123456789D123456789E"
+ "923456789A123456789B123456789C123456789D123456789E"
+ "C23456789A123456789B123456789C123456789D123456789E"
+ "123456789A123456789B123456789C123456789D123456789E"
+ "223456789A123456789B123456789C123456789D123456789E"
+ "323456789A123456789B123456789C123456789D123456789E"
+ "423456789A123456789B123456789C123456789D123456789E"
+ "523456789A123456789B123456789C123456789D123456789E"
+ "623456789A123456789B123456789C123456789D123456789E"
+ "723456789A123456789B123456789C123456789D123456789E"
+ "823456789A123456789B123456789C123456789D123456789E"
+ "923456789A123456789B123456789C123456789D123456789E"
+ "D23456789A123456789B123456789C123456789D123456789E"
+ "123456789A123456789B123456789C123456789D123456789E"
+ "223456789A123456789B123456789C123456789D123456789E"
+ "323456789A123456789B123456789C123456789D123456789E"
+ "423456789A123456789B123456789C123456789D123456789E"
+ "523456789A123456789B123456789C123456789D123456789E"
+ "623456789A123456789B123456789C123456789D123456789E"
+ "723456789A123456789B123456789C123456789D123456789E"
+ "823456789A123456789B123456789C123456789D123456789E"
+ "923456789A123456789B123456789C123456789D123456789E"
+ "E23456789A123456789B123456789C123456789D123456789E"
+ "123456789A123456789B123456789C123456789D123456789E"
+ "223456789A123456789B123456789C123456789D123456789E"
+ "323456789A123456789B123456789C123456789D123456789E"
+ "423456789A123456789B123456789C123456789D123456789E"
+ "523456789A123456789B123456789C123456789D123456789E"
+ "623456789A123456789B123456789C123456789D123456789E"
+ "723456789A123456789B123456789C123456789D123456789E"
+ "823456789A123456789B123456789C123456789D123456789E"
+ "923456789A123456789B123456789C123456789D123456789E"
+ "F23456789A123456789B123456789C123456789D123456789E"
+ "123456789A123456789B123456789C123456789D123456789E"
+ "223456789A123456789B123456789C123456789D123456789E"
+ "323456789A123456789B123456789C123456789D123456789E"
+ "423456789A123456789B123456789C123456789D123456789E"
+ "523456789A123456789B123456789C123456789D123456789E"
+ "623456789A123456789B123456789C123456789D123456789E"
+ "723456789A123456789B123456789C123456789D123456789E"
+ "823456789A123456789B123456789C123456789D123456789E"
+ "923456789A123456789B123456789C123456789D123456789E"
+ "G23456789A123456789B123456789C123456789D123456789E"
+ "123456789A123456789B123456789C123456789D123456789E"
+ "223456789A123456789B123456789C123456789D123456789E"
+ "323456789A123456789B123456789C123456789D123456789E"
+ "423456789A123456789B123456789C123456789D123456789E"
+ "523456789A123456789B123456789C123456789D123456789E"
+ "623456789A123456789B123456789C123456789D123456789E"
+ "723456789A123456789B123456789C123456789D123456789E"
+ "823456789A123456789B123456789C123456789D123456789E"
+ "923456789A123456789B123456789C123456789D123456789E"
+ "H23456789A123456789B123456789C123456789D123456789E"
+ "123456789A123456789B123456789C123456789D123456789E"
+ "223456789A123456789B123456789C123456789D123456789E"
+ "323456789A123456789B123456789C123456789D123456789E"
+ "423456789A123456789B123456789C123456789D123456789E"
+ "523456789A123456789B123456789C123456789D123456789E"
+ "623456789A123456789B123456789C123456789D123456789E"
+ "723456789A123456789B123456789C123456789D123456789E"
+ "823456789A123456789B123456789C123456789D123456789E"
+ "923456789A123456789B123456789C123456789D123456789E"
+ "I23456789A123456789B123456789C123456789D123456789E"
+ "123456789A123456789B123456789C123456789D123456789E"
+ "223456789A123456789B123456789C123456789D123456789E"
+ "323456789A123456789B123456789C123456789D123456789E"
+ "423456789A123456789B123456789C123456789D123456789E"
+ "523456789A123456789B123456789C123456789D123456789E"
+ "623456789A123456789B123456789C123456789D123456789E"
+ "723456789A123456789B123456789C123456789D123456789E"
+ "823456789A123456789B123456789C123456789D123456789E"
+ "923456789A123456789B123456789C123456789D123456789E"
+ "J23456789A123456789B123456789C123456789D123456789E"
+ "123456789A123456789B123456789C123456789D123456789E"
+ "223456789A123456789B123456789C123456789D123456789E"
+ "323456789A123456789B123456789C123456789D123456789E"
+ "423456789A123456789B123456789C123456789D123456789E"
+ "523456789A123456789B123456789C123456789D12345"
+ },
+ {
+ NULL,
+ NULL,
+ },
+ };
+ int i;
+
+ for (i = 0; data[i].encoded1; i++)
+ {
+ apr_size_t len1 = strlen(data[i].encoded1);
+
+ svn_stringbuf_t *actual = svn_stringbuf_create_empty(pool);
+ svn_stringbuf_t *expected = svn_stringbuf_create_empty(pool);
+ svn_stream_t *stream = svn_stream_from_stringbuf(actual, pool);
+
+ stream = svn_base64_encode(stream, pool);
+ stream = svn_base64_decode(stream, pool);
+
+ SVN_ERR(svn_stream_write(stream, data[i].encoded1, &len1));
+ svn_stringbuf_appendbytes(expected, data[i].encoded1, len1);
+
+ if (data[i].encoded2)
+ {
+ apr_size_t len2 = strlen(data[i].encoded2);
+ SVN_ERR(svn_stream_write(stream, data[i].encoded2, &len2));
+ svn_stringbuf_appendbytes(expected, data[i].encoded2, len2);
+ }
+
+ SVN_ERR(svn_stream_close(stream));
+ }
+
+ return SVN_NO_ERROR;
+}
+
/* The test table. */
struct svn_test_descriptor_t test_funcs[] =
@@ -591,5 +750,7 @@ struct svn_test_descriptor_t test_funcs[
"test compressed streams with empty files"),
SVN_TEST_PASS2(test_stream_base64,
"test base64 encoding/decoding streams"),
+ SVN_TEST_PASS2(test_stream_base64_2,
+ "base64 decoding allocation problem"),
SVN_TEST_NULL
};
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=1329209&r1=1329208&r2=1329209&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 Mon Apr 23 12:32:48 2012
@@ -39,7 +39,7 @@
#include "svn_io.h"
#include "svn_error.h"
#include "svn_string.h" /* This includes <apr_*.h> */
-
+#include "private/svn_string_private.h"
/* A quick way to create error messages. */
static svn_error_t *
@@ -511,6 +511,35 @@ test23(apr_pool_t *pool)
return test_stringbuf_unequal("abc", "abb", pool);
}
+static svn_error_t *
+test24(apr_pool_t *pool)
+{
+ char buffer[SVN_INT64_BUFFER_SIZE];
+ apr_size_t length;
+
+ length = svn__i64toa(buffer, 0);
+ SVN_TEST_ASSERT(length == 1);
+ SVN_TEST_STRING_ASSERT(buffer, "0");
+
+ length = svn__i64toa(buffer, -0x8000000000000000ll);
+ SVN_TEST_ASSERT(length == 20);
+ SVN_TEST_STRING_ASSERT(buffer, "-9223372036854775808");
+
+ length = svn__i64toa(buffer, 0x7fffffffffffffffll);
+ SVN_TEST_ASSERT(length == 19);
+ SVN_TEST_STRING_ASSERT(buffer, "9223372036854775807");
+
+ length = svn__ui64toa(buffer, 0);
+ SVN_TEST_ASSERT(length == 1);
+ SVN_TEST_STRING_ASSERT(buffer, "0");
+
+ length = svn__ui64toa(buffer, 0xffffffffffffffffll);
+ SVN_TEST_ASSERT(length == 20);
+ SVN_TEST_STRING_ASSERT(buffer, "18446744073709551615");
+
+ return test_stringbuf_unequal("abc", "abb", pool);
+}
+
/*
====================================================================
If you add a new test to this file, update this array.
@@ -568,5 +597,7 @@ struct svn_test_descriptor_t test_funcs[
"compare stringbufs; different lengths"),
SVN_TEST_PASS2(test23,
"compare stringbufs; same length, different content"),
+ SVN_TEST_PASS2(test24,
+ "verify i64toa"),
SVN_TEST_NULL
};
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=1329209&r1=1329208&r2=1329209&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 Mon Apr 23 12:32:48 2012
@@ -228,8 +228,12 @@ static const char * const TESTING_DATA =
" 1, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 2, " TIME_2s ", '" AUTHOR_2 "',"
" 10, null, null, null);"
"insert into nodes values ("
- " 1, 'moved/file', 0, 'moved', 2, 'moved/file', 2, 'base-deleted',"
- " 0, 'J/J-d', 'file', '()', null, '$sha1$" SHA1_1 "', null, 2, " TIME_2s ", '" AUTHOR_2 "',"
+ " 1, 'moved/file', 0, 'moved', 2, 'moved/file', 2, 'normal',"
+ " 0, null, 'file', '()', null, '$sha1$" SHA1_1 "', null, 2, " TIME_2s ", '" AUTHOR_2 "',"
+ " 10, null, null, null);"
+ "insert into nodes values ("
+ " 1, 'moved/file', 2, 'moved', 2, 'moved/file', 2, 'base-deleted',"
+ " 0, 'J/J-d', 'file', '()', null, null, null, null, null, null,"
" 10, null, null, null);"
"insert into nodes values ("
" 1, 'J/J-e', 1, 'J', null, null, null, 'normal',"
@@ -1053,7 +1057,7 @@ test_scan_deletion(apr_pool_t *pool)
©_op_root_abspath,
db, svn_dirent_join(local_abspath, "J/J-e", pool),
pool, pool));
- SVN_TEST_ASSERT(validate_abspath(local_abspath, "J/J-e",
+ SVN_TEST_ASSERT(validate_abspath(local_abspath, "J",
base_del_abspath, pool));
SVN_TEST_ASSERT(validate_abspath(local_abspath, "other/place",
moved_to_abspath, pool));
@@ -1070,7 +1074,7 @@ test_scan_deletion(apr_pool_t *pool)
©_op_root_abspath,
db, svn_dirent_join(local_abspath, "J/J-e/J-e-a", pool),
pool, pool));
- SVN_TEST_ASSERT(validate_abspath(local_abspath, "J/J-e",
+ SVN_TEST_ASSERT(validate_abspath(local_abspath, "J",
base_del_abspath, pool));
SVN_TEST_ASSERT(validate_abspath(local_abspath, "other/place/J-e-a",
moved_to_abspath, pool));
@@ -1120,7 +1124,7 @@ test_scan_deletion(apr_pool_t *pool)
/* ### I don't understand this. "J/J-e/J-e-b/Jeba" is a deleted
base node that is not overlayed by the replacement rooted at "J".
Why does base_del_abspath refer to "J-e"? */
- SVN_TEST_ASSERT(validate_abspath(local_abspath, "J/J-e",
+ SVN_TEST_ASSERT(validate_abspath(local_abspath, "J",
base_del_abspath, pool));
SVN_TEST_ASSERT(validate_abspath(local_abspath, "other/place/J-e-b/Jeba",
moved_to_abspath, pool));
@@ -1174,7 +1178,7 @@ test_scan_deletion(apr_pool_t *pool)
©_op_root_abspath,
db, svn_dirent_join(local_abspath, "K/K-b", pool),
pool, pool));
- SVN_TEST_ASSERT(validate_abspath(local_abspath, "K/K-b",
+ SVN_TEST_ASSERT(validate_abspath(local_abspath, "K",
base_del_abspath, pool));
SVN_TEST_ASSERT(validate_abspath(local_abspath, "moved/away",
moved_to_abspath, pool));