Modified: subversion/branches/master-passphrase/subversion/tests/cmdline/update_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/tests/cmdline/update_tests.py?rev=1325461&r1=1325460&r2=1325461&view=diff ============================================================================== --- subversion/branches/master-passphrase/subversion/tests/cmdline/update_tests.py (original) +++ subversion/branches/master-passphrase/subversion/tests/cmdline/update_tests.py Thu Apr 12 19:37:45 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/master-passphrase/subversion/tests/cmdline/upgrade_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/tests/cmdline/upgrade_tests.py?rev=1325461&r1=1325460&r2=1325461&view=diff ============================================================================== --- subversion/branches/master-passphrase/subversion/tests/cmdline/upgrade_tests.py (original) +++ subversion/branches/master-passphrase/subversion/tests/cmdline/upgrade_tests.py Thu Apr 12 19:37:45 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/master-passphrase/subversion/tests/libsvn_fs/fs-test.c URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/tests/libsvn_fs/fs-test.c?rev=1325461&r1=1325460&r2=1325461&view=diff ============================================================================== --- subversion/branches/master-passphrase/subversion/tests/libsvn_fs/fs-test.c (original) +++ subversion/branches/master-passphrase/subversion/tests/libsvn_fs/fs-test.c Thu Apr 12 19:37:45 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/master-passphrase/subversion/tests/libsvn_subr/crypto-test.c URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/tests/libsvn_subr/crypto-test.c?rev=1325461&r1=1325460&r2=1325461&view=diff ============================================================================== --- subversion/branches/master-passphrase/subversion/tests/libsvn_subr/crypto-test.c (original) +++ subversion/branches/master-passphrase/subversion/tests/libsvn_subr/crypto-test.c Thu Apr 12 19:37:45 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/master-passphrase/subversion/tests/libsvn_wc/op-depth-test.c URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/tests/libsvn_wc/op-depth-test.c?rev=1325461&r1=1325460&r2=1325461&view=diff ============================================================================== --- subversion/branches/master-passphrase/subversion/tests/libsvn_wc/op-depth-test.c (original) +++ subversion/branches/master-passphrase/subversion/tests/libsvn_wc/op-depth-test.c Thu Apr 12 19:37:45 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/master-passphrase/subversion/tests/svn_test_main.c URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/tests/svn_test_main.c?rev=1325461&r1=1325460&r2=1325461&view=diff ============================================================================== --- subversion/branches/master-passphrase/subversion/tests/svn_test_main.c (original) +++ subversion/branches/master-passphrase/subversion/tests/svn_test_main.c Thu Apr 12 19:37:45 2012 @@ -461,7 +461,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/master-passphrase/tools/dev/merge-graph.py URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/tools/dev/merge-graph.py?rev=1325461&r1=1325460&r2=1325461&view=diff ============================================================================== --- subversion/branches/master-passphrase/tools/dev/merge-graph.py (original) +++ subversion/branches/master-passphrase/tools/dev/merge-graph.py Thu Apr 12 19:37:45 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/master-passphrase/tools/dev/mergegraph/mergegraph.py URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/tools/dev/mergegraph/mergegraph.py?rev=1325461&r1=1325460&r2=1325461&view=diff ============================================================================== --- subversion/branches/master-passphrase/tools/dev/mergegraph/mergegraph.py (original) +++ subversion/branches/master-passphrase/tools/dev/mergegraph/mergegraph.py Thu Apr 12 19:37:45 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)
