Modified: subversion/branches/ev2-export/subversion/tests/cmdline/diff_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/cmdline/diff_tests.py?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/tests/cmdline/diff_tests.py (original) +++ subversion/branches/ev2-export/subversion/tests/cmdline/diff_tests.py Thu Apr 12 22:48:32 2012 @@ -26,7 +26,9 @@ ###################################################################### # General modules -import sys, re, os, time, shutil +import sys, re, os, time, shutil, logging + +logger = logging.getLogger() # Our testing module import svntest @@ -45,16 +47,28 @@ Item = svntest.wc.StateItem ###################################################################### # Generate expected output -def make_diff_header(path, old_tag, new_tag): +def make_diff_header(path, old_tag, new_tag, src_label=None, dst_label=None): """Generate the expected diff header for file PATH, with its old and new - versions described in parentheses by OLD_TAG and NEW_TAG. Return the header - as an array of newline-terminated strings.""" + versions described in parentheses by OLD_TAG and NEW_TAG. SRC_LABEL and + DST_LABEL are paths or urls that are added to the diff labels if we're + diffing against the repository or diffing two arbitrary paths. + Return the header as an array of newline-terminated strings.""" + if src_label: + src_label = src_label.replace('\\', '/') + src_label = '\t(.../' + src_label + ')' + else: + src_label = '' + if dst_label: + dst_label = dst_label.replace('\\', '/') + dst_label = '\t(.../' + dst_label + ')' + else: + dst_label = '' path_as_shown = path.replace('\\', '/') return [ "Index: " + path_as_shown + "\n", "===================================================================\n", - "--- " + path_as_shown + "\t(" + old_tag + ")\n", - "+++ " + path_as_shown + "\t(" + new_tag + ")\n", + "--- " + path_as_shown + src_label + "\t(" + old_tag + ")\n", + "+++ " + path_as_shown + dst_label + "\t(" + new_tag + ")\n", ] def make_no_diff_deleted_header(path, old_tag, new_tag): @@ -268,8 +282,8 @@ def verify_excluded_output(diff_output, "verify given line does not exist in diff output as diff line" for line in diff_output: if re.match("^(\\+|-)%s" % re.escape(excluded), line): - print('Sought: %s' % excluded) - print('Found: %s' % line) + logger.warn('Sought: %s' % excluded) + logger.warn('Found: %s' % line) raise svntest.Failure def extract_diff_path(line): @@ -1570,7 +1584,7 @@ def check_for_omitted_prefix_in_path_com good_dest = ".../prefix_other/mytag" if ((src != good_src) or (dest != good_dest)): - print("src is '%s' instead of '%s' and dest is '%s' instead of '%s'" % + logger.warn("src is '%s' instead of '%s' and dest is '%s' instead of '%s'" % (src, good_src, dest, good_dest)) raise svntest.Failure @@ -1768,6 +1782,7 @@ def diff_prop_on_named_dir(sbox): svntest.actions.run_and_verify_svn(None, None, [], 'propdel', 'p', 'A') + svntest.actions.run_and_verify_svn(None, None, [], 'ci', '-m', '') @@ -3760,6 +3775,108 @@ def no_spurious_conflict(sbox): expected_status.tweak('3449_spurious', status=' ') svntest.actions.run_and_verify_status(wc_dir, expected_status) +def diff_two_working_copies(sbox): + "diff between two working copies" + sbox.build() + wc_dir = sbox.wc_dir + + # Create a pristine working copy that will remain mostly unchanged + wc_dir_old = sbox.add_wc_path('old') + svntest.main.run_svn(None, 'co', sbox.repo_url, wc_dir_old) + # Add a property to A/B/F in the pristine working copy + svntest.main.run_svn(None, 'propset', 'newprop', 'propval-old\n', + os.path.join(wc_dir_old, 'A', 'B', 'F')) + + # Make changes to the first working copy: + + # removed nodes + sbox.simple_rm('A/mu') + sbox.simple_rm('A/D/H') + + # new nodes + sbox.simple_mkdir('newdir') + svntest.main.file_append(sbox.ospath('newdir/newfile'), 'new text\n') + sbox.simple_add('newdir/newfile') + sbox.simple_mkdir('newdir/newdir2') # should not show up in the diff + + # modified nodes + sbox.simple_propset('newprop', 'propval', 'A/D') + sbox.simple_propset('newprop', 'propval', 'A/D/gamma') + svntest.main.file_append(sbox.ospath('A/B/lambda'), 'new text\n') + + # replaced nodes (files vs. directories) with property mods + sbox.simple_rm('A/B/F') + svntest.main.file_append(sbox.ospath('A/B/F'), 'new text\n') + sbox.simple_add('A/B/F') + sbox.simple_propset('newprop', 'propval-new\n', 'A/B/F') + sbox.simple_rm('A/D/G/pi') + sbox.simple_mkdir('A/D/G/pi') + sbox.simple_propset('newprop', 'propval', 'A/D/G/pi') + + src_label = os.path.basename(wc_dir_old) + dst_label = os.path.basename(wc_dir) + expected_output = make_diff_header('newdir/newfile', 'working copy', + 'working copy', + src_label, dst_label) + [ + "@@ -0,0 +1 @@\n", + "+new text\n", + ] + make_diff_header('A/mu', 'working copy', + 'working copy', + src_label, dst_label) + [ + "@@ -1 +0,0 @@\n", + "-This is the file 'mu'.\n", + ] + make_diff_header('A/B/F', 'working copy', + 'working copy', + src_label, dst_label) + [ + "@@ -0,0 +1 @@\n", + "+new text\n", + ] + make_diff_prop_header('A/B/F') + \ + make_diff_prop_modified("newprop", "propval-old\n", + "propval-new\n") + \ + make_diff_header('A/B/lambda', 'working copy', + 'working copy', + src_label, dst_label) + [ + "@@ -1 +1,2 @@\n", + " This is the file 'lambda'.\n", + "+new text\n", + ] + make_diff_header('A/D', 'working copy', 'working copy', + src_label, dst_label) + \ + make_diff_prop_header('A/D') + \ + make_diff_prop_added("newprop", "propval") + \ + make_diff_header('A/D/gamma', 'working copy', + 'working copy', + src_label, dst_label) + \ + make_diff_prop_header('A/D/gamma') + \ + make_diff_prop_added("newprop", "propval") + \ + make_diff_header('A/D/G/pi', 'working copy', + 'working copy', + src_label, dst_label) + [ + "@@ -1 +0,0 @@\n", + "-This is the file 'pi'.\n", + ] + make_diff_prop_header('A/D/G/pi') + \ + make_diff_prop_added("newprop", "propval") + \ + make_diff_header('A/D/H/chi', 'working copy', + 'working copy', + src_label, dst_label) + [ + "@@ -1 +0,0 @@\n", + "-This is the file 'chi'.\n", + ] + make_diff_header('A/D/H/omega', 'working copy', + 'working copy', + src_label, dst_label) + [ + "@@ -1 +0,0 @@\n", + "-This is the file 'omega'.\n", + ] + make_diff_header('A/D/H/psi', 'working copy', + 'working copy', + src_label, dst_label) + [ + "@@ -1 +0,0 @@\n", + "-This is the file 'psi'.\n", + ] + + # Files in diff may be in any order. + expected_output = svntest.verify.UnorderedOutput(expected_output) + svntest.actions.run_and_verify_svn(None, expected_output, [], + 'diff', '--old', wc_dir_old, + '--new', wc_dir) ######################################################################## #Run the tests @@ -3828,6 +3945,7 @@ test_list = [ None, diff_abs_localpath_from_wc_folder, no_spurious_conflict, diff_correct_wc_base_revnum, + diff_two_working_copies, ] if __name__ == '__main__':
Modified: subversion/branches/ev2-export/subversion/tests/cmdline/info_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/cmdline/info_tests.py?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/tests/cmdline/info_tests.py (original) +++ subversion/branches/ev2-export/subversion/tests/cmdline/info_tests.py Thu Apr 12 22:48:32 2012 @@ -27,7 +27,9 @@ # See basic-tests.py for more svn info tests. # General modules -import shutil, stat, re, os +import shutil, stat, re, os, logging + +logger = logging.getLogger() # Our testing module import svntest @@ -74,9 +76,9 @@ def verify_xml_elements(lines, exprs): str = str[m.end():] # skip xml version tag (unmatched_str, unmatched_exprs) = match_xml_element(str, exprs) if unmatched_exprs: - print("Failed to find the following expressions:") + logger.warn("Failed to find the following expressions:") for expr in unmatched_exprs: - print(expr) + logger.warn(expr) raise svntest.tree.SVNTreeUnequal def match_xml_element(str, exprs): @@ -115,7 +117,7 @@ def match_xml_element(str, exprs): content_re = re.compile(content_re_str % name, re.DOTALL) m = content_re.match(str) if not m: - print("No XML end-tag for '%s' found in '%s...'" % (name, str[:100])) + logger.warn("No XML end-tag for '%s' found in '%s...'" % (name, str[:100])) raise(svntest.tree.SVNTreeUnequal) content = m.group('content') str = str[m.end():] @@ -299,13 +301,13 @@ def info_wcroot_abspaths(sbox): target = "(UNKNOWN)" if path is None: - print "No WC root path for '%s'" % (target) + logger.warn("No WC root path for '%s'", target) raise svntest.Failure if path != wcroot_abspath: - print("For target '%s'..." % (target)) - print(" Reported WC root path: %s" % (path)) - print(" Expected WC root path: %s" % (wcroot_abspath)) + logger.warn("For target '%s'...", target) + logger.warn(" Reported WC root path: %s", path) + logger.warn(" Expected WC root path: %s", wcroot_abspath) raise svntest.Failure sbox.build(read_only=True) Modified: subversion/branches/ev2-export/subversion/tests/cmdline/stat_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/cmdline/stat_tests.py?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/tests/cmdline/stat_tests.py (original) +++ subversion/branches/ev2-export/subversion/tests/cmdline/stat_tests.py Thu Apr 12 22:48:32 2012 @@ -29,6 +29,9 @@ import os import re import time import datetime +import logging + +logger = logging.getLogger() # Our testing module import svntest @@ -644,7 +647,7 @@ def get_last_changed_date(path): for line in out: if re.match("^Last Changed Date", line): return line - print("Didn't find Last Changed Date for " + path) + logger.warn("Didn't find Last Changed Date for %s", path) raise svntest.Failure # Helper for timestamp_behaviour test @@ -655,7 +658,7 @@ def get_text_timestamp(path): for line in out: if re.match("^Text Last Updated", line): return line - print("Didn't find text-time for " + path) + logger.warn("Didn't find text-time for %s", path) raise svntest.Failure # Helper for timestamp_behaviour test @@ -789,9 +792,9 @@ use-commit-times = yes or fmt[23:25] != iota_ts[23:25]): # NOTE: the two strings below won't *exactly* match (see just above), # but the *numeric* portions of them should. - print("File timestamp on 'iota' does not match.") - print(" EXPECTED: %s" % iota_ts) - print(" ACTUAL: %s" % fmt) + logger.warn("File timestamp on 'iota' does not match.") + logger.warn(" EXPECTED: %s", iota_ts) + logger.warn(" ACTUAL: %s", fmt) raise svntest.Failure #---------------------------------------------------------------------- @@ -1750,18 +1753,19 @@ def status_with_tree_conflicts(sbox): # check if the path should be a victim m = re.search('tree-conflicted="true"', entry) if (m is None) and should_be_victim[path]: - print("ERROR: expected '%s' to be a tree conflict victim." % path) - print("ACTUAL STATUS OUTPUT:") - print(output_str) + logger.warn("ERROR: expected '%s' to be a tree conflict victim.", path) + logger.warn("ACTUAL STATUS OUTPUT:") + logger.warn(output_str) raise svntest.Failure if m and not should_be_victim[path]: - print("ERROR: did NOT expect '%s' to be a tree conflict victim." % path) - print("ACTUAL STATUS OUTPUT:") - print(output_str) + logger.warn("ERROR: did NOT expect '%s' to be a tree conflict victim.", + path) + logger.warn("ACTUAL STATUS OUTPUT:") + logger.warn(output_str) raise svntest.Failure if real_entry_count != len(should_be_victim): - print("ERROR: 'status --xml' output is incomplete.") + logger.warn("ERROR: 'status --xml' output is incomplete.") raise svntest.Failure Modified: subversion/branches/ev2-export/subversion/tests/cmdline/svnadmin_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/cmdline/svnadmin_tests.py?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/tests/cmdline/svnadmin_tests.py (original) +++ subversion/branches/ev2-export/subversion/tests/cmdline/svnadmin_tests.py Thu Apr 12 22:48:32 2012 @@ -30,6 +30,9 @@ import re import shutil import sys import threading +import logging + +logger = logging.getLogger() # Our testing module import svntest @@ -458,7 +461,7 @@ def hotcopy_format(sbox): sbox.repo_dir, backup_dir) if errput: - print("Error: hotcopy failed") + logger.warn("Error: hotcopy failed") raise svntest.Failure # verify that the db/format files are the same @@ -471,7 +474,7 @@ def hotcopy_format(sbox): fp2.close() if contents1 != contents2: - print("Error: db/format file contents do not match after hotcopy") + logger.warn("Error: db/format file contents do not match after hotcopy") raise svntest.Failure #---------------------------------------------------------------------- @@ -488,7 +491,7 @@ def setrevprop(sbox): "--bypass-hooks", iota_path) if errput: - print("Error: 'setlog' failed") + logger.warn("Error: 'setlog' failed") raise svntest.Failure # Verify that the revprop value matches what we set when retrieved @@ -507,7 +510,7 @@ def setrevprop(sbox): "-r0", "svn:author", foo_path) if errput: - print("Error: 'setrevprop' failed") + logger.warn("Error: 'setrevprop' failed") raise svntest.Failure # Verify that the revprop value matches what we set when retrieved @@ -860,7 +863,7 @@ def set_uuid(sbox): raise SVNUnexpectedStderr(errput) new_uuid = output[0].rstrip() if new_uuid == orig_uuid: - print("Error: new UUID matches the original one") + logger.warn("Error: new UUID matches the original one") raise svntest.Failure # Now, try setting the UUID back to the original value. @@ -871,7 +874,7 @@ def set_uuid(sbox): raise SVNUnexpectedStderr(errput) new_uuid = output[0].rstrip() if new_uuid != orig_uuid: - print("Error: new UUID doesn't match the original one") + logger.warn("Error: new UUID doesn't match the original one") raise svntest.Failure #---------------------------------------------------------------------- Modified: subversion/branches/ev2-export/subversion/tests/cmdline/svnlook_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/cmdline/svnlook_tests.py?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/tests/cmdline/svnlook_tests.py (original) +++ subversion/branches/ev2-export/subversion/tests/cmdline/svnlook_tests.py Thu Apr 12 22:48:32 2012 @@ -25,7 +25,9 @@ ###################################################################### # General modules -import re, os +import re, os, logging + +logger = logging.getLogger() # Our testing module import svntest @@ -56,9 +58,9 @@ def run_svnlook(*varargs): def expect(tag, expected, got): if expected != got: - print("When testing: %s" % tag) - print("Expected: %s" % expected) - print(" Got: %s" % got) + logger.warn("When testing: %s", tag) + logger.warn("Expected: %s", expected) + logger.warn(" Got: %s", got) raise svntest.Failure @@ -165,7 +167,7 @@ def test_misc(sbox): # We cannot rely on svn:author's presence. ra_svn doesn't set it. if not (proplist == [ 'svn:author', 'svn:date', 'svn:log' ] or proplist == [ 'svn:date', 'svn:log' ]): - print("Unexpected result from proplist: %s" % proplist) + logger.warn("Unexpected result from proplist: %s", proplist) raise svntest.Failure prop_name = 'foo:bar-baz-quux' @@ -415,12 +417,12 @@ def tree_non_recursive(sbox): treelist = run_svnlook('tree', '--non-recursive', repo_dir) for entry in treelist: if not entry.rstrip() in expected_results_root: - print("Unexpected result from tree with --non-recursive:") - print(" entry : %s" % entry.rstrip()) + logger.warn("Unexpected result from tree with --non-recursive:") + logger.warn(" entry : %s", entry.rstrip()) raise svntest.Failure if len(treelist) != len(expected_results_root): - print("Expected %i output entries, found %i" - % (len(expected_results_root), len(treelist))) + logger.warn("Expected %i output entries, found %i", + len(expected_results_root), len(treelist)) raise svntest.Failure # check the output of svnlook --non-recursive on a @@ -428,12 +430,12 @@ def tree_non_recursive(sbox): treelist = run_svnlook('tree', '--non-recursive', repo_dir, '/A/B') for entry in treelist: if not entry.rstrip() in expected_results_deep: - print("Unexpected result from tree with --non-recursive:") - print(" entry : %s" % entry.rstrip()) + logger.warn("Unexpected result from tree with --non-recursive:") + logger.warn(" entry : %s", entry.rstrip()) raise svntest.Failure if len(treelist) != len(expected_results_deep): - print("Expected %i output entries, found %i" - % (len(expected_results_deep), len(treelist))) + logger.warn("Expected %i output entries, found %i", + len(expected_results_deep), len(treelist)) raise svntest.Failure #---------------------------------------------------------------------- Modified: subversion/branches/ev2-export/subversion/tests/cmdline/trans_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/cmdline/trans_tests.py?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/tests/cmdline/trans_tests.py (original) +++ subversion/branches/ev2-export/subversion/tests/cmdline/trans_tests.py Thu Apr 12 22:48:32 2012 @@ -25,7 +25,9 @@ ###################################################################### # General modules -import os, re +import os, re, logging + +logger = logging.getLogger() # Our testing module import svntest @@ -92,13 +94,13 @@ def check_keywords(actual_kw, expected_k """A Helper function to compare two keyword lists""" if len(actual_kw) != len(expected_kw): - print("Keyword lists are different by size") + logger.warn("Keyword lists are different by size") raise svntest.Failure for i in range(0,len(actual_kw)): if actual_kw[i] != expected_kw[i]: - print('%s item %s, Expected: %s' % (name, i, expected_kw[i][:-1])) - print('%s item %s, Got: %s' % (name, i, actual_kw[i][:-1])) + logger.warn('%s item %s, Expected: %s', name, i, expected_kw[i][:-1]) + logger.warn('%s item %s, Got: %s', name, i, actual_kw[i][:-1]) raise svntest.Failure def setup_working_copy(wc_dir, value_len): @@ -304,7 +306,7 @@ def keywords_from_birth(sbox): if not ((len(lines) == 1) and (re.match("\$URL: (http|https|file|svn|svn\\+ssh)://", lines[0]))): - print("URL expansion failed for %s" % url_unexp_path) + logger.warn("URL expansion failed for %s", url_unexp_path) raise svntest.Failure fp.close() @@ -314,7 +316,7 @@ def keywords_from_birth(sbox): if not ((len(lines) == 1) and (re.match("\$URL: (http|https|file|svn|svn\\+ssh)://", lines[0]))): - print("URL expansion failed for %s" % url_exp_path) + logger.warn("URL expansion failed for %s", url_exp_path) raise svntest.Failure fp.close() @@ -323,7 +325,7 @@ def keywords_from_birth(sbox): lines = fp.readlines() if not ((len(lines) == 1) and (re.match("\$Id: id_unexp", lines[0]))): - print("Id expansion failed for %s" % id_exp_path) + logger.warn("Id expansion failed for %s", id_exp_path) raise svntest.Failure fp.close() @@ -332,7 +334,7 @@ def keywords_from_birth(sbox): lines = fp.readlines() if not ((len(lines) == 1) and (re.match("\$Id: id_exp", lines[0]))): - print("Id expansion failed for %s" % id_exp_path) + logger.warn("Id expansion failed for %s", id_exp_path) raise svntest.Failure fp.close() @@ -342,7 +344,7 @@ def keywords_from_birth(sbox): if not ((len(lines) == 1) and (re.match("\$Header: (https?|file|svn|svn\\+ssh)://.* jrandom", lines[0]))): - print("Header expansion failed for %s" % header_unexp_path) + logger.warn("Header expansion failed for %s", header_unexp_path) raise svntest.Failure fp.close() @@ -352,7 +354,7 @@ def keywords_from_birth(sbox): if not ((len(lines) == 1) and (re.match("\$Header: (https?|file|svn|svn\\+ssh)://.* jrandom", lines[0]))): - print("Header expansion failed for %s" % header_exp_path) + logger.warn("Header expansion failed for %s", header_exp_path) raise svntest.Failure fp.close() @@ -401,7 +403,7 @@ def keywords_from_birth(sbox): lines = fp.readlines() if not ((len(lines) == 1) and (re.match("\$Id: .*id with space", lines[0]))): - print("Id expansion failed for %s" % id_with_space_path) + logger.warn("Id expansion failed for %s", id_with_space_path) raise svntest.Failure fp.close() @@ -411,7 +413,7 @@ def keywords_from_birth(sbox): if not ((len(lines) == 1) and (re.match("\$Id: .*id_exp with_\$_sign [^$]* jrandom \$", lines[0]))): - print("Id expansion failed for %s" % id_exp_with_dollar_path) + logger.warn("Id expansion failed for %s", id_exp_with_dollar_path) raise svntest.Failure fp.close() @@ -627,7 +629,7 @@ def keyword_expanded_on_checkout(sbox): if not ((len(lines) == 1) and (re.match("\$URL: (http|https|file|svn|svn\\+ssh)://", lines[0]))): - print("URL expansion failed for %s" % other_url_path) + logger.warn("URL expansion failed for %s", other_url_path) raise svntest.Failure fp.close() @@ -764,7 +766,7 @@ def propset_commit_checkout_nocrash(sbox mu_other_contents = open(mu_other_path).read() if mu_other_contents != "This is the file 'mu'.\n$Rev: 3 $": - print("'%s' does not have the expected contents" % mu_other_path) + logger.warn("'%s' does not have the expected contents", mu_other_path) raise svntest.Failure @@ -878,7 +880,7 @@ def props_only_file_update(sbox): temps.remove('prop-base') temps.remove('props') if temps: - print('Temporary files leftover: %s' % (', '.join(temps),)) + logger.warn('Temporary files leftover: %s', (', '.join(temps),)) raise svntest.Failure Modified: subversion/branches/ev2-export/subversion/tests/cmdline/update_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/cmdline/update_tests.py?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/tests/cmdline/update_tests.py (original) +++ subversion/branches/ev2-export/subversion/tests/cmdline/update_tests.py Thu Apr 12 22:48:32 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 #---------------------------------------------------------------------- @@ -695,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 @@ -708,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 @@ -5375,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 #---------------------------------------------------------------------- Modified: subversion/branches/ev2-export/subversion/tests/cmdline/upgrade_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/cmdline/upgrade_tests.py?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/tests/cmdline/upgrade_tests.py (original) +++ subversion/branches/ev2-export/subversion/tests/cmdline/upgrade_tests.py Thu Apr 12 22:48:32 2012 @@ -35,6 +35,9 @@ import shutil import sys import tarfile import tempfile +import logging + +logger = logging.getLogger() import svntest from svntest import wc @@ -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 Modified: subversion/branches/ev2-export/subversion/tests/libsvn_fs/fs-test.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/libsvn_fs/fs-test.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/tests/libsvn_fs/fs-test.c (original) +++ subversion/branches/ev2-export/subversion/tests/libsvn_fs/fs-test.c Thu Apr 12 22:48:32 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/ev2-export/subversion/tests/libsvn_subr/crypto-test.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/libsvn_subr/crypto-test.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/tests/libsvn_subr/crypto-test.c (original) +++ subversion/branches/ev2-export/subversion/tests/libsvn_subr/crypto-test.c Thu Apr 12 22:48:32 2012 @@ -29,8 +29,6 @@ #include "../svn_test.h" #include "../../libsvn_subr/crypto.h" -#if APU_HAVE_CRYPTO - /* Helper function: encrypt PASSWORD within CTX using MASTER, then decrypt those results and ensure the original PASSWORD comes out the other end. */ @@ -74,12 +72,10 @@ encrypt_decrypt(svn_crypto__ctx_t *ctx, return SVN_NO_ERROR; } -#endif /* APU_HAVE_CRYPTO */ static svn_error_t * test_encrypt_decrypt_password(apr_pool_t *pool) { -#if APU_HAVE_CRYPTO svn_crypto__ctx_t *ctx; const svn_string_t *master = svn_string_create("Pastor Massword", pool); int i; @@ -90,6 +86,9 @@ test_encrypt_decrypt_password(apr_pool_t "mypassphrase", /* with 4-byte padding, should align on block boundary */ }; + /* Skip this test if the crypto subsystem is unavailable. */ + if (! svn_crypto__is_available()) + return svn_error_create(SVN_ERR_TEST_SKIPPED, NULL, NULL); SVN_ERR(svn_crypto__context_create(&ctx, pool)); @@ -102,12 +101,70 @@ test_encrypt_decrypt_password(apr_pool_t svn_pool_destroy(iterpool); return SVN_NO_ERROR; -#else - return svn_error_create(SVN_ERR_TEST_SKIPPED, NULL, NULL); -#endif /* APU_HAVE_CRYPTO */ } +static svn_error_t * +test_passphrase_check(apr_pool_t *pool) +{ + svn_crypto__ctx_t *ctx; + int i; + apr_pool_t *iterpool; + const char *passwords[] = { + "3ncryptm!3", /* fits in one block */ + "this is a particularly long password", /* spans blocks */ + "mypassphrase", /* with 4-byte padding, should align on block boundary */ + }; + const svn_string_t *ciphertext, *iv, *salt, *secret; + const char *checktext; + svn_boolean_t is_valid; + int num_passwords = sizeof(passwords) / sizeof(const char *); + + /* Skip this test if the crypto subsystem is unavailable. */ + if (! svn_crypto__is_available()) + return svn_error_create(SVN_ERR_TEST_SKIPPED, NULL, NULL); + + SVN_ERR(svn_crypto__context_create(&ctx, pool)); + + iterpool = svn_pool_create(pool); + for (i = 0; i < num_passwords; i++) + { + svn_pool_clear(iterpool); + secret = svn_string_create(passwords[i], iterpool); + SVN_ERR(svn_crypto__generate_secret_checktext(&ciphertext, &iv, &salt, + &checktext, ctx, secret, + iterpool, iterpool)); + SVN_ERR(svn_crypto__verify_secret(&is_valid, ctx, secret, ciphertext, + iv, salt, checktext, iterpool)); + if (! is_valid) + return svn_error_create(SVN_ERR_TEST_FAILED, NULL, + "Error validating secret against checktext"); + } + + for (i = 0; i < num_passwords; i++) + { + int test_secret_index = (i + 1) % num_passwords; + + svn_pool_clear(iterpool); + secret = svn_string_create(passwords[i], iterpool); + SVN_ERR(svn_crypto__generate_secret_checktext(&ciphertext, &iv, &salt, + &checktext, ctx, secret, + iterpool, iterpool)); + secret = svn_string_create(passwords[test_secret_index], iterpool); + SVN_ERR(svn_crypto__verify_secret(&is_valid, ctx, secret, ciphertext, + iv, salt, checktext, iterpool)); + if (is_valid) + return svn_error_create(SVN_ERR_TEST_FAILED, NULL, + "Expected secret validation failure; " + "got success"); + } + + /* Now check that a bogus secret causes the validation to fail. */ + + svn_pool_destroy(iterpool); + return SVN_NO_ERROR; +} + @@ -118,5 +175,7 @@ struct svn_test_descriptor_t test_funcs[ SVN_TEST_NULL, SVN_TEST_PASS2(test_encrypt_decrypt_password, "basic password encryption/decryption test"), + SVN_TEST_PASS2(test_passphrase_check, + "password checktext generation/validation"), SVN_TEST_NULL }; Modified: subversion/branches/ev2-export/subversion/tests/libsvn_wc/op-depth-test.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/libsvn_wc/op-depth-test.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/tests/libsvn_wc/op-depth-test.c (original) +++ subversion/branches/ev2-export/subversion/tests/libsvn_wc/op-depth-test.c Thu Apr 12 22:48:32 2012 @@ -3169,9 +3169,7 @@ test_shadowed_update(const svn_test_opts SVN_ERR(wc_update(&b, "", 2)); SVN_ERR(wc_copy(&b, "A", "A_tmp")); SVN_ERR(wc_update(&b, "", 1)); - SVN_ERR(wc_move(&b, "A_tmp", "A")); /* ### XFAIL: sets moved-here on - A but A_tmp is removed and so - does not have moved-to. */ + SVN_ERR(wc_move(&b, "A_tmp", "A")); SVN_ERR(wc_mkdir(&b, "K")); SVN_ERR(wc_mkdir(&b, "K/L")); @@ -4626,7 +4624,7 @@ struct svn_test_descriptor_t test_funcs[ "test_op_delete"), SVN_TEST_OPTS_PASS(test_child_replace_with_same_origin, "test_child_replace_with_same"), - SVN_TEST_OPTS_XFAIL(test_shadowed_update, + SVN_TEST_OPTS_PASS(test_shadowed_update, "test_shadowed_update"), SVN_TEST_OPTS_PASS(test_copy_of_deleted, "test_copy_of_deleted (issue #3873)"), Modified: subversion/branches/ev2-export/subversion/tests/svn_test_main.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/svn_test_main.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/subversion/tests/svn_test_main.c (original) +++ subversion/branches/ev2-export/subversion/tests/svn_test_main.c Thu Apr 12 22:48:32 2012 @@ -345,7 +345,6 @@ main(int argc, const char *argv[]) const char *prog_name; int i; svn_boolean_t got_error = FALSE; - apr_allocator_t *allocator; apr_pool_t *pool, *test_pool; svn_boolean_t ran_a_test = FALSE; svn_boolean_t list_mode = FALSE; @@ -368,16 +367,10 @@ main(int argc, const char *argv[]) exit(1); } - /* set up the global pool. Use a separate mutexless allocator, - * given this application is single threaded. + /* set up the global pool. Use a separate allocator to limit memory + * usage but make it thread-safe to allow for multi-threaded tests. */ - if (apr_allocator_create(&allocator)) - return EXIT_FAILURE; - - apr_allocator_max_free_set(allocator, SVN_ALLOCATOR_RECOMMENDED_MAX_FREE); - - pool = svn_pool_create_ex(NULL, allocator); - apr_allocator_owner_set(allocator, pool); + pool = apr_allocator_owner_get(svn_pool_create_allocator(TRUE)); /* Remember the command line */ test_argc = argc; @@ -461,7 +454,7 @@ main(int argc, const char *argv[]) case server_minor_version_opt: { char *end; - opts.server_minor_version = strtol(opt_arg, &end, 10); + opts.server_minor_version = (int) strtol(opt_arg, &end, 10); if (end == opt_arg || *end != '\0') { fprintf(stderr, "FAIL: Non-numeric minor version given\n"); Modified: subversion/branches/ev2-export/tools/client-side/svnmucc/svnmucc.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/tools/client-side/svnmucc/svnmucc.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/tools/client-side/svnmucc/svnmucc.c (original) +++ subversion/branches/ev2-export/tools/client-side/svnmucc/svnmucc.c Thu Apr 12 22:48:32 2012 @@ -69,8 +69,6 @@ static void handle_error(svn_error_t *er static apr_pool_t * init(const char *application) { - apr_allocator_t *allocator; - apr_pool_t *pool; svn_error_t *err; const svn_version_checklist_t checklist[] = { {"svn_client", svn_client_version}, @@ -81,19 +79,14 @@ init(const char *application) SVN_VERSION_DEFINE(my_version); - if (svn_cmdline_init(application, stderr) - || apr_allocator_create(&allocator)) + if (svn_cmdline_init(application, stderr)) exit(EXIT_FAILURE); err = svn_ver_check_list(&my_version, checklist); if (err) handle_error(err, NULL); - apr_allocator_max_free_set(allocator, SVN_ALLOCATOR_RECOMMENDED_MAX_FREE); - pool = svn_pool_create_ex(NULL, allocator); - apr_allocator_owner_set(allocator, pool); - - return pool; + return apr_allocator_owner_get(svn_pool_create_allocator(FALSE)); } static svn_error_t * Modified: subversion/branches/ev2-export/tools/dev/merge-graph.py URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/tools/dev/merge-graph.py?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/tools/dev/merge-graph.py (original) +++ subversion/branches/ev2-export/tools/dev/merge-graph.py Thu Apr 12 22:48:32 2012 @@ -19,25 +19,40 @@ # under the License. # ==================================================================== -args_message = 'GRAPH_CONFIG_FILE...' +args_message = '[-f png|svg|gif|dia... [-f ...]] GRAPH_CONFIG_FILE...' help_message = """Produce pretty graphs representing branches and merging. -For each config file specified, construct a graph and write it as a PNG file.""" +For each config file specified, construct a graph and write it as a PNG file +(or other graphical file formats).""" import sys +import getopt from mergegraph import MergeDot # If run as a program, process each input filename as a graph config file. if __name__ == '__main__': + optlist, args = getopt.getopt(sys.argv[1:], 'f:', ['format']) + prog_name = sys.argv[0] - if len(sys.argv) == 1: + if not args: usage = '%s: usage: "%s %s"' % (prog_name, prog_name, args_message) print >> sys.stderr, usage sys.exit(1) - for config_filename in sys.argv[1:]: - print prog_name + ": reading '" + config_filename + "',", - graph = MergeDot(config_filename, rankdir='LR', dpi='72') - print "writing '" + graph.filename + "'" - graph.write_png(graph.filename) + formats = [] + + for opt, opt_arg in optlist: + if opt == '-f': + formats.append(opt_arg) + if not formats: + formats.append('png') + + for config_filename in args: + print "%s: reading '%s'," % (prog_name, config_filename), + graph = MergeDot(config_filename, rankdir='LR', dpi='72') + for format in formats: + filename = '%s.%s' % (graph.basename, format) + print "writing '%s'" % filename, + graph.save(format=format, filename=filename) + print Modified: subversion/branches/ev2-export/tools/dev/mergegraph/mergegraph.py URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/tools/dev/mergegraph/mergegraph.py?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/tools/dev/mergegraph/mergegraph.py (original) +++ subversion/branches/ev2-export/tools/dev/mergegraph/mergegraph.py Thu Apr 12 22:48:32 2012 @@ -228,11 +228,11 @@ class MergeDot(MergeGraph, pydot.Dot): """Initialize a MergeDot graph's input data from a config file.""" import ConfigParser if config_filename.endswith('.txt'): - default_filename = config_filename[:-4] + '.png' + default_basename = config_filename[:-4] else: - default_filename = config_filename + '.png' + default_basename = config_filename - config = ConfigParser.SafeConfigParser({ 'filename': default_filename, + config = ConfigParser.SafeConfigParser({ 'basename': default_basename, 'title': None, 'merges': '[]', 'annotations': '[]' }) @@ -240,7 +240,7 @@ class MergeDot(MergeGraph, pydot.Dot): if len(files_read) == 0: print >> sys.stderr, 'graph: unable to read graph config from "' + config_filename + '"' sys.exit(1) - graph.filename = config.get('graph', 'filename') + graph.basename = config.get('graph', 'basename') graph.title = config.get('graph', 'title') graph.branches = eval(config.get('graph', 'branches')) graph.changes = eval(config.get('graph', 'changes')) @@ -294,3 +294,11 @@ class MergeDot(MergeGraph, pydot.Dot): if graph.title: graph.add_node(Node('title', shape='plaintext', label='"' + graph.title + '"')) + def save(graph, format='png', filename=None): + """Save this merge graph to the given file format. If filename is None, + construct a filename from the basename of the original file (as passed + to the constructor and then stored in graph.basename) and the suffix + according to the given format.""" + if not filename: + filename = graph.basename + '.' + format + pydot.Dot.write(graph, filename, format=format) Modified: subversion/branches/ev2-export/tools/dev/svnraisetreeconflict/main.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/tools/dev/svnraisetreeconflict/main.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/tools/dev/svnraisetreeconflict/main.c (original) +++ subversion/branches/ev2-export/tools/dev/svnraisetreeconflict/main.c Thu Apr 12 22:48:32 2012 @@ -316,7 +316,6 @@ check_lib_versions(void) int main(int argc, const char *argv[]) { - apr_allocator_t *allocator; apr_pool_t *pool; svn_error_t *err; apr_getopt_t *os; @@ -336,13 +335,7 @@ main(int argc, const char *argv[]) /* Create our top-level pool. Use a separate mutexless allocator, * given this application is single threaded. */ - if (apr_allocator_create(&allocator)) - return EXIT_FAILURE; - - apr_allocator_max_free_set(allocator, SVN_ALLOCATOR_RECOMMENDED_MAX_FREE); - - pool = svn_pool_create_ex(NULL, allocator); - apr_allocator_owner_set(allocator, pool); + pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE)); /* Check library versions */ err = check_lib_versions(); Modified: subversion/branches/ev2-export/tools/server-side/svn-rep-sharing-stats.c URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/tools/server-side/svn-rep-sharing-stats.c?rev=1325565&r1=1325564&r2=1325565&view=diff ============================================================================== --- subversion/branches/ev2-export/tools/server-side/svn-rep-sharing-stats.c (original) +++ subversion/branches/ev2-export/tools/server-side/svn-rep-sharing-stats.c Thu Apr 12 22:48:32 2012 @@ -421,7 +421,6 @@ int main(int argc, const char *argv[]) { const char *repos_path; - apr_allocator_t *allocator; apr_pool_t *pool; svn_boolean_t prop = FALSE, data = FALSE; svn_boolean_t quiet = FALSE; @@ -446,13 +445,7 @@ main(int argc, const char *argv[]) /* Create our top-level pool. Use a separate mutexless allocator, * given this application is single threaded. */ - if (apr_allocator_create(&allocator)) - return EXIT_FAILURE; - - apr_allocator_max_free_set(allocator, SVN_ALLOCATOR_RECOMMENDED_MAX_FREE); - - pool = svn_pool_create_ex(NULL, allocator); - apr_allocator_owner_set(allocator, pool); + pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE)); /* Check library versions */ err = check_lib_versions();