Modified: subversion/branches/reuse-ra-session/subversion/tests/cmdline/update_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/tests/cmdline/update_tests.py?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/tests/cmdline/update_tests.py (original) +++ subversion/branches/reuse-ra-session/subversion/tests/cmdline/update_tests.py Wed Feb 25 08:15:39 2015 @@ -4386,12 +4386,12 @@ def tree_conflicts_on_update_2_2(sbox): expected_output = deep_trees_conflict_output expected_disk = svntest.wc.State('', { + 'DDF/D1/D2' : Item(), 'F' : Item(), 'D' : Item(), - 'DF' : Item(), - 'DD' : Item(), - 'DDF' : Item(), - 'DDD' : Item(), + 'DF/D1' : Item(), + 'DD/D1' : Item(), + 'DDD/D1/D2' : Item(), }) expected_status = svntest.deeptrees.deep_trees_virginal_state.copy() @@ -4410,20 +4410,16 @@ def tree_conflicts_on_update_2_2(sbox): # Expect the incoming tree deletes and the local leaf deletes to mean # that all deleted paths are *really* gone, not simply scheduled for # deletion. - expected_status.tweak('F/alpha', - 'D/D1', - 'DD/D1', - 'DF/D1', - 'DDD/D1', - 'DDF/D1', - status='! ', wc_rev=None) - # Remove from expected status and disk everything below the deleted paths. - expected_status.remove('DD/D1/D2', - 'DF/D1/beta', - 'DDD/D1/D2', - 'DDD/D1/D2/D3', - 'DDF/D1/D2', - 'DDF/D1/D2/gamma',) + expected_status.tweak('DD/D1', 'DF/D1', 'DDF/D1', 'DDD/D1', + status='A ', copied='+', treeconflict='C', + wc_rev='-') + expected_status.tweak('DDF/D1/D2', 'DDD/D1/D2', + copied='+', wc_rev='-') + expected_status.tweak('DD/D1/D2', 'DF/D1/beta', 'DDD/D1/D2/D3', + 'DDF/D1/D2/gamma', + status='D ', copied='+', wc_rev='-') + expected_status.tweak('F/alpha', 'D/D1', + status='! ', treeconflict='C', wc_rev=None) expected_info = { 'F/alpha' : { @@ -4434,13 +4430,13 @@ def tree_conflicts_on_update_2_2(sbox): }, 'DF/D1' : { 'Tree conflict' : - '^local dir delete, incoming dir delete or move upon update' + '^local dir edit, incoming dir delete or move upon update' + ' Source left: .dir.*/DF/D1@2' + ' Source right: .none.*(/DF/D1@3)?$', }, 'DDF/D1' : { 'Tree conflict' : - '^local dir delete, incoming dir delete or move upon update' + '^local dir edit, incoming dir delete or move upon update' + ' Source left: .dir.*/DDF/D1@2' + ' Source right: .none.*(/DDF/D1@3)?$', }, @@ -4452,13 +4448,13 @@ def tree_conflicts_on_update_2_2(sbox): }, 'DD/D1' : { 'Tree conflict' : - '^local dir delete, incoming dir delete or move upon update' + '^local dir edit, incoming dir delete or move upon update' + ' Source left: .dir.*/DD/D1@2' + ' Source right: .none.*(/DD/D1@3)?$', }, 'DDD/D1' : { 'Tree conflict' : - '^local dir delete, incoming dir delete or move upon update' + '^local dir edit, incoming dir delete or move upon update' + ' Source left: .dir.*/DDD/D1@2' + ' Source right: .none.*(/DDD/D1@3)?$', }, @@ -6697,6 +6693,146 @@ def update_child_below_add(sbox): None, None, None, sbox.ospath('A/B/E')) +def update_conflict_details(sbox): + "update conflict details" + + sbox.build() + wc_dir = sbox.wc_dir + + sbox.simple_append('A/B/E/new', 'new\n') + sbox.simple_add('A/B/E/new') + sbox.simple_append('A/B/E/alpha', '\nextra\nlines\n') + sbox.simple_rm('A/B/E/beta', 'A/B/F') + sbox.simple_propset('key', 'VAL', 'A/B/E', 'A/B') + sbox.simple_mkdir('A/B/E/new-dir1') + sbox.simple_mkdir('A/B/E/new-dir2') + sbox.simple_mkdir('A/B/E/new-dir3') + sbox.simple_rm('A/B/lambda') + sbox.simple_mkdir('A/B/lambda') + sbox.simple_commit() + + sbox.simple_update('', 1) + + sbox.simple_propset('key', 'vAl', 'A/B') + sbox.simple_move('A/B/E/beta', 'beta') + sbox.simple_propset('a', 'b', 'A/B/F', 'A/B/lambda') + sbox.simple_append('A/B/E/alpha', 'other\nnew\nlines') + sbox.simple_mkdir('A/B/E/new') + sbox.simple_mkdir('A/B/E/new-dir1') + sbox.simple_append('A/B/E/new-dir2', 'something') + sbox.simple_append('A/B/E/new-dir3', 'something') + sbox.simple_add('A/B/E/new-dir3') + + expected_status = svntest.actions.get_virginal_state(wc_dir, 2) + expected_status.add({ + 'A/B/E/new' : Item(status='R ', treeconflict='C', wc_rev='2'), + 'A/B/E/new-dir2' : Item(status='D ', treeconflict='C', wc_rev='2'), + 'A/B/E/new-dir3' : Item(status='R ', treeconflict='C', wc_rev='2'), + 'A/B/E/new-dir1' : Item(status=' ', wc_rev='2'), + 'A/C' : Item(status=' ', wc_rev='2'), + 'iota' : Item(status=' ', wc_rev='2'), + 'beta' : Item(status='A ', copied='+', wc_rev='-') + }) + expected_status.tweak('A/B', status=' C', wc_rev='2') + expected_status.tweak('A/B/E/alpha', status='C ', wc_rev='2') + expected_status.tweak('A/B/E/beta', status='! ', treeconflict='C', wc_rev=None) + expected_status.tweak('A/B/F', status='A ', copied='+', treeconflict='C', wc_rev='-') + expected_status.tweak('A/B/lambda', status='RM', copied='+', treeconflict='C', wc_rev='-') + expected_status.tweak('A/mu', status=' ', wc_rev='2') + expected_output = svntest.wc.State(wc_dir, { + 'A/B' : Item(status=' C'), + 'A/B/E' : Item(status=' U'), + 'A/B/E/new' : Item(status=' ', treeconflict='C'), + 'A/B/E/beta' : Item(status=' ', treeconflict='C'), + 'A/B/E/alpha' : Item(status='C '), + 'A/B/E/new-dir2' : Item(status=' ', treeconflict='C'), + 'A/B/E/new-dir3' : Item(status=' ', treeconflict='C'), + 'A/B/E/new-dir1' : Item(status='E '), + 'A/B/F' : Item(status=' ', treeconflict='C'), + # ### 2 tree conflict reports; one for delete; one for add... + 'A/B/lambda' : Item(status=' ', treeconflict='A', + prev_status=' ', prev_treeconflict='C'), + }) + svntest.actions.run_and_verify_update(wc_dir, expected_output, + None, expected_status) + + # Update can't pass source as none at a specific URL@revision, + # because it doesn't know... the working copy could be mixed + # revision or may have excluded parts... + expected_info = [ + { + "Path" : re.escape(sbox.ospath('A/B')), + + "Conflict Properties File" : + re.escape(sbox.ospath('A/B/dir_conflicts.prej')) + '.*', + "Conflict Details": re.escape( + 'incoming dir edit upon update' + + ' Source left: (dir) ^/A/B@1' + + ' Source right: (dir) ^/A/B@2') + }, + { + "Path" : re.escape(sbox.ospath('A/B/E')), + }, + { + "Path" : re.escape(sbox.ospath('A/B/E/alpha')), + "Conflict Previous Base File" : '.*alpha.*', + "Conflict Previous Working File" : '.*alpha.*', + "Conflict Current Base File": '.*alpha.*', + "Conflict Details": re.escape( + 'incoming file edit upon update' + + ' Source left: (file) ^/A/B/E/alpha@1' + + ' Source right: (file) ^/A/B/E/alpha@2') + }, + { + "Path" : re.escape(sbox.ospath('A/B/E/beta')), + "Tree conflict": re.escape( + 'local file moved away, incoming file delete or move upon update' + + ' Source left: (file) ^/A/B/E/beta@1' + + ' Source right: (none) ^/A/B/E/beta@2') + }, + { + "Path" : re.escape(sbox.ospath('A/B/E/new')), + "Tree conflict": re.escape( + 'local dir add, incoming file add upon update' + + ' Source left: (none)' + + ' Source right: (file) ^/A/B/E/new@2') + }, + { + "Path" : re.escape(sbox.ospath('A/B/E/new-dir1')), + # No tree conflict. Existing directory taken over + }, + { + "Path" : re.escape(sbox.ospath('A/B/E/new-dir2')), + "Tree conflict": re.escape( + 'local file unversioned, incoming dir add upon update' + + ' Source left: (none)' + + ' Source right: (dir) ^/A/B/E/new-dir2@2') + }, + { + "Path" : re.escape(sbox.ospath('A/B/E/new-dir3')), + "Tree conflict": re.escape( + 'local file add, incoming dir add upon update' + + ' Source left: (none)' + + ' Source right: (dir) ^/A/B/E/new-dir3@2') + }, + { + "Path" : re.escape(sbox.ospath('A/B/F')), + "Tree conflict": re.escape( + 'local dir edit, incoming dir delete or move upon update' + + ' Source left: (dir) ^/A/B/F@1' + + ' Source right: (none) ^/A/B/F@2') + }, + { + "Path" : re.escape(sbox.ospath('A/B/lambda')), + "Tree conflict": re.escape( + 'local file edit, incoming replace with dir upon update' + + ' Source left: (file) ^/A/B/lambda@1' + + ' Source right: (dir) ^/A/B/lambda@2') + }, + ] + + svntest.actions.run_and_verify_info(expected_info, sbox.ospath('A/B'), + '--depth', 'infinity') ####################################################################### # Run the tests @@ -6783,6 +6919,7 @@ test_list = [ None, update_moved_away, bump_below_tree_conflict, update_child_below_add, + update_conflict_details, ] if __name__ == '__main__':
Modified: subversion/branches/reuse-ra-session/subversion/tests/cmdline/upgrade_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/tests/cmdline/upgrade_tests.py?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/tests/cmdline/upgrade_tests.py (original) +++ subversion/branches/reuse-ra-session/subversion/tests/cmdline/upgrade_tests.py Wed Feb 25 08:15:39 2015 @@ -935,15 +935,15 @@ def tree_replace1(sbox): { '' : Item(status=' M', wc_rev=17), 'B' : Item(status='R ', copied='+', wc_rev='-'), - 'B/f' : Item(status='R ', copied='+', wc_rev='-'), + 'B/f' : Item(status=' ', copied='+', wc_rev='-'), 'B/g' : Item(status='D ', wc_rev=17), - 'B/h' : Item(status='A ', copied='+', wc_rev='-'), - 'B/C' : Item(status='R ', copied='+', wc_rev='-'), - 'B/C/f' : Item(status='R ', copied='+', wc_rev='-'), + 'B/h' : Item(status=' ', copied='+', wc_rev='-'), + 'B/C' : Item(status=' ', copied='+', wc_rev='-'), + 'B/C/f' : Item(status=' ', copied='+', wc_rev='-'), 'B/D' : Item(status='D ', wc_rev=17), 'B/D/f' : Item(status='D ', wc_rev=17), - 'B/E' : Item(status='A ', copied='+', wc_rev='-'), - 'B/E/f' : Item(status='A ', copied='+', wc_rev='-'), + 'B/E' : Item(status=' ', copied='+', wc_rev='-'), + 'B/E/f' : Item(status=' ', copied='+', wc_rev='-'), }) run_and_verify_status_no_server(sbox.wc_dir, expected_status) @@ -961,11 +961,11 @@ def tree_replace2(sbox): 'B' : Item(status='R ', copied='+', wc_rev='-'), 'B/f' : Item(status='D ', wc_rev=12), 'B/D' : Item(status='D ', wc_rev=12), - 'B/g' : Item(status='A ', copied='+', wc_rev='-'), - 'B/E' : Item(status='A ', copied='+', wc_rev='-'), + 'B/g' : Item(status=' ', copied='+', wc_rev='-'), + 'B/E' : Item(status=' ', copied='+', wc_rev='-'), 'C' : Item(status='R ', copied='+', wc_rev='-'), - 'C/f' : Item(status='A ', copied='+', wc_rev='-'), - 'C/D' : Item(status='A ', copied='+', wc_rev='-'), + 'C/f' : Item(status=' ', copied='+', wc_rev='-'), + 'C/D' : Item(status=' ', copied='+', wc_rev='-'), 'C/g' : Item(status='D ', wc_rev=12), 'C/E' : Item(status='D ', wc_rev=12), }) Modified: subversion/branches/reuse-ra-session/subversion/tests/libsvn_client/client-test.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/tests/libsvn_client/client-test.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/tests/libsvn_client/client-test.c (original) +++ subversion/branches/reuse-ra-session/subversion/tests/libsvn_client/client-test.c Wed Feb 25 08:15:39 2015 @@ -35,6 +35,8 @@ #include "svn_repos.h" #include "svn_subst.h" #include "private/svn_wc_private.h" +#include "svn_props.h" +#include "svn_hash.h" #include "../svn_test.h" #include "../svn_test_fs.h" @@ -1055,6 +1057,236 @@ test_remote_only_status(const svn_test_o return SVN_NO_ERROR; } +static svn_error_t * +test_copy_pin_externals(const svn_test_opts_t *opts, + apr_pool_t *pool) +{ + svn_opt_revision_t rev; + svn_opt_revision_t peg_rev; + const char *repos_url; + const char *A_url; + const char *A_copy_url; + const char *wc_path; + svn_client_ctx_t *ctx; + const svn_string_t *propval; + apr_hash_t *externals_to_pin; + apr_array_header_t *external_items; + apr_array_header_t *copy_sources; + svn_wc_external_item2_t items[6]; + svn_client_copy_source_t copy_source; + apr_hash_t *props; + apr_array_header_t *pinned_externals_descs; + apr_array_header_t *pinned_externals; + int i; + int num_tested_externals; + svn_stringbuf_t *externals_test_prop; + struct pin_externals_test_data { + const char *src_external_desc; + const char *expected_dst_external_desc; + } pin_externals_test_data[] = { + { "^/A/D/gamma B/gamma", "^/A/D/gamma@2 B/gamma" }, + { "-r1 ^/A/D/G C/exdir_G", "-r1 ^/A/D/G C/exdir_G" }, + { "^/A/D/H@1 C/exdir_H", "^/A/D/H@1 C/exdir_H" }, + { "^/A/D/H C/exdir_H2", "^/A/D/H@2 C/exdir_H2" }, + { "-r1 ^/A/B D/z/y/z/blah", "-r1 ^/A/B@2 D/z/y/z/blah" } , + { "-r1 ^/A/D@2 exdir_D", "-r1 ^/A/D@2 exdir_D" }, + /* Dated revision should retain their date string exactly. */ + { "-r{1970-01-01T00:00} ^/A/C 70s", "-r{1970-01-01T00:00} ^/A/C@2 70s"}, + { "-r{2004-02-23} ^/svn 1.0", "-r{2004-02-23} ^/svn 1.0"}, + { NULL }, + }; + + /* Create a filesytem and repository containing the Greek tree. */ + SVN_ERR(create_greek_repos(&repos_url, "pin-externals", opts, pool)); + + wc_path = svn_test_data_path("pin-externals-working-copy", pool); + + /* Remove old test data from the previous run */ + SVN_ERR(svn_io_remove_dir2(wc_path, TRUE, NULL, NULL, pool)); + + SVN_ERR(svn_io_make_dir_recursively(wc_path, pool)); + svn_test_add_dir_cleanup(wc_path); + + rev.kind = svn_opt_revision_head; + peg_rev.kind = svn_opt_revision_unspecified; + SVN_ERR(svn_client_create_context(&ctx, pool)); + + /* Configure some externals on ^/A */ + i = 0; + externals_test_prop = svn_stringbuf_create_empty(pool); + while (pin_externals_test_data[i].src_external_desc) + { + svn_stringbuf_appendcstr(externals_test_prop, + pin_externals_test_data[i].src_external_desc); + svn_stringbuf_appendbyte(externals_test_prop, '\n'); + i++; + } + propval = svn_string_create_from_buf(externals_test_prop, pool); + A_url = apr_pstrcat(pool, repos_url, "/A", SVN_VA_NULL); + SVN_ERR(svn_client_propset_remote(SVN_PROP_EXTERNALS, propval, + A_url, TRUE, 1, NULL, + NULL, NULL, ctx, pool)); + + /* Set up parameters for pinning some externals. */ + externals_to_pin = apr_hash_make(pool); + + items[0].url = "^/A/D/gamma"; + items[0].target_dir = "B/gamma"; + items[1].url = "^/A/B"; + items[1].target_dir = "D/z/y/z/blah"; + items[2].url = "^/A/D/H"; + items[2].target_dir = "C/exdir_H2"; + items[3].url= "^/A/D"; + items[3].target_dir= "exdir_D"; + items[4].url = "^/A/C"; + items[4].target_dir = "70s"; + /* Also add an entry which doesn't match any actual definition. */ + items[5].url = "^/this/does/not/exist"; + items[5].target_dir = "in/test/data"; + + external_items = apr_array_make(pool, 2, sizeof(svn_wc_external_item2_t *)); + for (i = 0; i < sizeof(items) / sizeof(items[0]); i++) + APR_ARRAY_PUSH(external_items, svn_wc_external_item2_t *) = &items[i]; + svn_hash_sets(externals_to_pin, A_url, external_items); + + /* Copy ^/A to ^/A_copy, pinning two non-pinned externals. */ + copy_source.path = A_url; + copy_source.revision = &rev; + copy_source.peg_revision = &peg_rev; + copy_sources = apr_array_make(pool, 1, sizeof(svn_client_copy_source_t *)); + APR_ARRAY_PUSH(copy_sources, svn_client_copy_source_t *) = ©_source; + A_copy_url = apr_pstrcat(pool, repos_url, "/A_copy", SVN_VA_NULL); + SVN_ERR(svn_client_copy7(copy_sources, A_copy_url, FALSE, FALSE, + FALSE, FALSE, TRUE, externals_to_pin, + NULL, NULL, NULL, ctx, pool)); + + /* Verify that externals were pinned as expected. */ + SVN_ERR(svn_client_propget5(&props, NULL, SVN_PROP_EXTERNALS, + A_copy_url, &peg_rev, &rev, NULL, + svn_depth_empty, NULL, ctx, pool, pool)); + propval = svn_hash_gets(props, A_copy_url); + SVN_TEST_ASSERT(propval); + + /* Test the unparsed representation of copied externals descriptions. */ + pinned_externals_descs = svn_cstring_split(propval->data, "\n", FALSE, pool); + for (i = 0; i < pinned_externals_descs->nelts; i++) + { + const char *externals_desc; + const char *expected_desc; + + externals_desc = APR_ARRAY_IDX(pinned_externals_descs, i, const char *); + expected_desc = pin_externals_test_data[i].expected_dst_external_desc; + SVN_TEST_STRING_ASSERT(externals_desc, expected_desc); + } + /* Ensure all test cases were tested. */ + SVN_TEST_ASSERT(i == (sizeof(pin_externals_test_data) / + sizeof(pin_externals_test_data[0]) - 1)); + + SVN_ERR(svn_wc_parse_externals_description3(&pinned_externals, A_copy_url, + propval->data, TRUE, pool)); + + /* For completeness, test the parsed representation, too */ + num_tested_externals = 0; + for (i = 0; i < pinned_externals->nelts; i++) + { + svn_wc_external_item2_t *item; + + item = APR_ARRAY_IDX(pinned_externals, i, svn_wc_external_item2_t *); + if (strcmp(item->url, "^/A/D/gamma") == 0) + { + SVN_TEST_STRING_ASSERT(item->target_dir, "B/gamma"); + /* Pinned to r2. */ + SVN_TEST_ASSERT(item->revision.kind == svn_opt_revision_number); + SVN_TEST_ASSERT(item->revision.value.number == 2); + SVN_TEST_ASSERT(item->peg_revision.kind == svn_opt_revision_number); + SVN_TEST_ASSERT(item->peg_revision.value.number == 2); + num_tested_externals++; + } + else if (strcmp(item->url, "^/A/D/G") == 0) + { + SVN_TEST_STRING_ASSERT(item->target_dir, "C/exdir_G"); + /* Not pinned. */ + SVN_TEST_ASSERT(item->revision.kind == svn_opt_revision_number); + SVN_TEST_ASSERT(item->revision.value.number == 1); + SVN_TEST_ASSERT(item->peg_revision.kind == svn_opt_revision_head); + num_tested_externals++; + } + else if (strcmp(item->url, "^/A/D/H") == 0) + { + if (strcmp(item->target_dir, "C/exdir_H") == 0) + { + /* Was already pinned to r1. */ + SVN_TEST_ASSERT(item->revision.kind == svn_opt_revision_number); + SVN_TEST_ASSERT(item->revision.value.number == 1); + SVN_TEST_ASSERT(item->peg_revision.kind == + svn_opt_revision_number); + SVN_TEST_ASSERT(item->peg_revision.value.number == 1); + num_tested_externals++; + } + else if (strcmp(item->target_dir, "C/exdir_H2") == 0) + { + /* Pinned to r2. */ + SVN_TEST_ASSERT(item->revision.kind == svn_opt_revision_number); + SVN_TEST_ASSERT(item->revision.value.number == 2); + SVN_TEST_ASSERT(item->peg_revision.kind == + svn_opt_revision_number); + SVN_TEST_ASSERT(item->peg_revision.value.number == 2); + num_tested_externals++; + } + else + SVN_TEST_ASSERT(FALSE); /* unknown external */ + } + else if (strcmp(item->url, "^/A/B") == 0) + { + SVN_TEST_STRING_ASSERT(item->target_dir, "D/z/y/z/blah"); + /* Pinned to r2. */ + SVN_TEST_ASSERT(item->revision.kind == svn_opt_revision_number); + SVN_TEST_ASSERT(item->revision.value.number == 1); + SVN_TEST_ASSERT(item->peg_revision.kind == svn_opt_revision_number); + SVN_TEST_ASSERT(item->peg_revision.value.number == 2); + num_tested_externals++; + } + else if (strcmp(item->url, "^/A/D") == 0) + { + SVN_TEST_STRING_ASSERT(item->target_dir, "exdir_D"); + /* Pinned to r2. */ + SVN_TEST_ASSERT(item->revision.kind == svn_opt_revision_number); + SVN_TEST_ASSERT(item->revision.value.number == 1); + SVN_TEST_ASSERT(item->peg_revision.kind == svn_opt_revision_number); + SVN_TEST_ASSERT(item->peg_revision.value.number == 2); + num_tested_externals++; + } + else if (strcmp(item->url, "^/A/C") == 0) + { + SVN_TEST_STRING_ASSERT(item->target_dir, "70s"); + /* Pinned to r2. */ + SVN_TEST_ASSERT(item->revision.kind == svn_opt_revision_date); + /* Don't bother testing the exact date value here. */ + SVN_TEST_ASSERT(item->peg_revision.kind == svn_opt_revision_number); + SVN_TEST_ASSERT(item->peg_revision.value.number == 2); + num_tested_externals++; + } + else if (strcmp(item->url, "^/svn") == 0) + { + SVN_TEST_STRING_ASSERT(item->target_dir, "1.0"); + /* Was and not in externals_to_pin, operative revision was a date. */ + SVN_TEST_ASSERT(item->revision.kind == svn_opt_revision_date); + /* Don't bother testing the exact date value here. */ + SVN_TEST_ASSERT(item->peg_revision.kind == svn_opt_revision_head); + num_tested_externals++; + } + else + SVN_TEST_ASSERT(FALSE); /* unknown URL */ + } + + /* Ensure all test cases were tested. */ + SVN_TEST_ASSERT(num_tested_externals == (sizeof(pin_externals_test_data) / + sizeof(pin_externals_test_data[0]) + - 1)); + + return SVN_NO_ERROR; +} + /* ========================================================================== */ @@ -1079,6 +1311,8 @@ static struct svn_test_descriptor_t test "test svn_client_suggest_merge_sources"), SVN_TEST_OPTS_PASS(test_remote_only_status, "test svn_client_status6 with ignore_local_mods"), + SVN_TEST_OPTS_PASS(test_copy_pin_externals, + "test svn_client_copy7 with externals_to_pin"), SVN_TEST_NULL }; Modified: subversion/branches/reuse-ra-session/subversion/tests/libsvn_client/mtcc-test.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/tests/libsvn_client/mtcc-test.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/tests/libsvn_client/mtcc-test.c (original) +++ subversion/branches/reuse-ra-session/subversion/tests/libsvn_client/mtcc-test.c Wed Feb 25 08:15:39 2015 @@ -472,8 +472,55 @@ struct handle_rev_baton svn_revnum_t last; svn_boolean_t up; svn_boolean_t first; + + /* Per revision handler */ + svn_txdelta_window_handler_t inner_handler; + void *inner_baton; + + /* Swapped between revisions to reconstruct data */ + svn_stringbuf_t *cur; + svn_stringbuf_t *prev; + + /* Pool for some test stuff */ + apr_pool_t *pool; }; +/* Implement svn_txdelta_window_handler_t */ +static svn_error_t * +handle_rev_delta(svn_txdelta_window_t *window, + void * baton) +{ + struct handle_rev_baton *hrb = baton; + + SVN_ERR(hrb->inner_handler(window, hrb->inner_baton)); + + if (!window) + { + int expected_rev; + const char *expected; + + /* Some revisions don't update the revision body */ + switch (hrb->last) + { + case 5: + expected_rev = 4; + break; + case 7: /* Not reported */ + case 8: + expected_rev = 6; + break; + default: + expected_rev = (int)hrb->last; + } + + expected = apr_psprintf(hrb->pool, "revision-%d", expected_rev); + + SVN_TEST_STRING_ASSERT(hrb->cur->data, expected); + } + + return SVN_NO_ERROR; +} + /* Helper for test_file_revs_both_ways */ static svn_error_t * handle_rev(void *baton, @@ -489,19 +536,38 @@ handle_rev(void *baton, struct handle_rev_baton *hrb = baton; svn_revnum_t expected_rev = hrb->up ? (hrb->last + 1) : (hrb->last - 1); + if (expected_rev == 7) + expected_rev = hrb->up ? 8 : 6; + SVN_TEST_ASSERT(rev == expected_rev); SVN_TEST_ASSERT(apr_hash_count(rev_props) >= 3); SVN_TEST_STRING_ASSERT(path, (rev < 5) ? "/iota" : "/mu"); - if (!hrb->first && rev == (hrb->up ? 5 : 4)) + if (!hrb->first + && (rev == (hrb->up ? 5 : 4) || rev == (hrb->up ? 8 : 6))) SVN_TEST_ASSERT(delta_handler == NULL); else SVN_TEST_ASSERT(delta_handler != NULL); if (delta_handler) { - *delta_handler = svn_delta_noop_window_handler; - *delta_baton = NULL; + svn_stringbuf_t *tmp; + + *delta_handler = handle_rev_delta; + *delta_baton = hrb; + + /* Swap string buffers, to use previous as original */ + tmp = hrb->prev; + hrb->prev = hrb->cur; + hrb->cur = tmp; + + svn_stringbuf_setempty(hrb->cur); + + svn_txdelta_apply(svn_stream_from_stringbuf(hrb->prev, pool), + svn_stream_from_stringbuf(hrb->cur, pool), + NULL, NULL, pool, + &hrb->inner_handler, + &hrb->inner_baton); } hrb->last = rev; @@ -579,10 +645,16 @@ test_file_revs_both_ways(const svn_test_ SVN_ERR(svn_client_open_ra_session2(&ra, repos_url, NULL, ctx, pool, subpool)); + hrb.prev = svn_stringbuf_create("", pool); + hrb.cur = svn_stringbuf_create("", pool); + hrb.pool = pool; + svn_pool_clear(subpool); hrb.up = FALSE; hrb.last = 5; hrb.first = TRUE; + svn_stringbuf_setempty(hrb.prev); + svn_stringbuf_setempty(hrb.cur); SVN_ERR(svn_ra_get_file_revs2(ra, "iota", 4, 1, FALSE, handle_rev, &hrb, subpool)); @@ -592,6 +664,8 @@ test_file_revs_both_ways(const svn_test_ hrb.up = TRUE; hrb.last = 0; hrb.first = TRUE; + svn_stringbuf_setempty(hrb.prev); + svn_stringbuf_setempty(hrb.cur); SVN_ERR(svn_ra_get_file_revs2(ra, "iota", 1, 4, FALSE, handle_rev, &hrb, subpool)); @@ -601,6 +675,8 @@ test_file_revs_both_ways(const svn_test_ hrb.up = FALSE; hrb.last = 7; hrb.first = TRUE; + svn_stringbuf_setempty(hrb.prev); + svn_stringbuf_setempty(hrb.cur); SVN_ERR(svn_ra_get_file_revs2(ra, "mu", 6, 1, FALSE, handle_rev, &hrb, subpool)); @@ -610,11 +686,41 @@ test_file_revs_both_ways(const svn_test_ hrb.up = TRUE; hrb.last = 0; hrb.first = TRUE; + svn_stringbuf_setempty(hrb.prev); + svn_stringbuf_setempty(hrb.cur); SVN_ERR(svn_ra_get_file_revs2(ra, "mu", 1, 6, FALSE, handle_rev, &hrb, subpool)); SVN_TEST_ASSERT(hrb.last == 6); - + + /* Ressurect mu */ + svn_pool_clear(subpool); + SVN_ERR(svn_client__mtcc_create(&mtcc, repos_url, 7, ctx, subpool, subpool)); + SVN_ERR(svn_client__mtcc_add_copy("mu", 6, "mu", mtcc, subpool)); + SVN_ERR(verify_mtcc_commit(mtcc, 8, subpool)); + + svn_pool_clear(subpool); + hrb.up = TRUE; + hrb.last = 0; + hrb.first = TRUE; + svn_stringbuf_setempty(hrb.prev); + svn_stringbuf_setempty(hrb.cur); + SVN_ERR(svn_ra_get_file_revs2(ra, "mu", 1, SVN_INVALID_REVNUM, FALSE, + handle_rev, &hrb, + subpool)); + SVN_TEST_ASSERT(hrb.last == 8); + + svn_pool_clear(subpool); + hrb.up = FALSE; + hrb.last = 9; + hrb.first = TRUE; + svn_stringbuf_setempty(hrb.prev); + svn_stringbuf_setempty(hrb.cur); + SVN_ERR(svn_ra_get_file_revs2(ra, "mu", SVN_INVALID_REVNUM, 1, FALSE, + handle_rev, &hrb, + subpool)); + SVN_TEST_ASSERT(hrb.last == 1); + return SVN_NO_ERROR; } Modified: subversion/branches/reuse-ra-session/subversion/tests/libsvn_fs/fs-test.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/tests/libsvn_fs/fs-test.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/tests/libsvn_fs/fs-test.c (original) +++ subversion/branches/reuse-ra-session/subversion/tests/libsvn_fs/fs-test.c Wed Feb 25 08:15:39 2015 @@ -5136,7 +5136,7 @@ filename_trailing_newline(const svn_test SVN_TEST_ASSERT(err == SVN_NO_ERROR); else SVN_TEST_ASSERT_ERROR(err, SVN_ERR_FS_PATH_SYNTAX); - + /* Create another file, with contents. */ if (!legacy_backend) @@ -5314,7 +5314,7 @@ test_compat_version(const svn_test_opts_ { svn_version_t *compatible_version; apr_hash_t *config = apr_hash_make(pool); - + svn_version_t vcurrent = {SVN_VER_MAJOR, SVN_VER_MINOR, 0, ""}; svn_version_t v1_2_0 = {1, 2, 0, ""}; svn_version_t v1_3_0 = {1, 3, 0, ""}; @@ -5493,7 +5493,7 @@ reopen_modify(const svn_test_opts_t *opt /* Create txn with changes. */ SVN_ERR(svn_fs_begin_txn(&txn, fs, head_rev, pool)); - SVN_ERR(svn_fs_txn_name(&txn_name, txn, pool)); + SVN_ERR(svn_fs_txn_name(&txn_name, txn, pool)); SVN_ERR(svn_fs_txn_root(&root, txn, pool)); SVN_ERR(svn_fs_make_dir(root, "X", pool)); @@ -5903,7 +5903,7 @@ compare_contents(const svn_test_opts_t * svn_checksum_t *checksum1, *checksum2; /* (path, rev) pairs to compare plus the expected API return values */ - struct + struct { svn_revnum_t rev1; const char *path1; @@ -5931,12 +5931,12 @@ compare_contents(const svn_test_opts_t * { 3, "bar", 4, "bar", TRUE, svn_tristate_true }, /* variations on the same theme: same content, possibly different rep */ - { 4, "foo", 4, "bar", FALSE, svn_tristate_unknown }, - { 1, "foo", 4, "bar", FALSE, svn_tristate_unknown }, - { 2, "foo", 4, "bar", FALSE, svn_tristate_unknown }, - { 1, "foo", 4, "foo", FALSE, svn_tristate_unknown }, - { 2, "foo", 4, "foo", FALSE, svn_tristate_unknown }, - { 2, "bar", 4, "bar", FALSE, svn_tristate_unknown }, + { 4, "foo", 4, "bar", FALSE, svn_tristate_unknown }, + { 1, "foo", 4, "bar", FALSE, svn_tristate_unknown }, + { 2, "foo", 4, "bar", FALSE, svn_tristate_unknown }, + { 1, "foo", 4, "foo", FALSE, svn_tristate_unknown }, + { 2, "foo", 4, "foo", FALSE, svn_tristate_unknown }, + { 2, "bar", 4, "bar", FALSE, svn_tristate_unknown }, /* EOL */ { 0 }, @@ -6743,7 +6743,7 @@ test_prop_and_text_rep_sharing_collision SVN_ERR(svn_fs_file_length(&length, rev_root, "/foo", pool)); SVN_TEST_ASSERT(length == 23); - return SVN_NO_ERROR; + return SVN_NO_ERROR; } /* ------------------------------------------------------------------------ */ @@ -6840,9 +6840,9 @@ static struct svn_test_descriptor_t test "test svn_fs__compatible_version"), SVN_TEST_OPTS_PASS(dir_prop_merge, "test merge directory properties"), - SVN_TEST_OPTS_WIMP(reopen_modify, - "test reopen and modify txn", - "txn_dir_cache fail in FSFS"), + SVN_TEST_OPTS_XFAIL_OTOH(reopen_modify, + "test reopen and modify txn", + SVN_TEST_PASS_IF_FS_TYPE_IS_NOT("fsfs")), SVN_TEST_OPTS_PASS(upgrade_while_committing, "upgrade while committing"), SVN_TEST_OPTS_PASS(test_paths_changed, Modified: subversion/branches/reuse-ra-session/subversion/tests/libsvn_fs/locks-test.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/tests/libsvn_fs/locks-test.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/tests/libsvn_fs/locks-test.c (original) +++ subversion/branches/reuse-ra-session/subversion/tests/libsvn_fs/locks-test.c Wed Feb 25 08:15:39 2015 @@ -58,7 +58,7 @@ get_locks_callback(void *baton, { apr_hash_set(b->locks, lock_path->data, lock_path->len, svn_lock_dup(lock, hash_pool)); - return SVN_NO_ERROR; + return SVN_NO_ERROR; } else { Modified: subversion/branches/reuse-ra-session/subversion/tests/libsvn_fs_fs/fs-fs-fuzzy-test.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/tests/libsvn_fs_fs/fs-fs-fuzzy-test.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/tests/libsvn_fs_fs/fs-fs-fuzzy-test.c (original) +++ subversion/branches/reuse-ra-session/subversion/tests/libsvn_fs_fs/fs-fs-fuzzy-test.c Wed Feb 25 08:15:39 2015 @@ -325,7 +325,7 @@ fuzzing_null_byte_test(const svn_test_op apr_pool_t *pool) \ { \ return svn_error_trace(fuzzing_set_byte_test(opts, N, M, pool)); \ - } + } /* Add the test function declared above to the test_funcs array. */ #define TEST_FUZZING_SET_BYTE_TEST_N(N,M)\ Modified: subversion/branches/reuse-ra-session/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c (original) +++ subversion/branches/reuse-ra-session/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c Wed Feb 25 08:15:39 2015 @@ -144,7 +144,7 @@ create_packed_filesystem(const char *dir SVN_ERR(svn_fs_txn_root(&txn_root, txn, subpool)); SVN_ERR(svn_test__create_greek_tree(txn_root, subpool)); SVN_ERR(svn_fs_change_txn_prop(txn, SVN_PROP_REVISION_LOG, - svn_string_create(R1_LOG_MSG, pool), + svn_string_create(R1_LOG_MSG, pool), pool)); SVN_ERR(svn_fs_commit_txn(&conflict, &after_rev, txn, subpool)); SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(after_rev)); @@ -1164,7 +1164,7 @@ id_parser_test(const svn_test_opts_t *op apr_pool_t *pool) { #define LONG_MAX_STR #LONG_MAX - + /* Verify the revision number parser (e.g. first element of a txn ID) */ svn_fs_fs__id_part_t id_part; SVN_ERR(svn_fs_fs__id_txn_parse(&id_part, "0-0")); Propchange: subversion/branches/reuse-ra-session/subversion/tests/libsvn_fs_x/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Feb 25 08:15:39 2015 @@ -56,6 +56,7 @@ /subversion/branches/nfc-nfd-aware-client/subversion/tests/libsvn_fs_x:870276,870376 /subversion/branches/node_pool/subversion/tests/libsvn_fs_x:1304828-1305388 /subversion/branches/performance/subversion/tests/libsvn_fs_x:979193,980118,981087,981090,981189,981194,981287,981684,981827,982043,982355,983398,983406,983430,983474,983488,983490,983760,983764,983766,983770,984927,984973,984984,985014,985037,985046,985472,985477,985482,985487-985488,985493,985497,985500,985514,985601,985603,985606,985669,985673,985695,985697,986453,986465,986485,986491-986492,986517,986521,986605,986608,986817,986832,987865,987868-987869,987872,987886-987888,987893,988319,988898,990330,990533,990535-990537,990541,990568,990572,990574-990575,990600,990759,992899,992904,992911,993127,993141,994956,995478,995507,995603,998012,998858,999098,1001413,1001417,1004291,1022668,1022670,1022676,1022715,1022719,1025660,1025672,1027193,1027203,1027206,1027214,1027227,1028077,1028092,1028094,1028104,1028107,1028111,1028354,1029038,1029042-1029043,1029054-1029055,1029062-1029063,1029078,1029080,1029090,1029092-1029093,1029111,1029151,1029158,1029229-1029230,1029232,1029335-10293 36,1029339-1029340,1029342,1029344,1030763,1030827,1031203,1031235,1032285,1032333,1033040,1033057,1033294,1035869,1035882,1039511,1043705,1053735,1056015,1066452,1067683,1067697-1078365 +/subversion/branches/pin-externals/subversion/tests/libsvn_fs_x:1643757-1659392 /subversion/branches/py-tests-as-modules/subversion/tests/libsvn_fs_x:956579-1033052 /subversion/branches/ra_serf-digest-authn/subversion/tests/libsvn_fs_x:875693-876404 /subversion/branches/reintegrate-improvements/subversion/tests/libsvn_fs_x:873853-874164 @@ -82,4 +83,4 @@ /subversion/branches/verify-at-commit/subversion/tests/libsvn_fs_x:1462039-1462408 /subversion/branches/verify-keep-going/subversion/tests/libsvn_fs_x:1439280-1492639,1546002-1546110 /subversion/branches/wc-collate-path/subversion/tests/libsvn_fs_x:1402685-1480384 -/subversion/trunk/subversion/tests/libsvn_fs_x:1414756-1657328 +/subversion/trunk/subversion/tests/libsvn_fs_x:1414756-1662176 Modified: subversion/branches/reuse-ra-session/subversion/tests/libsvn_fs_x/fs-x-pack-test.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/tests/libsvn_fs_x/fs-x-pack-test.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/tests/libsvn_fs_x/fs-x-pack-test.c (original) +++ subversion/branches/reuse-ra-session/subversion/tests/libsvn_fs_x/fs-x-pack-test.c Wed Feb 25 08:15:39 2015 @@ -166,7 +166,7 @@ create_packed_filesystem(const char *dir SVN_ERR(svn_fs_txn_root(&txn_root, txn, subpool)); SVN_ERR(svn_test__create_greek_tree(txn_root, subpool)); SVN_ERR(svn_fs_change_txn_prop(txn, SVN_PROP_REVISION_LOG, - svn_string_create(R1_LOG_MSG, pool), + svn_string_create(R1_LOG_MSG, pool), pool)); SVN_ERR(svn_fs_commit_txn(&conflict, &after_rev, txn, subpool)); SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(after_rev)); Modified: subversion/branches/reuse-ra-session/subversion/tests/libsvn_fs_x/string-table-test.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/tests/libsvn_fs_x/string-table-test.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/tests/libsvn_fs_x/string-table-test.c (original) +++ subversion/branches/reuse-ra-session/subversion/tests/libsvn_fs_x/string-table-test.c Wed Feb 25 08:15:39 2015 @@ -124,19 +124,19 @@ short_string_table_body(svn_boolean_t do apr_pool_t *pool) { apr_size_t indexes[STRING_COUNT] = { 0 }; - + string_table_builder_t *builder; string_table_t *table; int i; - + builder = svn_fs_x__string_table_builder_create(pool); for (i = 0; i < STRING_COUNT; ++i) indexes[i] = svn_fs_x__string_table_builder_add(builder, basic_strings[i], 0); - + table = svn_fs_x__string_table_create(builder, pool); if (do_load_store) SVN_ERR(store_and_load_table(&table, pool)); - + SVN_TEST_ASSERT(indexes[2] == indexes[6]); for (i = 0; i < STRING_COUNT; ++i) { Modified: subversion/branches/reuse-ra-session/subversion/tests/libsvn_ra/ra-test.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/tests/libsvn_ra/ra-test.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/tests/libsvn_ra/ra-test.c (original) +++ subversion/branches/reuse-ra-session/subversion/tests/libsvn_ra/ra-test.c Wed Feb 25 08:15:39 2015 @@ -32,6 +32,7 @@ #include "svn_error.h" #include "svn_delta.h" #include "svn_ra.h" +#include "svn_time.h" #include "svn_pools.h" #include "svn_cmdline.h" #include "svn_dirent_uri.h" @@ -41,8 +42,6 @@ #include "../svn_test_fs.h" #include "../../libsvn_ra_local/ra_local.h" -static const char tunnel_repos_name[] = "test-repo-tunnel"; - /*-------------------------------------------------------------------*/ /** Helper routines. **/ @@ -136,18 +135,36 @@ commit_tree(svn_ra_session_t *session, return SVN_NO_ERROR; } -static svn_boolean_t last_tunnel_check; -static int tunnel_open_count; -static void *check_tunnel_baton; -static void *open_tunnel_context; +/* Baton for opening tunnels */ +typedef struct tunnel_baton_t +{ + int magic; /* TUNNEL_MAGIC */ + int open_count; + svn_boolean_t last_check; +} tunnel_baton_t; + +#define TUNNEL_MAGIC 0xF00DF00F + +/* Baton for closing a specific tunnel */ +typedef struct close_baton_t +{ + int magic; + tunnel_baton_t *tb; + apr_proc_t *proc; +} close_baton_t; + +#define CLOSE_MAGIC 0x1BADBAD1 static svn_boolean_t check_tunnel(void *tunnel_baton, const char *tunnel_name) { - if (tunnel_baton != check_tunnel_baton) + tunnel_baton_t *b = tunnel_baton; + + if (b->magic != TUNNEL_MAGIC) abort(); - last_tunnel_check = (0 == strcmp(tunnel_name, "test")); - return last_tunnel_check; + + b->last_check = (0 == strcmp(tunnel_name, "test")); + return b->last_check; } static void @@ -168,8 +185,10 @@ open_tunnel(svn_stream_t **request, svn_ apr_status_t status; const char *args[] = { "svnserve", "-t", "-r", ".", NULL }; const char *svnserve; + tunnel_baton_t *b = tunnel_baton; + close_baton_t *cb; - SVN_TEST_ASSERT(tunnel_baton == check_tunnel_baton); + SVN_TEST_ASSERT(b->magic == TUNNEL_MAGIC); SVN_ERR(svn_dirent_get_absolute(&svnserve, "../../svnserve/svnserve", pool)); #ifdef WIN32 @@ -193,11 +212,7 @@ open_tunnel(svn_stream_t **request, svn_ args, NULL, attr, pool); if (status != APR_SUCCESS) return svn_error_wrap_apr(status, "Could not run svnserve"); -#ifdef WIN32 apr_pool_note_subprocess(pool, proc, APR_KILL_NEVER); -#else - apr_pool_note_subprocess(pool, proc, APR_KILL_ONLY_ONCE); -#endif /* APR pipe objects inherit by default. But we don't want the * tunnel agent's pipes held open by future child processes @@ -205,20 +220,42 @@ open_tunnel(svn_stream_t **request, svn_ apr_file_inherit_unset(proc->in); apr_file_inherit_unset(proc->out); + cb = apr_pcalloc(pool, sizeof(*cb)); + cb->magic = CLOSE_MAGIC; + cb->tb = b; + cb->proc = proc; + *request = svn_stream_from_aprfile2(proc->in, FALSE, pool); *response = svn_stream_from_aprfile2(proc->out, FALSE, pool); *close_func = close_tunnel; - open_tunnel_context = *close_baton = &last_tunnel_check; - ++tunnel_open_count; + *close_baton = cb; + ++b->open_count; return SVN_NO_ERROR; } static void close_tunnel(void *tunnel_context, void *tunnel_baton) { - assert(tunnel_context == open_tunnel_context); - assert(tunnel_baton == check_tunnel_baton); - --tunnel_open_count; + close_baton_t *b = tunnel_context; + + if (b->magic != CLOSE_MAGIC) + abort(); + if (--b->tb->open_count == 0) + { + apr_status_t child_exit_status; + int child_exit_code; + apr_exit_why_e child_exit_why; + + SVN_TEST_ASSERT_NO_RETURN(0 == apr_file_close(b->proc->in)); + SVN_TEST_ASSERT_NO_RETURN(0 == apr_file_close(b->proc->out)); + + child_exit_status = + apr_proc_wait(b->proc, &child_exit_code, &child_exit_why, APR_WAIT); + + SVN_TEST_ASSERT_NO_RETURN(child_exit_status == APR_CHILD_DONE); + SVN_TEST_ASSERT_NO_RETURN(child_exit_code == 0); + SVN_TEST_ASSERT_NO_RETURN(child_exit_why == APR_PROC_EXIT); + } } @@ -293,6 +330,7 @@ static svn_error_t * check_tunnel_callback_test(const svn_test_opts_t *opts, apr_pool_t *pool) { + tunnel_baton_t b = { TUNNEL_MAGIC }; svn_ra_callbacks2_t *cbtable; svn_ra_session_t *session; svn_error_t *err; @@ -300,7 +338,7 @@ check_tunnel_callback_test(const svn_tes SVN_ERR(svn_ra_create_callbacks(&cbtable, pool)); cbtable->check_tunnel_func = check_tunnel; cbtable->open_tunnel_func = open_tunnel; - cbtable->tunnel_baton = check_tunnel_baton = &cbtable; + cbtable->tunnel_baton = &b; SVN_ERR(svn_cmdline_create_auth_baton(&cbtable->auth_baton, TRUE /* non_interactive */, "jrandom", "rayjandom", @@ -309,13 +347,12 @@ check_tunnel_callback_test(const svn_tes FALSE /* trust_server_cert */, NULL, NULL, NULL, pool)); - last_tunnel_check = TRUE; - open_tunnel_context = NULL; + b.last_check = TRUE; err = svn_ra_open4(&session, NULL, "svn+foo://localhost/no-repo", NULL, cbtable, NULL, NULL, pool); svn_error_clear(err); SVN_TEST_ASSERT(err); - SVN_TEST_ASSERT(!last_tunnel_check); + SVN_TEST_ASSERT(!b.last_check); return SVN_NO_ERROR; } @@ -323,21 +360,26 @@ static svn_error_t * tunnel_callback_test(const svn_test_opts_t *opts, apr_pool_t *pool) { - apr_pool_t *connection_pool; - svn_repos_t *repos; + tunnel_baton_t b = { TUNNEL_MAGIC }; + apr_pool_t *scratch_pool = svn_pool_create(pool); const char *url; svn_ra_callbacks2_t *cbtable; svn_ra_session_t *session; svn_error_t *err; + const char tunnel_repos_name[] = "test-repo-tunnel"; - SVN_ERR(svn_test__create_repos(&repos, tunnel_repos_name, opts, pool)); + SVN_ERR(svn_test__create_repos(NULL, tunnel_repos_name, opts, scratch_pool)); + + /* Immediately close the repository to avoid race condition with svnserve + (and then the cleanup code) with BDB when our pool is cleared. */ + svn_pool_clear(scratch_pool); url = apr_pstrcat(pool, "svn+test://localhost/", tunnel_repos_name, SVN_VA_NULL); SVN_ERR(svn_ra_create_callbacks(&cbtable, pool)); cbtable->check_tunnel_func = check_tunnel; cbtable->open_tunnel_func = open_tunnel; - cbtable->tunnel_baton = check_tunnel_baton = &cbtable; + cbtable->tunnel_baton = &b; SVN_ERR(svn_cmdline_create_auth_baton(&cbtable->auth_baton, TRUE /* non_interactive */, "jrandom", "rayjandom", @@ -346,12 +388,9 @@ tunnel_callback_test(const svn_test_opts FALSE /* trust_server_cert */, NULL, NULL, NULL, pool)); - last_tunnel_check = FALSE; - open_tunnel_context = NULL; - tunnel_open_count = 0; - connection_pool = svn_pool_create(pool); + b.last_check = FALSE; err = svn_ra_open4(&session, NULL, url, NULL, cbtable, NULL, NULL, - connection_pool); + scratch_pool); if (err && err->apr_err == SVN_ERR_TEST_FAILED) { svn_handle_error2(err, stderr, FALSE, "svn_tests: "); @@ -359,10 +398,10 @@ tunnel_callback_test(const svn_test_opts return SVN_NO_ERROR; } SVN_ERR(err); - SVN_TEST_ASSERT(last_tunnel_check); - SVN_TEST_ASSERT(tunnel_open_count > 0); - svn_pool_destroy(connection_pool); - SVN_TEST_ASSERT(tunnel_open_count == 0); + SVN_TEST_ASSERT(b.last_check); + SVN_TEST_ASSERT(b.open_count > 0); + svn_pool_destroy(scratch_pool); + SVN_TEST_ASSERT(b.open_count == 0); return SVN_NO_ERROR; } @@ -403,7 +442,7 @@ lock_cb(void *baton, result->err = ra_err; svn_hash_sets(b->results, apr_pstrdup(b->pool, path), result); - + return SVN_NO_ERROR; } @@ -578,6 +617,52 @@ get_dir_test(const svn_test_opts_t *opts return SVN_NO_ERROR; } +/* Implements svn_commit_callback2_t for commit_callback_failure() */ +static svn_error_t * +commit_callback_with_failure(const svn_commit_info_t *info, + void *baton, + apr_pool_t *scratch_pool) +{ + apr_time_t timetemp; + + SVN_TEST_ASSERT(info != NULL); + SVN_TEST_STRING_ASSERT(info->author, "jrandom"); + SVN_TEST_STRING_ASSERT(info->post_commit_err, NULL); + + SVN_ERR(svn_time_from_cstring(&timetemp, info->date, scratch_pool)); + SVN_TEST_ASSERT(timetemp != 0); + SVN_TEST_ASSERT(info->repos_root != NULL); + SVN_TEST_ASSERT(info->revision == 1); + + return svn_error_create(SVN_ERR_CANCELLED, NULL, NULL); +} + +static svn_error_t * +commit_callback_failure(const svn_test_opts_t *opts, + apr_pool_t *pool) +{ + svn_ra_session_t *ra_session; + const svn_delta_editor_t *editor; + void *edit_baton; + void *root_baton; + SVN_ERR(make_and_open_repos(&ra_session, "commit_cb_failure", opts, pool)); + + SVN_ERR(svn_ra_get_commit_editor3(ra_session, &editor, &edit_baton, + apr_hash_make(pool), commit_callback_with_failure, + NULL, NULL, FALSE, pool)); + + SVN_ERR(editor->open_root(edit_baton, 1, pool, &root_baton)); + SVN_ERR(editor->change_dir_prop(root_baton, "A", + svn_string_create("B", pool), pool)); + SVN_ERR(editor->close_directory(root_baton, pool)); + SVN_TEST_ASSERT_ERROR(editor->close_edit(edit_baton, pool), + SVN_ERR_CANCELLED); + + /* This is what users should do if close_edit fails... Except that in this case + the commit actually succeeded*/ + SVN_ERR(editor->abort_edit(edit_baton, pool)); + return SVN_NO_ERROR; +} /* The test table. */ @@ -597,6 +682,8 @@ static struct svn_test_descriptor_t test "lock multiple paths"), SVN_TEST_OPTS_PASS(get_dir_test, "test ra_get_dir2"), + SVN_TEST_OPTS_PASS(commit_callback_failure, + "commit callback failure"), SVN_TEST_NULL }; Modified: subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/cache-test.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/cache-test.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/cache-test.c (original) +++ subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/cache-test.c Wed Feb 25 08:15:39 2015 @@ -290,7 +290,7 @@ test_membuffer_serializer_error_handling /* Test setting data in cache using partial setter that always raises an error. */ SVN_TEST_ASSERT_ERROR( - svn_cache__set_partial(cache, "twenty", + svn_cache__set_partial(cache, "twenty", raise_error_partial_setter_func, NULL, pool), APR_EGENERAL); @@ -354,6 +354,74 @@ test_memcache_long_key(const svn_test_op return SVN_NO_ERROR; } +static svn_error_t * +test_membuffer_cache_clearing(apr_pool_t *pool) +{ + svn_cache__t *cache; + svn_membuffer_t *membuffer; + svn_boolean_t found; + svn_revnum_t *value; + svn_revnum_t valueA = 12345; + svn_revnum_t valueB = 67890; + + /* Create a simple cache for strings, keyed by strings. */ + SVN_ERR(svn_cache__membuffer_cache_create(&membuffer, 10*1024, 1, 0, + TRUE, TRUE, pool)); + SVN_ERR(svn_cache__create_membuffer_cache(&cache, + membuffer, + serialize_revnum, + deserialize_revnum, + APR_HASH_KEY_STRING, + "cache:", + SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY, + FALSE, + pool, pool)); + + /* Initially, the cache is empty. */ + SVN_ERR(svn_cache__get((void **) &value, &found, cache, "key A", pool)); + SVN_TEST_ASSERT(!found); + SVN_ERR(svn_cache__get((void **) &value, &found, cache, "key B", pool)); + SVN_TEST_ASSERT(!found); + SVN_ERR(svn_cache__get((void **) &value, &found, cache, "key C", pool)); + SVN_TEST_ASSERT(!found); + + /* Add entries. */ + SVN_ERR(svn_cache__set(cache, "key A", &valueA, pool)); + SVN_ERR(svn_cache__set(cache, "key B", &valueB, pool)); + + /* Added entries should be cached (too small to get evicted already). */ + SVN_ERR(svn_cache__get((void **) &value, &found, cache, "key A", pool)); + SVN_TEST_ASSERT(found); + SVN_TEST_ASSERT(*value == valueA); + SVN_ERR(svn_cache__get((void **) &value, &found, cache, "key B", pool)); + SVN_TEST_ASSERT(found); + SVN_TEST_ASSERT(*value == valueB); + SVN_ERR(svn_cache__get((void **) &value, &found, cache, "key C", pool)); + SVN_TEST_ASSERT(!found); + + /* Clear the cache. */ + SVN_ERR(svn_cache__membuffer_clear(membuffer)); + + /* The cache is empty again. */ + SVN_ERR(svn_cache__get((void **) &value, &found, cache, "key A", pool)); + SVN_TEST_ASSERT(!found); + SVN_ERR(svn_cache__get((void **) &value, &found, cache, "key B", pool)); + SVN_TEST_ASSERT(!found); + SVN_ERR(svn_cache__get((void **) &value, &found, cache, "key C", pool)); + SVN_TEST_ASSERT(!found); + + /* But still functional: */ + SVN_ERR(svn_cache__set(cache, "key B", &valueB, pool)); + SVN_ERR(svn_cache__has_key(&found, cache, "key A", pool)); + SVN_TEST_ASSERT(!found); + SVN_ERR(svn_cache__has_key(&found, cache, "key B", pool)); + SVN_TEST_ASSERT(found); + SVN_ERR(svn_cache__has_key(&found, cache, "key C", pool)); + SVN_TEST_ASSERT(!found); + + return SVN_NO_ERROR; +} + /* The test table. */ @@ -372,6 +440,8 @@ static struct svn_test_descriptor_t test "basic membuffer svn_cache test"), SVN_TEST_PASS2(test_membuffer_serializer_error_handling, "test for error handling in membuffer svn_cache"), + SVN_TEST_PASS2(test_membuffer_cache_clearing, + "test clearing a membuffer svn_cache"), SVN_TEST_NULL }; Modified: subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/checksum-test.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/checksum-test.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/checksum-test.c (original) +++ subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/checksum-test.c Wed Feb 25 08:15:39 2015 @@ -170,7 +170,7 @@ zero_cross_match(apr_pool_t *pool) { svn_checksum_t *i_zero; svn_checksum_t *i_A; - + i_zero = svn_checksum_create(i_kind, pool); SVN_ERR(svn_checksum_clear(i_zero)); SVN_ERR(svn_checksum(&i_A, i_kind, "A", 1, pool)); Modified: subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/config-test.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/config-test.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/config-test.c (original) +++ subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/config-test.c Wed Feb 25 08:15:39 2015 @@ -363,7 +363,7 @@ test_expand(const svn_test_opts_t *opts, /* Get expanded "c". */ svn_config_get(cfg, &val, "section1", "c", NULL); - /* With pool debugging enabled this ensures that the expanded value + /* With pool debugging enabled this ensures that the expanded value of "c" was not created in a temporary pool when expanding "g". */ SVN_TEST_STRING_ASSERT(val, "bar"); Modified: subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/io-test.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/io-test.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/io-test.c (original) +++ subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/io-test.c Wed Feb 25 08:15:39 2015 @@ -703,7 +703,7 @@ ignore_enoent(apr_pool_t *pool) SVN_ERR(svn_io_set_file_executable(path, FALSE, TRUE, pool)); SVN_ERR(svn_io_stat_dirent2(&dirent_p, path, TRUE, TRUE, pool, pool)); SVN_ERR(svn_io_stat_dirent2(&dirent_p, path, FALSE, TRUE, pool, pool)); - + /* Neither path nor parent exists. */ path = svn_dirent_join(path, "not-present", pool); SVN_ERR(svn_io_remove_dir2(path, TRUE, NULL, NULL, pool)); Modified: subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/packed-data-test.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/packed-data-test.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/packed-data-test.c (original) +++ subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/packed-data-test.c Wed Feb 25 08:15:39 2015 @@ -99,7 +99,7 @@ verify_uint_stream(const apr_uint64_t *v SVN_TEST_ASSERT(stream); SVN_TEST_ASSERT(!svn_packed__next_int_stream(stream)); SVN_TEST_ASSERT(!svn_packed__first_byte_stream(root)); - + /* the stream shall contain exactly the items we put into it */ SVN_TEST_ASSERT(svn_packed__int_count(stream) == count); for (i = 0; i < count; ++i) @@ -356,7 +356,7 @@ pack(const base_record_t *data, svn_packed__create_int_substream(base_stream, TRUE, TRUE); /* large_signed1 */ svn_packed__create_int_substream(base_stream, FALSE, TRUE); /* large_signed2 */ svn_packed__create_int_substream(base_stream, TRUE, FALSE); /* prime */ - + for (i = 0; i < count; ++i) { svn_packed__add_int(base_stream, data[i].counter); @@ -434,7 +434,7 @@ unpack(apr_size_t *count, base_record_t *data; *count = svn_packed__int_count(sub_count_stream) / 2; data = apr_pcalloc(pool, *count * sizeof(*data)); - + for (i = 0; i < *count; ++i) { data[i].counter = (int) svn_packed__get_int(base_stream); Modified: subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/priority-queue-test.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/priority-queue-test.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/priority-queue-test.c (original) +++ subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/priority-queue-test.c Wed Feb 25 08:15:39 2015 @@ -70,7 +70,7 @@ verify_empty_queue(svn_priority_queue__t /* these should be no-ops */ svn_priority_queue__update(queue); svn_priority_queue__pop(queue); - + return SVN_NO_ERROR; } Modified: subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/sqlite-test.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/sqlite-test.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/sqlite-test.c (original) +++ subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/sqlite-test.c Wed Feb 25 08:15:39 2015 @@ -49,7 +49,7 @@ static svn_error_t * error_second(svn_sqlite__context_t *sctx, int argc, svn_sqlite__value_t *values[], - apr_pool_t *scratch_pool) + void *baton) { static int i = 0; @@ -57,7 +57,7 @@ error_second(svn_sqlite__context_t *sctx svn_sqlite__result_error(sctx, "fake error", 0); else svn_sqlite__result_int64(sctx, 1); - + return SVN_NO_ERROR; } @@ -102,7 +102,7 @@ test_sqlite_reset(apr_pool_t *pool) /* The svn_sqlite__step wrapper calls svn_sqlite__reset when step fails so the reset call here is a no-op. The first step can be - repeated. */ + repeated. */ SVN_ERR(svn_sqlite__reset(stmt)); SVN_ERR(svn_sqlite__step(&have_row, stmt)); SVN_TEST_ASSERT(have_row); Modified: subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/string-test.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/string-test.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/string-test.c (original) +++ subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/string-test.c Wed Feb 25 08:15:39 2015 @@ -849,7 +849,7 @@ test_string_matching(apr_pool_t *pool) SVN_TEST_ASSERT(match_len == test->match_len); SVN_TEST_ASSERT(rmatch_len == test->rmatch_len); } - + return SVN_NO_ERROR; } Modified: subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/subst_translate-test.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/subst_translate-test.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/subst_translate-test.c (original) +++ subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/subst_translate-test.c Wed Feb 25 08:15:39 2015 @@ -115,7 +115,7 @@ test_svn_subst_translate_string2_null_en svn_string_t *new_value = NULL; svn_boolean_t translated_to_utf8 = FALSE; svn_boolean_t translated_line_endings = TRUE; - /* 'Æ', which is 0xc6 in both ISO-8859-1 and Windows-1252 */ + /* The 'AE' ligature, which is 0xc6 in both ISO-8859-1 and Windows-1252 */ svn_string_t *source_string = svn_string_create("\xc6", pool); SVN_ERR(svn_subst_translate_string2(&new_value, &translated_to_utf8, @@ -397,7 +397,7 @@ test_svn_subst_long_keywords(apr_pool_t "01234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567"; - /* The longest keyword that can be expanded: the value is empty. */ + /* The longest keyword that can be expanded: the value is empty. */ const char keyword_z[] = "Q" "01234567890123456789012345678901234567890123456789" Modified: subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/x509-test.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/x509-test.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/x509-test.c (original) +++ subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/x509-test.c Wed Feb 25 08:15:39 2015 @@ -151,7 +151,7 @@ static struct x509_test cert_tests[] = { "b3b9789d8a53868f418619565f6b56af0033bdd3" }, /* The issuer and subject (except for the country code) is * UnversalString encoded. Created with a hacked version of openssl - * using utf8=yes and string_mask=MASK:256. In order for that to + * using utf8=yes and string_mask=MASK:256. In order for that to * output UniversalString encoded data you need to change the * DIRSTRING_TYPE in crypto/asn1/asn1.h to be defined as * B_ASN1_DIRECTORYSTRING so that UnviersalString is available to be Propchange: subversion/branches/reuse-ra-session/subversion/tests/libsvn_subr/x509-test.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: subversion/branches/reuse-ra-session/subversion/tests/libsvn_wc/conflict-data-test.c URL: http://svn.apache.org/viewvc/subversion/branches/reuse-ra-session/subversion/tests/libsvn_wc/conflict-data-test.c?rev=1662177&r1=1662176&r2=1662177&view=diff ============================================================================== --- subversion/branches/reuse-ra-session/subversion/tests/libsvn_wc/conflict-data-test.c (original) +++ subversion/branches/reuse-ra-session/subversion/tests/libsvn_wc/conflict-data-test.c Wed Feb 25 08:15:39 2015 @@ -294,6 +294,7 @@ test_read_write_tree_conflicts(const svn SVN_ERR(sbox_wc_mkdir(&sbox, "A")); SVN_ERR(sbox_wc_mkdir(&sbox, "A/bar")); SVN_ERR(sbox_file_write(&sbox, "A/foo", "")); + SVN_ERR(sbox_wc_add(&sbox, "A/foo")); conflict1 = tree_conflict_create(child1_abspath, svn_node_file, svn_wc_operation_merge,
