You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2016/04/29 20:38:56 UTC
svn commit: r1741682 [25/26] - in /subversion/branches/authzperf: ./ build/
build/ac-macros/ build/generator/ contrib/server-side/svncutter/ notes/
notes/api-errata/1.9/ notes/move-tracking/ subversion/
subversion/bindings/ctypes-python/ subversion/bin...
Modified: subversion/branches/authzperf/subversion/tests/libsvn_fs/fs-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/libsvn_fs/fs-test.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/libsvn_fs/fs-test.c (original)
+++ subversion/branches/authzperf/subversion/tests/libsvn_fs/fs-test.c Fri Apr 29 18:38:53 2016
@@ -24,6 +24,7 @@
#include <string.h>
#include <apr_pools.h>
#include <apr_thread_proc.h>
+#include <apr_poll.h>
#include <assert.h>
#include "../svn_test.h"
@@ -42,6 +43,7 @@
#include "private/svn_fs_util.h"
#include "private/svn_fs_private.h"
#include "private/svn_fspath.h"
+#include "private/svn_sqlite.h"
#include "../svn_test_fs.h"
@@ -224,6 +226,8 @@ reopen_trivial_transaction(const svn_tes
/* Don't use the subpool, txn_name must persist beyond the current txn */
SVN_ERR(svn_fs_txn_name(&txn_name, txn, pool));
+ SVN_TEST_ASSERT(svn_fs_txn_base_revision(txn) == 0);
+
/* Create a third transaction - we don't want that one to reopen. */
SVN_ERR(svn_fs_begin_txn(&txn, fs, 0, subpool));
@@ -237,7 +241,43 @@ reopen_trivial_transaction(const svn_tes
SVN_ERR(svn_fs_txn_root(&root, txn, subpool));
SVN_TEST_STRING_ASSERT(svn_fs_txn_root_name(root, subpool), txn_name);
+ SVN_TEST_ASSERT(svn_fs_txn_base_revision(txn) == 0);
+
+ {
+ const char *conflict;
+ svn_revnum_t new_rev;
+ SVN_ERR(svn_fs_commit_txn(&conflict, &new_rev, txn, subpool));
+ SVN_TEST_STRING_ASSERT(conflict, NULL);
+ SVN_TEST_ASSERT(new_rev == 1);
+ }
+
+ /* Close the transaction ... again. */
+ svn_pool_clear(subpool);
+
+ /* Begin another transaction that is based on revision 1. */
+ SVN_ERR(svn_fs_begin_txn(&txn, fs, 1, subpool));
+
+ /* Don't use the subpool, txn_name must persist beyond the current txn */
+ SVN_ERR(svn_fs_txn_name(&txn_name, txn, pool));
+
+ SVN_TEST_ASSERT(svn_fs_txn_base_revision(txn) == 1);
+
+ /* Keep the txn name in pool */
+ SVN_ERR(svn_fs_txn_name(&txn_name, txn, pool));
+
/* Close the transaction ... again. */
+ svn_pool_clear(subpool);
+
+ /* Reopen the transaction by name ... again */
+ SVN_ERR(svn_fs_open_txn(&txn, fs, txn_name, subpool));
+
+ /* Does it have the same name? ... */
+ SVN_ERR(svn_fs_txn_root(&root, txn, subpool));
+ SVN_TEST_STRING_ASSERT(svn_fs_txn_root_name(root, subpool), txn_name);
+
+ /* And the same base revision? */
+ SVN_TEST_ASSERT(svn_fs_txn_base_revision(txn) == 1);
+
svn_pool_destroy(subpool);
return SVN_NO_ERROR;
@@ -333,6 +373,7 @@ txn_names_are_not_reused_helper1(apr_has
apr_hash_index_t *hi;
const int N = 10;
int i;
+ apr_pool_t *subpool = svn_pool_create(pool);
*txn_names = apr_hash_make(pool);
@@ -342,7 +383,8 @@ txn_names_are_not_reused_helper1(apr_has
{
svn_fs_txn_t *txn;
const char *name;
- SVN_ERR(svn_fs_begin_txn(&txn, fs, 0, pool));
+
+ SVN_ERR(svn_fs_begin_txn(&txn, fs, 0, subpool));
SVN_ERR(svn_fs_txn_name(&name, txn, pool));
if (apr_hash_get(*txn_names, name, APR_HASH_KEY_STRING) != NULL)
return svn_error_createf(SVN_ERR_FS_GENERAL, NULL,
@@ -366,6 +408,7 @@ txn_names_are_not_reused_helper1(apr_has
"created %d transactions, but only aborted %d",
N, i);
+ svn_pool_destroy(subpool);
return SVN_NO_ERROR;
}
@@ -1017,8 +1060,9 @@ check_entry(svn_fs_root_t *root,
{
apr_hash_t *entries;
svn_fs_dirent_t *ent;
+ apr_pool_t *subpool = svn_pool_create(pool);
- SVN_ERR(svn_fs_dir_entries(&entries, root, path, pool));
+ SVN_ERR(svn_fs_dir_entries(&entries, root, path, subpool));
ent = apr_hash_get(entries, name, APR_HASH_KEY_STRING);
if (ent)
@@ -1026,6 +1070,7 @@ check_entry(svn_fs_root_t *root,
else
*present = FALSE;
+ svn_pool_destroy(subpool);
return SVN_NO_ERROR;
}
@@ -4760,6 +4805,7 @@ closest_copy_test(const svn_test_opts_t
SVN_ERR(svn_fs_txn_root(&txn_root, txn, spool));
SVN_ERR(svn_test__create_greek_tree(txn_root, spool));
SVN_ERR(test_commit_txn(&after_rev, txn, NULL, spool));
+ svn_pool_clear(spool);
SVN_ERR(svn_fs_revision_root(&rev_root, fs, after_rev, spool));
/* Copy A to Z, and commit. */
@@ -4767,6 +4813,7 @@ closest_copy_test(const svn_test_opts_t
SVN_ERR(svn_fs_txn_root(&txn_root, txn, spool));
SVN_ERR(svn_fs_copy(rev_root, "A", txn_root, "Z", spool));
SVN_ERR(test_commit_txn(&after_rev, txn, NULL, spool));
+ svn_pool_clear(spool);
SVN_ERR(svn_fs_revision_root(&rev_root, fs, after_rev, spool));
/* Anything under Z should have a closest copy pair of ("/Z", 2), so
@@ -4803,6 +4850,7 @@ closest_copy_test(const svn_test_opts_t
SVN_ERR(svn_fs_make_file(txn_root, "Z/t", pool));
SVN_ERR(svn_fs_make_file(txn_root, "Z2/D/H2/t", pool));
SVN_ERR(test_commit_txn(&after_rev, txn, NULL, spool));
+ svn_pool_clear(spool);
SVN_ERR(svn_fs_revision_root(&rev_root, fs, after_rev, spool));
/* Okay, just for kicks, let's modify Z2/D/H2/t. Shouldn't affect
@@ -4812,6 +4860,7 @@ closest_copy_test(const svn_test_opts_t
SVN_ERR(svn_test__set_file_contents(txn_root, "Z2/D/H2/t",
"Edited text.", spool));
SVN_ERR(test_commit_txn(&after_rev, txn, NULL, spool));
+ svn_pool_clear(spool);
SVN_ERR(svn_fs_revision_root(&rev_root, fs, after_rev, spool));
/* Now, we expect Z2/D/H2 to have a closest copy of ("/Z2/D/H2", 3)
@@ -5352,7 +5401,7 @@ test_fs_info_format(const svn_test_opts_
opts2 = *opts;
opts2.server_minor_version = is_fsx ? 10 : 5;
- SVN_ERR(svn_test__create_fs(&fs, "test-fs-format-info", &opts2, pool));
+ SVN_ERR(svn_test__create_fs(&fs, "test-repo-fs-format-info", &opts2, pool));
SVN_ERR(svn_fs_info_format(&fs_format, &supports_version, fs, pool, pool));
if (is_fsx)
@@ -5394,7 +5443,7 @@ commit_timestamp(const svn_test_opts_t *
svn_string_t *svn_date;
svn_string_t *txn_svn_date;
- SVN_ERR(svn_test__create_fs(&fs, "test-fs-commit-timestamp",
+ SVN_ERR(svn_test__create_fs(&fs, "test-repo-fs-commit-timestamp",
opts, pool));
/* Commit with a specified svn:date. */
@@ -5547,7 +5596,8 @@ dir_prop_merge(const svn_test_opts_t *op
svn_boolean_t is_bdb = strcmp(opts->fs_type, SVN_FS_TYPE_BDB) == 0;
/* Create test repository. */
- SVN_ERR(svn_test__create_fs(&fs, "test-fs-dir_prop-merge", opts, pool));
+ SVN_ERR(svn_test__create_fs(&fs, "test-repo-fs-dir_prop-merge", opts,
+ pool));
SVN_ERR(svn_fs_begin_txn(&txn, fs, 0, pool));
SVN_ERR(svn_fs_txn_root(&root, txn, pool));
@@ -5631,7 +5681,7 @@ upgrade_while_committing(const svn_test_
"pre-1.6 SVN doesn't support FSFS packing");
/* Create test repository with greek tree. */
- fs_path = "test-upgrade-while-committing";
+ fs_path = "test-repo-upgrade-while-committing";
svn_hash_sets(fs_config, SVN_FS_CONFIG_COMPATIBLE_VERSION, "1.7");
svn_hash_sets(fs_config, SVN_FS_CONFIG_FSFS_SHARD_SIZE, "2");
@@ -5720,7 +5770,7 @@ test_paths_changed(const svn_test_opts_t
has_mergeinfo_mod = TRUE;
/* Create test repository with greek tree. */
- fs_path = "test-paths-changed";
+ fs_path = "test-repo-paths-changed";
SVN_ERR(svn_test__create_fs2(&fs, fs_path, opts, NULL, pool));
@@ -5817,7 +5867,7 @@ test_delete_replaced_paths_changed(const
const svn_fs_id_t *file_id;
/* Create test repository with greek tree. */
- fs_path = "test-delete-replace-paths-changed";
+ fs_path = "test-repo-delete-replace-paths-changed";
SVN_ERR(svn_test__create_fs2(&fs, fs_path, opts, NULL, pool));
@@ -5950,6 +6000,9 @@ purge_txn_test(const svn_test_opts_t *op
return SVN_NO_ERROR;
}
+/* Test svn_fs_{contents,props}_{different,changed}().
+ * ### This currently only tests them on revision roots, not on txn roots.
+ */
static svn_error_t *
compare_contents(const svn_test_opts_t *opts,
apr_pool_t *pool)
@@ -5961,6 +6014,7 @@ compare_contents(const svn_test_opts_t *
svn_revnum_t rev;
int i;
apr_pool_t *iterpool = svn_pool_create(pool);
+ svn_boolean_t changed;
/* Two similar but different texts that yield the same MD5 digest. */
const char *evil_text1
@@ -6143,6 +6197,21 @@ compare_contents(const svn_test_opts_t *
}
}
+ /* Check how svn_fs_contents_different() and svn_fs_contents_changed()
+ handles invalid path.*/
+ SVN_ERR(svn_fs_revision_root(&root1, fs, 1, iterpool));
+ SVN_TEST_ASSERT_ANY_ERROR(
+ svn_fs_contents_changed(&changed, root1, "/", root1, "/", iterpool));
+ SVN_TEST_ASSERT_ANY_ERROR(
+ svn_fs_contents_different(&changed, root1, "/", root1, "/", iterpool));
+
+ SVN_TEST_ASSERT_ANY_ERROR(
+ svn_fs_contents_changed(&changed, root1, "/non-existent", root1,
+ "/non-existent", iterpool));
+ SVN_TEST_ASSERT_ANY_ERROR(
+ svn_fs_contents_different(&changed, root1, "/non-existent", root1,
+ "/non-existent", iterpool));
+
svn_pool_destroy(iterpool);
return SVN_NO_ERROR;
@@ -6495,6 +6564,7 @@ test_delta_file_stream(const svn_test_op
svn_fs_txn_t *txn;
svn_fs_root_t *txn_root, *root1, *root2;
svn_revnum_t rev;
+ apr_pool_t *subpool = svn_pool_create(pool);
const char *old_content = "some content";
const char *new_content = "some more content";
@@ -6526,52 +6596,56 @@ test_delta_file_stream(const svn_test_op
/* Test 1: Get delta against empty target. */
SVN_ERR(svn_fs_get_file_delta_stream(&delta_stream,
- NULL, NULL, root1, "foo", pool));
+ NULL, NULL, root1, "foo", subpool));
svn_stringbuf_setempty(source);
svn_stringbuf_setempty(dest);
- svn_txdelta_apply(svn_stream_from_stringbuf(source, pool),
- svn_stream_from_stringbuf(dest, pool),
- NULL, NULL, pool, &delta_handler, &delta_baton);
+ svn_txdelta_apply(svn_stream_from_stringbuf(source, subpool),
+ svn_stream_from_stringbuf(dest, subpool),
+ NULL, NULL, subpool, &delta_handler, &delta_baton);
SVN_ERR(svn_txdelta_send_txstream(delta_stream,
delta_handler,
delta_baton,
- pool));
+ subpool));
SVN_TEST_STRING_ASSERT(old_content, dest->data);
+ svn_pool_clear(subpool);
/* Test 2: Get delta against previous version. */
SVN_ERR(svn_fs_get_file_delta_stream(&delta_stream,
- root1, "foo", root2, "foo", pool));
+ root1, "foo", root2, "foo", subpool));
svn_stringbuf_set(source, old_content);
svn_stringbuf_setempty(dest);
- svn_txdelta_apply(svn_stream_from_stringbuf(source, pool),
- svn_stream_from_stringbuf(dest, pool),
- NULL, NULL, pool, &delta_handler, &delta_baton);
+ svn_txdelta_apply(svn_stream_from_stringbuf(source, subpool),
+ svn_stream_from_stringbuf(dest, subpool),
+ NULL, NULL, subpool, &delta_handler, &delta_baton);
SVN_ERR(svn_txdelta_send_txstream(delta_stream,
delta_handler,
delta_baton,
- pool));
+ subpool));
SVN_TEST_STRING_ASSERT(new_content, dest->data);
+ svn_pool_clear(subpool);
/* Test 3: Get reverse delta. */
SVN_ERR(svn_fs_get_file_delta_stream(&delta_stream,
- root2, "foo", root1, "foo", pool));
+ root2, "foo", root1, "foo", subpool));
svn_stringbuf_set(source, new_content);
svn_stringbuf_setempty(dest);
- svn_txdelta_apply(svn_stream_from_stringbuf(source, pool),
- svn_stream_from_stringbuf(dest, pool),
- NULL, NULL, pool, &delta_handler, &delta_baton);
+ svn_txdelta_apply(svn_stream_from_stringbuf(source, subpool),
+ svn_stream_from_stringbuf(dest, subpool),
+ NULL, NULL, subpool, &delta_handler, &delta_baton);
SVN_ERR(svn_txdelta_send_txstream(delta_stream,
delta_handler,
delta_baton,
- pool));
+ subpool));
SVN_TEST_STRING_ASSERT(old_content, dest->data);
+ svn_pool_destroy(subpool);
+
return SVN_NO_ERROR;
}
@@ -6628,6 +6702,9 @@ test_fsfs_config_opts(const svn_test_opt
svn_fs_t *fs;
const svn_fs_info_placeholder_t *fs_info;
const svn_fs_fsfs_info_t *fsfs_info;
+ const char *dir_name = "test-repo-fsfs-config-opts";
+ const char *repo_name_default = "test-repo-fsfs-config-opts/default";
+ const char *repo_name_custom = "test-repo-fsfs-config-opts/custom";
/* Bail (with SKIP) on known-untestable scenarios */
if (strcmp(opts->fs_type, SVN_FS_TYPE_FSFS) != 0)
@@ -6635,19 +6712,19 @@ test_fsfs_config_opts(const svn_test_opt
"this will test FSFS repositories only");
/* Remove the test directory from previous runs. */
- SVN_ERR(svn_io_remove_dir2("test-fsfs-config-opts", TRUE, NULL, NULL, pool));
+ SVN_ERR(svn_io_remove_dir2(dir_name, TRUE, NULL, NULL, pool));
/* Create the test directory and add it to the test cleanup list. */
- SVN_ERR(svn_io_dir_make("test-fsfs-config-opts", APR_OS_DEFAULT, pool));
- svn_test_add_dir_cleanup("test-fsfs-config-opts");
+ SVN_ERR(svn_io_dir_make(dir_name, APR_OS_DEFAULT, pool));
+ svn_test_add_dir_cleanup(dir_name);
/* Create an FSFS filesystem with default config.*/
fs_config = apr_hash_make(pool);
svn_hash_sets(fs_config, SVN_FS_CONFIG_FS_TYPE, SVN_FS_TYPE_FSFS);
- SVN_ERR(svn_fs_create(&fs, "test-fsfs-config-opts/default", fs_config, pool));
+ SVN_ERR(svn_fs_create(&fs, repo_name_default, fs_config, pool));
/* Re-open FS to test the data on disk. */
- SVN_ERR(svn_fs_open2(&fs, "test-fsfs-config-opts/default", NULL, pool, pool));
+ SVN_ERR(svn_fs_open2(&fs, repo_name_default, NULL, pool, pool));
SVN_ERR(svn_fs_info(&fs_info, fs, pool, pool));
SVN_TEST_STRING_ASSERT(fs_info->fs_type, SVN_FS_TYPE_FSFS);
@@ -6664,10 +6741,10 @@ test_fsfs_config_opts(const svn_test_opt
svn_hash_sets(fs_config, SVN_FS_CONFIG_FS_TYPE, SVN_FS_TYPE_FSFS);
svn_hash_sets(fs_config, SVN_FS_CONFIG_FSFS_LOG_ADDRESSING, "false");
svn_hash_sets(fs_config, SVN_FS_CONFIG_FSFS_SHARD_SIZE, "123");
- SVN_ERR(svn_fs_create(&fs, "test-fsfs-config-opts/custom", fs_config, pool));
+ SVN_ERR(svn_fs_create(&fs, repo_name_custom, fs_config, pool));
/* Re-open FS to test the data on disk. */
- SVN_ERR(svn_fs_open2(&fs, "test-fsfs-config-opts/custom", NULL, pool, pool));
+ SVN_ERR(svn_fs_open2(&fs, repo_name_custom, NULL, pool, pool));
SVN_ERR(svn_fs_info(&fs_info, fs, pool, pool));
SVN_TEST_STRING_ASSERT(fs_info->fs_type, SVN_FS_TYPE_FSFS);
@@ -6741,7 +6818,7 @@ test_modify_txn_being_written(const svn_
"this will not test BDB repositories");
/* Create a new repo. */
- SVN_ERR(svn_test__create_fs(&fs, "test-modify-txn-being-written",
+ SVN_ERR(svn_test__create_fs(&fs, "test-repo-modify-txn-being-written",
opts, pool));
/* Create a TXN_ROOT referencing FS. */
@@ -6789,7 +6866,7 @@ test_prop_and_text_rep_sharing_collision
svn_fs_root_t *rev_root;
svn_revnum_t new_rev;
svn_filesize_t length;
- const char *testdir = "test-prop-and-text-rep-sharing-collision";
+ const char *testdir = "test-repo-prop-and-text-rep-sharing-collision";
/* Create a new repo. */
SVN_ERR(svn_test__create_fs(&fs, testdir, opts, pool));
@@ -6908,12 +6985,13 @@ freeze_and_commit(const svn_test_opts_t
svn_fs_root_t *txn_root;
svn_revnum_t new_rev = 0;
apr_pool_t *subpool = svn_pool_create(pool);
+ const char *repo_name = "test-repo-freeze-and-commit";
if (!strcmp(opts->fs_type, "bdb"))
return svn_error_create(SVN_ERR_TEST_SKIPPED, NULL,
"this will not test BDB repositories");
- SVN_ERR(svn_test__create_fs(&fs, "test-freeze-and-commit", opts, subpool));
+ SVN_ERR(svn_test__create_fs(&fs, repo_name, opts, subpool));
/* This test used to FAIL with an SQLite error since svn_fs_freeze()
* wouldn't unlock rep-cache.db. Therefore, part of the role of creating
@@ -6945,7 +7023,7 @@ freeze_and_commit(const svn_test_opts_t
SVN_ERR(test_commit_txn(&new_rev, txn, NULL, pool));
/* Re-open FS and make another commit. */
- SVN_ERR(svn_fs_open(&fs, "test-freeze-and-commit", NULL, subpool));
+ SVN_ERR(svn_fs_open(&fs, repo_name, NULL, subpool));
SVN_ERR(svn_fs_begin_txn(&txn, fs, new_rev, pool));
SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
SVN_ERR(svn_fs_change_node_prop(txn_root, "/", "temperature",
@@ -6956,6 +7034,165 @@ freeze_and_commit(const svn_test_opts_t
return SVN_NO_ERROR;
}
+/* Number of changes in a revision.
+ * Should be > 100 to span multiple blocks. */
+#define CHANGES_COUNT 1017
+
+/* Check that REVISION in FS reports the expected changes. */
+static svn_error_t *
+verify_added_files_list(svn_fs_t *fs,
+ svn_revnum_t revision,
+ apr_pool_t *scratch_pool)
+{
+ int i;
+ svn_fs_root_t *root;
+ apr_hash_t *changed_paths;
+ svn_fs_path_change_iterator_t *iterator;
+ svn_fs_path_change3_t *change;
+ apr_pool_t *iterpool = svn_pool_create(scratch_pool);
+
+ /* Collect changes and test that no path gets reported twice. */
+ SVN_ERR(svn_fs_revision_root(&root, fs, revision, scratch_pool));
+ SVN_ERR(svn_fs_paths_changed3(&iterator, root, scratch_pool, scratch_pool));
+
+ changed_paths = apr_hash_make(scratch_pool);
+ SVN_ERR(svn_fs_path_change_get(&change, iterator));
+ while (change)
+ {
+ const char *path = apr_pstrmemdup(scratch_pool, change->path.data,
+ change->path.len);
+ SVN_TEST_ASSERT(change->change_kind == svn_fs_path_change_add);
+ SVN_TEST_ASSERT(!apr_hash_get(changed_paths, path, change->path.len));
+
+ apr_hash_set(changed_paths, path, change->path.len, path);
+ SVN_ERR(svn_fs_path_change_get(&change, iterator));
+ }
+
+ /* Verify that we've got exactly all paths that we added. */
+ SVN_TEST_ASSERT(CHANGES_COUNT == apr_hash_count(changed_paths));
+ for (i = 0; i < CHANGES_COUNT; ++i)
+ {
+ const char *file_name;
+ svn_pool_clear(iterpool);
+
+ file_name = apr_psprintf(iterpool, "/file-%d", i);
+ SVN_TEST_ASSERT(svn_hash_gets(changed_paths, file_name));
+ }
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+test_large_changed_paths_list(const svn_test_opts_t *opts,
+ apr_pool_t *pool)
+{
+ svn_fs_t *fs;
+ svn_fs_txn_t *txn;
+ svn_fs_root_t *txn_root;
+ int i;
+ svn_revnum_t rev = 0;
+ apr_pool_t *iterpool = svn_pool_create(pool);
+ const char *repo_name = "test-repo-changed-paths-list";
+
+ SVN_ERR(svn_test__create_fs(&fs, repo_name, opts, pool));
+
+ /* r1: Add many empty files - just to amass a long list of changes. */
+ SVN_ERR(svn_fs_begin_txn(&txn, fs, rev, pool));
+ SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
+
+ for (i = 0; i < CHANGES_COUNT; ++i)
+ {
+ const char *file_name;
+ svn_pool_clear(iterpool);
+
+ file_name = apr_psprintf(iterpool, "/file-%d", i);
+ SVN_ERR(svn_fs_make_file(txn_root, file_name, iterpool));
+ }
+
+ SVN_ERR(test_commit_txn(&rev, txn, NULL, pool));
+
+ /* Now, read the change list.
+ * Do it twice to cover cached data as well. */
+ svn_pool_clear(iterpool);
+ SVN_ERR(verify_added_files_list(fs, rev, iterpool));
+ svn_pool_clear(iterpool);
+ SVN_ERR(verify_added_files_list(fs, rev, iterpool));
+ svn_pool_destroy(iterpool);
+
+ return SVN_NO_ERROR;
+}
+
+#undef CHANGES_COUNT
+
+static svn_error_t *
+commit_with_locked_rep_cache(const svn_test_opts_t *opts,
+ apr_pool_t *pool)
+{
+ svn_fs_t *fs;
+ svn_fs_txn_t *txn;
+ svn_fs_root_t *txn_root;
+ svn_revnum_t new_rev;
+ svn_sqlite__db_t *sdb;
+ svn_error_t *err;
+ const char *fs_path;
+ const char *statements[] = { "SELECT MAX(revision) FROM rep_cache", NULL };
+
+ if (strcmp(opts->fs_type, SVN_FS_TYPE_FSFS) != 0)
+ return svn_error_create(SVN_ERR_TEST_SKIPPED, NULL,
+ "this will test FSFS repositories only");
+
+ if (opts->server_minor_version && (opts->server_minor_version < 6))
+ return svn_error_create(SVN_ERR_TEST_SKIPPED, NULL,
+ "pre-1.6 SVN doesn't support FSFS rep-sharing");
+
+ fs_path = "test-repo-commit-with-locked-rep-cache";
+ SVN_ERR(svn_test__create_fs(&fs, fs_path, opts, pool));
+
+ /* r1: Add a file. */
+ SVN_ERR(svn_fs_begin_txn2(&txn, fs, 0, 0, pool));
+ SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
+ SVN_ERR(svn_fs_make_file(txn_root, "/foo", pool));
+ SVN_ERR(svn_test__set_file_contents(txn_root, "/foo", "a", pool));
+ SVN_ERR(test_commit_txn(&new_rev, txn, NULL, pool));
+ SVN_TEST_INT_ASSERT(new_rev, 1);
+
+ /* Begin a new transaction based on r1. */
+ SVN_ERR(svn_fs_begin_txn2(&txn, fs, 1, 0, pool));
+ SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
+ SVN_ERR(svn_test__set_file_contents(txn_root, "/foo", "b", pool));
+
+ /* Obtain a shared lock on the rep-cache.db by starting a new read
+ * transaction. */
+ SVN_ERR(svn_sqlite__open(&sdb,
+ svn_dirent_join(fs_path, "rep-cache.db", pool),
+ svn_sqlite__mode_readonly, statements, 0, NULL,
+ 0, pool, pool));
+ SVN_ERR(svn_sqlite__begin_transaction(sdb));
+ SVN_ERR(svn_sqlite__exec_statements(sdb, 0));
+
+ /* Attempt to commit fs transaction. This should result in a commit
+ * post-processing error due to us still holding the shared lock on the
+ * rep-cache.db. */
+ err = svn_fs_commit_txn(NULL, &new_rev, txn, pool);
+ SVN_TEST_ASSERT_ERROR(err, SVN_ERR_SQLITE_BUSY);
+ SVN_TEST_INT_ASSERT(new_rev, 2);
+
+ /* Release the shared lock. */
+ SVN_ERR(svn_sqlite__finish_transaction(sdb, SVN_NO_ERROR));
+ SVN_ERR(svn_sqlite__close(sdb));
+
+ /* Try an operation that reads from rep-cache.db.
+ *
+ * XFAIL: Around r1740802, this call was producing an error due to the
+ * svn_fs_t keeping an unusable db connection (and associated file
+ * locks) within it.
+ */
+ SVN_ERR(svn_fs_verify(fs_path, NULL, 0, SVN_INVALID_REVNUM, NULL, NULL,
+ NULL, NULL, pool));
+
+ return SVN_NO_ERROR;
+}
+
/* ------------------------------------------------------------------------ */
/* The test table. */
@@ -7090,6 +7327,10 @@ static struct svn_test_descriptor_t test
"test svn_fs_check_related for transactions"),
SVN_TEST_OPTS_PASS(freeze_and_commit,
"freeze and commit"),
+ SVN_TEST_OPTS_PASS(test_large_changed_paths_list,
+ "test reading a large changed paths list"),
+ SVN_TEST_OPTS_PASS(commit_with_locked_rep_cache,
+ "test commit with locked rep-cache"),
SVN_TEST_NULL
};
Modified: subversion/branches/authzperf/subversion/tests/libsvn_fs_fs/fs-fs-fuzzy-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/libsvn_fs_fs/fs-fs-fuzzy-test.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/libsvn_fs_fs/fs-fs-fuzzy-test.c (original)
+++ subversion/branches/authzperf/subversion/tests/libsvn_fs_fs/fs-fs-fuzzy-test.c Fri Apr 29 18:38:53 2016
@@ -86,6 +86,7 @@ fuzzing_1_byte_1_rev(const char *repo_na
fs_config = apr_hash_make(pool);
svn_hash_sets(fs_config, SVN_FS_CONFIG_FSFS_CACHE_DELTAS, "1");
svn_hash_sets(fs_config, SVN_FS_CONFIG_FSFS_CACHE_FULLTEXTS, "1");
+ svn_hash_sets(fs_config, SVN_FS_CONFIG_FSFS_CACHE_NODEPROPS, "1");
svn_hash_sets(fs_config, SVN_FS_CONFIG_FSFS_CACHE_REVPROPS, "2");
svn_hash_sets(fs_config, SVN_FS_CONFIG_FSFS_BLOCK_READ, "0");
Modified: subversion/branches/authzperf/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c (original)
+++ subversion/branches/authzperf/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c Fri Apr 29 18:38:53 2016
@@ -1648,6 +1648,98 @@ delta_chain_with_plain(const svn_test_op
#undef REPO_NAME
+/* ------------------------------------------------------------------------ */
+
+#define REPO_NAME "test-repo-compare_0_length_rep"
+
+static svn_error_t *
+compare_0_length_rep(const svn_test_opts_t *opts,
+ apr_pool_t *pool)
+{
+ svn_fs_t *fs;
+ svn_fs_txn_t *txn;
+ svn_fs_root_t *root;
+ svn_revnum_t rev;
+ int i, k;
+ apr_hash_t *fs_config;
+
+ /* Test expectations. */
+#define no_rep_file "no-rep"
+#define empty_plain_file "empty-plain"
+#define plain_file "plain"
+#define empty_delta_file "empty-delta"
+#define delta_file "delta"
+
+ enum { COUNT = 5 };
+ const char *file_names[COUNT] = { no_rep_file,
+ empty_plain_file,
+ plain_file,
+ empty_delta_file,
+ delta_file };
+
+ int equal[COUNT][COUNT] = { { 1, 1, 0, 1, 0 },
+ { 1, 1, 0, 1, 0 },
+ { 0, 0, 1, 0, 1 },
+ { 1, 1, 0, 1, 0 },
+ { 0, 0, 1, 0, 1 } };
+
+ /* Well, this club is FSFS only ... */
+ if (strcmp(opts->fs_type, "fsfs") != 0)
+ return svn_error_create(SVN_ERR_TEST_SKIPPED, NULL, NULL);
+
+ /* We want to check that whether NULL reps, empty PLAIN reps and empty
+ * DELTA reps are all considered equal, yet different from non-empty reps.
+ *
+ * Because we can't create empty PLAIN reps with recent formats anymore,
+ * some format selection & upgrade gymnastics is needed. */
+
+ /* Create a format 1 repository.
+ * This one does not support DELTA reps, so all is PLAIN. */
+ fs_config = apr_hash_make(pool);
+ svn_hash_sets(fs_config, SVN_FS_CONFIG_PRE_1_4_COMPATIBLE, "x");
+ SVN_ERR(svn_test__create_fs2(&fs, REPO_NAME, opts, fs_config, pool));
+
+ /* Revision 1, create 3 files:
+ * One with no rep, one with an empty rep and a non-empty one. */
+ SVN_ERR(svn_fs_begin_txn(&txn, fs, 0, pool));
+ SVN_ERR(svn_fs_txn_root(&root, txn, pool));
+ SVN_ERR(svn_fs_make_file(root, no_rep_file, pool));
+ SVN_ERR(svn_fs_make_file(root, empty_plain_file, pool));
+ SVN_ERR(svn_test__set_file_contents(root, empty_plain_file, "", pool));
+ SVN_ERR(svn_fs_make_file(root, plain_file, pool));
+ SVN_ERR(svn_test__set_file_contents(root, plain_file, "x", pool));
+ SVN_ERR(svn_fs_commit_txn(NULL, &rev, txn, pool));
+
+ /* Upgrade the file system format. */
+ SVN_ERR(svn_fs_upgrade2(REPO_NAME, NULL, NULL, NULL, NULL, pool));
+ SVN_ERR(svn_fs_open2(&fs, REPO_NAME, NULL, pool, pool));
+
+ /* Revision 2, create two more files:
+ * a file with an empty DELTA rep and a non-empty one. */
+ SVN_ERR(svn_fs_begin_txn(&txn, fs, rev, pool));
+ SVN_ERR(svn_fs_txn_root(&root, txn, pool));
+ SVN_ERR(svn_fs_make_file(root, empty_delta_file, pool));
+ SVN_ERR(svn_test__set_file_contents(root, empty_delta_file, "", pool));
+ SVN_ERR(svn_fs_make_file(root, delta_file, pool));
+ SVN_ERR(svn_test__set_file_contents(root, delta_file, "x", pool));
+ SVN_ERR(svn_fs_commit_txn(NULL, &rev, txn, pool));
+
+ /* Now compare. */
+ SVN_ERR(svn_fs_revision_root(&root, fs, rev, pool));
+ for (i = 0; i < COUNT; ++i)
+ for (k = 0; k < COUNT; ++k)
+ {
+ svn_boolean_t different;
+ SVN_ERR(svn_fs_contents_different(&different, root, file_names[i],
+ root, file_names[k], pool));
+ SVN_TEST_ASSERT(different != equal[i][k]);
+ }
+
+ return SVN_NO_ERROR;
+}
+
+#undef REPO_NAME
+
/* The test table. */
@@ -1696,6 +1788,8 @@ static struct svn_test_descriptor_t test
"rep-sharing effectiveness"),
SVN_TEST_OPTS_PASS(delta_chain_with_plain,
"delta chains starting with PLAIN, issue #4577"),
+ SVN_TEST_OPTS_PASS(compare_0_length_rep,
+ "compare empty PLAIN and non-existent reps"),
SVN_TEST_NULL
};
Modified: subversion/branches/authzperf/subversion/tests/libsvn_fs_x/fs-x-pack-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/libsvn_fs_x/fs-x-pack-test.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/libsvn_fs_x/fs-x-pack-test.c (original)
+++ subversion/branches/authzperf/subversion/tests/libsvn_fs_x/fs-x-pack-test.c Fri Apr 29 18:38:53 2016
@@ -888,7 +888,6 @@ test_batch_fsync(const svn_test_opts_t *
apr_size_t len = strlen(path);
SVN_ERR(svn_fs_x__batch_fsync_open_file(&file, batch, path, pool));
- SVN_ERR(svn_fs_x__batch_fsync_new_path(batch, path, pool));
SVN_ERR(svn_io_file_write(file, path, &len, pool));
}
@@ -906,7 +905,6 @@ test_batch_fsync(const svn_test_opts_t *
apr_size_t len = strlen(path);
SVN_ERR(svn_fs_x__batch_fsync_open_file(&file, batch, path, pool));
- SVN_ERR(svn_fs_x__batch_fsync_new_path(batch, path, pool));
SVN_ERR(svn_io_file_write(file, path, &len, pool));
}
@@ -923,7 +921,6 @@ test_batch_fsync(const svn_test_opts_t *
apr_size_t len = strlen(path);
SVN_ERR(svn_fs_x__batch_fsync_open_file(&file, batch, path, pool));
- SVN_ERR(svn_fs_x__batch_fsync_new_path(batch, path, pool));
SVN_ERR(svn_io_file_write(file, path, &len, pool));
}
Modified: subversion/branches/authzperf/subversion/tests/libsvn_ra/ra-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/libsvn_ra/ra-test.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/libsvn_ra/ra-test.c (original)
+++ subversion/branches/authzperf/subversion/tests/libsvn_ra/ra-test.c Fri Apr 29 18:38:53 2016
@@ -603,6 +603,7 @@ get_dir_test(const svn_test_opts_t *opts
{
svn_ra_session_t *session;
apr_hash_t *dirents;
+ svn_dirent_t *ent;
SVN_ERR(make_and_open_repos(&session, "test-get-dir", opts, pool));
SVN_ERR(commit_tree(session, pool));
@@ -613,6 +614,19 @@ get_dir_test(const svn_test_opts_t *opts
SVN_DIRENT_KIND, pool),
SVN_ERR_FS_NOT_FOUND);
+ /* Test fetching SVN_DIRENT_SIZE without SVN_DIRENT_KIND. */
+ SVN_ERR(svn_ra_get_dir2(session, &dirents, NULL, NULL, "", 1,
+ SVN_DIRENT_SIZE, pool));
+ SVN_TEST_INT_ASSERT(apr_hash_count(dirents), 1);
+ ent = svn_hash_gets(dirents, "A");
+ SVN_TEST_ASSERT(ent);
+
+#if 0
+ /* ra_serf has returns SVN_INVALID_SIZE instead of documented zero for
+ * for directories. */
+ SVN_TEST_INT_ASSERT(ent->size, 0);
+#endif
+
return SVN_NO_ERROR;
}
@@ -1572,7 +1586,103 @@ tunnel_run_checkout(const svn_test_opts_
return SVN_NO_ERROR;
}
-
+/* Implements svn_log_entry_receiver_t for commit_empty_last_change */
+static svn_error_t *
+AA_receiver(void *baton,
+ svn_log_entry_t *log_entry,
+ apr_pool_t *pool)
+{
+ svn_log_changed_path2_t *p;
+ apr_hash_index_t *hi;
+
+ SVN_TEST_ASSERT(log_entry->changed_paths2 != NULL);
+ SVN_TEST_ASSERT(apr_hash_count(log_entry->changed_paths2) == 1);
+
+ hi = apr_hash_first(pool, log_entry->changed_paths2);
+
+ SVN_TEST_STRING_ASSERT(apr_hash_this_key(hi), "/AA");
+ p = apr_hash_this_val(hi);
+ SVN_TEST_STRING_ASSERT(p->copyfrom_path, "/A");
+ SVN_TEST_INT_ASSERT(p->copyfrom_rev, 3);
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+commit_empty_last_change(const svn_test_opts_t *opts,
+ apr_pool_t *pool)
+{
+ svn_ra_session_t *session;
+ apr_hash_t *revprop_table = apr_hash_make(pool);
+ const svn_delta_editor_t *editor;
+ void *edit_baton;
+ const char *repos_root_url;
+ void *root_baton, *aa_baton;
+ apr_pool_t *tmp_pool = svn_pool_create(pool);
+ svn_dirent_t *dirent;
+ int i;
+
+ SVN_ERR(make_and_open_repos(&session,
+ "commit_empty_last_change", opts,
+ pool));
+
+ SVN_ERR(commit_changes(session, tmp_pool));
+
+ SVN_ERR(svn_ra_get_repos_root2(session, &repos_root_url, pool));
+ for (i = 0; i < 2; i++)
+ {
+ svn_pool_clear(tmp_pool);
+
+ SVN_ERR(svn_ra_get_commit_editor3(session, &editor, &edit_baton,
+ revprop_table,
+ NULL, NULL, NULL, TRUE, tmp_pool));
+
+ SVN_ERR(editor->open_root(edit_baton, 1, tmp_pool, &root_baton));
+ SVN_ERR(editor->close_directory(root_baton, tmp_pool));
+ SVN_ERR(editor->close_edit(edit_baton, tmp_pool));
+
+ SVN_ERR(svn_ra_stat(session, "", 2+i, &dirent, tmp_pool));
+
+ SVN_TEST_ASSERT(dirent != NULL);
+ SVN_TEST_STRING_ASSERT(dirent->last_author, "jrandom");
+
+ /* BDB used to only updates last_changed on the repos_root when there
+ was an actual change. Now all filesystems behave in the same way */
+ SVN_TEST_INT_ASSERT(dirent->created_rev, 2+i);
+ }
+
+ svn_pool_clear(tmp_pool);
+
+ SVN_ERR(svn_ra_get_commit_editor3(session, &editor, &edit_baton,
+ revprop_table,
+ NULL, NULL, NULL, TRUE, tmp_pool));
+
+ SVN_ERR(editor->open_root(edit_baton, 1, tmp_pool, &root_baton));
+ SVN_ERR(editor->add_directory("AA", root_baton,
+ svn_path_url_add_component2(repos_root_url,
+ "A", tmp_pool),
+ 3, tmp_pool,
+ &aa_baton));
+ SVN_ERR(editor->close_directory(aa_baton, tmp_pool));
+ SVN_ERR(editor->close_directory(root_baton, tmp_pool));
+ SVN_ERR(editor->close_edit(edit_baton, tmp_pool));
+
+ svn_pool_clear(tmp_pool);
+
+ {
+ apr_array_header_t *paths = apr_array_make(tmp_pool, 1, sizeof(const char*));
+ APR_ARRAY_PUSH(paths, const char *) = "AA";
+
+ SVN_ERR(svn_ra_get_log2(session, paths, 4, 4, 1, TRUE, FALSE, FALSE, NULL,
+ AA_receiver, NULL, tmp_pool));
+ }
+
+ svn_pool_destroy(tmp_pool);
+
+ return SVN_NO_ERROR;
+}
+
+
/* The test table. */
static int max_threads = 4;
@@ -1604,6 +1714,8 @@ static struct svn_test_descriptor_t test
"check list has_props performance"),
SVN_TEST_OPTS_PASS(tunnel_run_checkout,
"verify checkout over a tunnel"),
+ SVN_TEST_OPTS_PASS(commit_empty_last_change,
+ "check how last change applies to empty commit"),
SVN_TEST_NULL
};
Modified: subversion/branches/authzperf/subversion/tests/libsvn_repos/repos-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/libsvn_repos/repos-test.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/libsvn_repos/repos-test.c (original)
+++ subversion/branches/authzperf/subversion/tests/libsvn_repos/repos-test.c Fri Apr 29 18:38:53 2016
@@ -3914,6 +3914,47 @@ trace_node_locations_authz(const svn_tes
return SVN_NO_ERROR;
}
+static svn_error_t *
+commit_aborted_txn(const svn_test_opts_t *opts,
+ apr_pool_t *pool)
+{
+ svn_repos_t *repos;
+ svn_fs_txn_t *txn;
+ svn_fs_root_t *txn_root;
+ const char *conflict;
+ svn_revnum_t new_rev;
+ svn_revnum_t youngest_rev;
+
+ /* Create a filesystem and repository. */
+ SVN_ERR(svn_test__create_repos(&repos, "test-repo-commit-aborted-txn",
+ opts, pool));
+
+ /* Create and abort the transaction. */
+ SVN_ERR(svn_repos_fs_begin_txn_for_commit2(&txn, repos, 0,
+ apr_hash_make(pool), pool));
+ SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
+ SVN_ERR(svn_fs_make_dir(txn_root, "/A", pool));
+ SVN_ERR(svn_fs_abort_txn(txn, pool));
+
+ /* Committing the aborted transaction should fail. */
+ SVN_TEST_ASSERT_ANY_ERROR(svn_repos_fs_commit_txn(&conflict, repos,
+ &new_rev, txn, pool));
+
+ /* Ensure that output arguments follow svn_repos_fs_commit_txn()'s
+ contract -- NEW_REV should be set to SVN_INVALID_REVNUM and
+ CONFLICT should be NULL. */
+ SVN_TEST_ASSERT(new_rev == SVN_INVALID_REVNUM);
+ SVN_TEST_ASSERT(conflict == NULL);
+
+ /* Re-open repository and verify that it's still empty. */
+ SVN_ERR(svn_repos_open3(&repos, svn_repos_path(repos, pool), NULL,
+ pool, pool));
+ SVN_ERR(svn_fs_youngest_rev(&youngest_rev, svn_repos_fs(repos), pool));
+ SVN_TEST_ASSERT(youngest_rev == 0);
+
+ return SVN_NO_ERROR;
+}
+
/* The test table. */
static int max_threads = 4;
@@ -3971,6 +4012,8 @@ static struct svn_test_descriptor_t test
"test deprecated access context api"),
SVN_TEST_OPTS_PASS(trace_node_locations_authz,
"authz for svn_repos_trace_node_locations"),
+ SVN_TEST_OPTS_PASS(commit_aborted_txn,
+ "test committing a previously aborted txn"),
SVN_TEST_NULL
};
Modified: subversion/branches/authzperf/subversion/tests/libsvn_subr/config-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/libsvn_subr/config-test.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/libsvn_subr/config-test.c (original)
+++ subversion/branches/authzperf/subversion/tests/libsvn_subr/config-test.c Fri Apr 29 18:38:53 2016
@@ -382,6 +382,27 @@ test_expand(const svn_test_opts_t *opts,
return SVN_NO_ERROR;
}
+static svn_error_t *
+test_invalid_bom(apr_pool_t *pool)
+{
+ svn_config_t *cfg;
+ svn_error_t *err;
+ svn_string_t *cfg_string;
+ svn_stream_t *stream;
+
+ cfg_string = svn_string_create("\xEF", pool);
+ stream = svn_stream_from_string(cfg_string, pool);
+ err = svn_config_parse(&cfg, stream, TRUE, TRUE, pool);
+ SVN_TEST_ASSERT_ERROR(err, SVN_ERR_MALFORMED_FILE);
+
+ cfg_string = svn_string_create("\xEF\xBB", pool);
+ stream = svn_stream_from_string(cfg_string, pool);
+ err = svn_config_parse(&cfg, stream, TRUE, TRUE, pool);
+ SVN_TEST_ASSERT_ERROR(err, SVN_ERR_MALFORMED_FILE);
+
+ return SVN_NO_ERROR;
+}
+
/*
====================================================================
If you add a new test to this file, update this array.
@@ -414,6 +435,8 @@ static struct svn_test_descriptor_t test
"test r/o mode"),
SVN_TEST_OPTS_PASS(test_expand,
"test variable expansion"),
+ SVN_TEST_PASS2(test_invalid_bom,
+ "test parsing config file with invalid BOM"),
SVN_TEST_NULL
};
Modified: subversion/branches/authzperf/subversion/tests/libsvn_subr/hashdump-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/libsvn_subr/hashdump-test.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/libsvn_subr/hashdump-test.c (original)
+++ subversion/branches/authzperf/subversion/tests/libsvn_subr/hashdump-test.c Fri Apr 29 18:38:53 2016
@@ -168,6 +168,67 @@ test3(apr_pool_t *pool)
}
+static const char *
+hash_gets_stringt(apr_hash_t *ht, const char *key)
+{
+ svn_string_t *str = svn_hash_gets(ht, key);
+ if (str)
+ return str->data;
+ else
+ return NULL;
+}
+
+static svn_error_t *
+read_hash_buffered_test(apr_pool_t *pool)
+{
+ apr_file_t *file;
+ apr_hash_t *ht;
+
+ /* Write hash table to file. */
+ ht = apr_hash_make(pool);
+ svn_hash_sets(ht, "key1", svn_string_create("value1", pool));
+ svn_hash_sets(ht, "key2", svn_string_create("value2", pool));
+ svn_hash_sets(ht, "key3", svn_string_create("value3", pool));
+ svn_hash_sets(ht, "key4", svn_string_create("value4", pool));
+ svn_hash_sets(ht, "key5", svn_string_create("value5", pool));
+ svn_hash_sets(ht, "key6", svn_string_create("value6", pool));
+ svn_hash_sets(ht, "key7", svn_string_create("value7", pool));
+ svn_hash_sets(ht, "key8", svn_string_create("value8", pool));
+
+ SVN_ERR(svn_io_file_open(&file, "hashdump.out",
+ APR_FOPEN_CREATE | APR_FOPEN_WRITE | APR_FOPEN_BUFFERED,
+ APR_OS_DEFAULT, pool));
+
+ SVN_ERR(svn_hash_write2(ht, svn_stream_from_aprfile2(file, FALSE, pool),
+ SVN_HASH_TERMINATOR, pool));
+
+ SVN_ERR(svn_io_file_close(file, pool));
+
+ /* Read hash table using buffered APR file. */
+ ht = apr_hash_make(pool);
+ SVN_ERR(svn_io_file_open(&file, "hashdump.out",
+ APR_FOPEN_READ | APR_FOPEN_BUFFERED,
+ APR_OS_DEFAULT, pool));
+ SVN_ERR(svn_hash_read2(ht, svn_stream_from_aprfile(file, pool),
+ SVN_HASH_TERMINATOR, pool));
+ SVN_ERR(svn_io_file_close(file, pool));
+
+ /* Check result. */
+ SVN_TEST_STRING_ASSERT(hash_gets_stringt(ht, "key1"), "value1");
+ SVN_TEST_STRING_ASSERT(hash_gets_stringt(ht, "key2"), "value2");
+ SVN_TEST_STRING_ASSERT(hash_gets_stringt(ht, "key3"), "value3");
+ SVN_TEST_STRING_ASSERT(hash_gets_stringt(ht, "key4"), "value4");
+ SVN_TEST_STRING_ASSERT(hash_gets_stringt(ht, "key5"), "value5");
+ SVN_TEST_STRING_ASSERT(hash_gets_stringt(ht, "key6"), "value6");
+ SVN_TEST_STRING_ASSERT(hash_gets_stringt(ht, "key7"), "value7");
+ SVN_TEST_STRING_ASSERT(hash_gets_stringt(ht, "key8"), "value8");
+
+ SVN_TEST_ASSERT(apr_hash_count(ht) == 8);
+
+ SVN_ERR(svn_io_remove_file2("hashdump.out", TRUE, pool));
+
+ return SVN_NO_ERROR;
+}
/*
@@ -189,6 +250,8 @@ static struct svn_test_descriptor_t test
"read a file into a hash"),
SVN_TEST_PASS2(test3,
"write hash out, read back in, compare"),
+ SVN_TEST_PASS2(read_hash_buffered_test,
+ "read hash from buffered file"),
SVN_TEST_NULL
};
Modified: subversion/branches/authzperf/subversion/tests/libsvn_subr/io-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/libsvn_subr/io-test.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/libsvn_subr/io-test.c (original)
+++ subversion/branches/authzperf/subversion/tests/libsvn_subr/io-test.c Fri Apr 29 18:38:53 2016
@@ -123,7 +123,7 @@ static struct test_file_definition_t tes
static svn_error_t *
create_test_file(struct test_file_definition_t* definition,
- const char *testname,
+ const char *test_dir,
apr_pool_t *pool,
apr_pool_t *scratch_pool)
{
@@ -132,7 +132,6 @@ create_test_file(struct test_file_defini
apr_off_t midpos = definition->size / 2;
svn_error_t *err = NULL;
int i;
- const char *test_dir = apr_pstrcat(pool, TEST_DIR_PREFIX, testname, NULL);
if (definition->size < 5)
SVN_ERR_ASSERT(strlen(definition->data) >= (apr_size_t)definition->size);
@@ -184,31 +183,13 @@ create_comparison_candidates(struct test
const char *testname,
apr_pool_t *pool)
{
- svn_node_kind_t kind;
apr_pool_t *iterpool = svn_pool_create(pool);
struct test_file_definition_t *candidate;
svn_error_t *err = SVN_NO_ERROR;
apr_size_t count = 0;
- const char *test_dir = apr_pstrcat(pool, TEST_DIR_PREFIX,
- testname, NULL);
+ const char *test_dir;
- /* If there's already a directory named io-test-temp, delete it.
- Doing things this way means that repositories stick around after
- a failure for postmortem analysis, but also that tests can be
- re-run without cleaning out the repositories created by prior
- runs. */
- SVN_ERR(svn_io_check_path(test_dir, &kind, pool));
-
- if (kind == svn_node_dir)
- SVN_ERR(svn_io_remove_dir2(test_dir, TRUE, NULL, NULL, pool));
- else if (kind != svn_node_none)
- return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
- "There is already a file named '%s'",
- test_dir);
-
- SVN_ERR(svn_io_dir_make(test_dir, APR_OS_DEFAULT, pool));
-
- svn_test_add_dir_cleanup(test_dir);
+ SVN_ERR(svn_test_make_sandbox_dir(&test_dir, testname, pool));
for (candidate = test_file_definitions_template;
candidate->name != NULL;
@@ -220,7 +201,7 @@ create_comparison_candidates(struct test
for (candidate = *definitions; candidate->name != NULL; candidate += 1)
{
svn_pool_clear(iterpool);
- err = create_test_file(candidate, testname, pool, iterpool);
+ err = create_test_file(candidate, test_dir, pool, iterpool);
if (err)
break;
}
@@ -518,10 +499,7 @@ read_length_line_shouldnt_loop(apr_pool_
apr_size_t buffer_limit = sizeof(buffer);
apr_file_t *f;
- SVN_ERR(svn_dirent_get_absolute(&tmp_dir, "read_length_tmp", pool));
- SVN_ERR(svn_io_remove_dir2(tmp_dir, TRUE, NULL, NULL, pool));
- SVN_ERR(svn_io_make_dir_recursively(tmp_dir, pool));
- svn_test_add_dir_cleanup(tmp_dir);
+ SVN_ERR(svn_test_make_sandbox_dir(&tmp_dir, "read_length_tmp", pool));
SVN_ERR(svn_io_write_unique(&tmp_file, tmp_dir, "1234\r\n", 6,
svn_io_file_del_on_pool_cleanup, pool));
@@ -535,6 +513,167 @@ read_length_line_shouldnt_loop(apr_pool_
return SVN_NO_ERROR;
}
+static svn_error_t *
+test_read_length_line(apr_pool_t *pool)
+{
+ const char *tmp_dir;
+ const char *tmp_file;
+ char buffer[80];
+ apr_size_t buffer_limit;
+ apr_file_t *f;
+ svn_error_t *err;
+
+ SVN_ERR(svn_test_make_sandbox_dir(&tmp_dir, "test_read_length_line",
+ pool));
+
+ /* Test 1: Read empty file. */
+ tmp_file = svn_dirent_join(tmp_dir, "empty", pool);
+ SVN_ERR(svn_io_file_create(tmp_file, "", pool));
+
+ SVN_ERR(svn_io_file_open(&f, tmp_file, APR_READ | APR_BUFFERED,
+ APR_OS_DEFAULT, pool));
+ buffer_limit = sizeof(buffer);
+ err = svn_io_read_length_line(f, buffer, &buffer_limit, pool);
+ SVN_TEST_ASSERT_ERROR(err, APR_EOF);
+
+ SVN_ERR(svn_io_file_close(f, pool));
+
+ /* Test 2: Read empty line.*/
+ tmp_file = svn_dirent_join(tmp_dir, "empty-line", pool);
+ SVN_ERR(svn_io_file_create(tmp_file, "\n", pool));
+
+ SVN_ERR(svn_io_file_open(&f, tmp_file, APR_READ | APR_BUFFERED,
+ APR_OS_DEFAULT, pool));
+ buffer_limit = sizeof(buffer);
+ err = svn_io_read_length_line(f, buffer, &buffer_limit, pool);
+ SVN_ERR(err);
+ SVN_TEST_ASSERT(buffer_limit == 0);
+ SVN_TEST_STRING_ASSERT(buffer, "");
+ SVN_ERR(svn_io_file_close(f, pool));
+
+ /* Test 3: Read two lines.*/
+ tmp_file = svn_dirent_join(tmp_dir, "lines", pool);
+ SVN_ERR(svn_io_file_create(tmp_file, "first\nsecond\n", pool));
+
+ SVN_ERR(svn_io_file_open(&f, tmp_file, APR_READ | APR_BUFFERED,
+ APR_OS_DEFAULT, pool));
+
+ buffer_limit = sizeof(buffer);
+ err = svn_io_read_length_line(f, buffer, &buffer_limit, pool);
+ SVN_ERR(err);
+ SVN_TEST_ASSERT(buffer_limit == 5);
+ SVN_TEST_STRING_ASSERT(buffer, "first");
+
+ buffer_limit = sizeof(buffer);
+ err = svn_io_read_length_line(f, buffer, &buffer_limit, pool);
+ SVN_ERR(err);
+ SVN_TEST_ASSERT(buffer_limit == 6);
+ SVN_TEST_STRING_ASSERT(buffer, "second");
+
+ buffer_limit = sizeof(buffer);
+ err = svn_io_read_length_line(f, buffer, &buffer_limit, pool);
+ SVN_TEST_ASSERT_ERROR(err, APR_EOF);
+
+ SVN_ERR(svn_io_file_close(f, pool));
+
+ /* Test 4: Content without end-of-line.*/
+ tmp_file = svn_dirent_join(tmp_dir, "no-eol", pool);
+ SVN_ERR(svn_io_file_create(tmp_file, "text", pool));
+
+ SVN_ERR(svn_io_file_open(&f, tmp_file, APR_READ | APR_BUFFERED,
+ APR_OS_DEFAULT, pool));
+
+ buffer_limit = sizeof(buffer);
+ err = svn_io_read_length_line(f, buffer, &buffer_limit, pool);
+ SVN_TEST_ASSERT_ERROR(err, APR_EOF);
+
+ SVN_ERR(svn_io_file_close(f, pool));
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+test_file_readline(apr_pool_t *pool)
+{
+ const char *tmp_dir;
+ const char *tmp_file;
+ svn_stringbuf_t *buf;
+ apr_file_t *f;
+ svn_error_t *err;
+ const char *eol;
+ svn_boolean_t eof;
+ apr_off_t pos;
+
+ SVN_ERR(svn_test_make_sandbox_dir(&tmp_dir, "test_file_readline",
+ pool));
+
+ tmp_file = svn_dirent_join(tmp_dir, "foo", pool);
+
+ SVN_ERR(svn_io_file_create(tmp_file, "CR\rLF\nCRLF\r\nno-eol", pool));
+
+ SVN_ERR(svn_io_file_open(&f, tmp_file, APR_READ | APR_BUFFERED,
+ APR_OS_DEFAULT, pool));
+ err = svn_io_file_readline(f, &buf, &eol, &eof, APR_SIZE_MAX, pool, pool);
+ SVN_ERR(err);
+ SVN_TEST_STRING_ASSERT(buf->data, "CR");
+ SVN_TEST_STRING_ASSERT(eol, "\r");
+ SVN_TEST_ASSERT(!eof);
+
+ /* Check that APR file reports correct offset. See r1719196 why it's
+ important. */
+ SVN_ERR(svn_io_file_get_offset(&pos, f, pool));
+ SVN_TEST_INT_ASSERT(pos, 3);
+
+ err = svn_io_file_readline(f, &buf, &eol, &eof, APR_SIZE_MAX, pool, pool);
+ SVN_ERR(err);
+ SVN_TEST_STRING_ASSERT(buf->data, "LF");
+ SVN_TEST_STRING_ASSERT(eol, "\n");
+ SVN_TEST_ASSERT(!eof);
+
+ /* Check that APR file reports correct offset. See r1719196 why it's
+ important. */
+ SVN_ERR(svn_io_file_get_offset(&pos, f, pool));
+ SVN_TEST_INT_ASSERT(pos, 6);
+
+ err = svn_io_file_readline(f, &buf, &eol, &eof, APR_SIZE_MAX, pool, pool);
+ SVN_ERR(err);
+ SVN_TEST_STRING_ASSERT(buf->data, "CRLF");
+ SVN_TEST_STRING_ASSERT(eol, "\r\n");
+ SVN_TEST_ASSERT(!eof);
+
+ /* Check that APR file reports correct offset. See r1719196 why it's
+ important. */
+ SVN_ERR(svn_io_file_get_offset(&pos, f, pool));
+ SVN_TEST_INT_ASSERT(pos, 12);
+
+ err = svn_io_file_readline(f, &buf, &eol, &eof, APR_SIZE_MAX, pool, pool);
+ SVN_ERR(err);
+ SVN_TEST_STRING_ASSERT(buf->data, "no-eol");
+ SVN_TEST_STRING_ASSERT(eol, NULL);
+ SVN_TEST_ASSERT(eof);
+
+ /* Check that APR file reports correct offset. See r1719196 why it's
+ important. */
+ SVN_ERR(svn_io_file_get_offset(&pos, f, pool));
+ SVN_TEST_INT_ASSERT(pos, 18);
+
+ /* Further reads still returns EOF. */
+ err = svn_io_file_readline(f, &buf, &eol, &eof, APR_SIZE_MAX, pool, pool);
+ SVN_ERR(err);
+ SVN_TEST_STRING_ASSERT(buf->data, "");
+ SVN_TEST_STRING_ASSERT(eol, NULL);
+ SVN_TEST_ASSERT(eof);
+
+ /* Check that APR file reports correct offset. See r1719196 why it's
+ important. */
+ SVN_ERR(svn_io_file_get_offset(&pos, f, pool));
+ SVN_TEST_INT_ASSERT(pos, 18);
+
+ SVN_ERR(svn_io_file_close(f, pool));
+
+ return SVN_NO_ERROR;
+}
+
/* Move the read pointer in FILE to absolute position OFFSET and align
* the read buffer to multiples of BLOCK_SIZE. BUFFERED is set only if
* FILE actually uses a read buffer. Use POOL for allocations.
@@ -562,8 +701,7 @@ aligned_seek(apr_file_t *file,
}
/* we must be at the desired offset */
- current = 0;
- SVN_ERR(svn_io_file_seek(file, APR_CUR, ¤t, pool));
+ SVN_ERR(svn_io_file_get_offset(¤t, file, pool));
SVN_TEST_ASSERT(current == (apr_off_t)offset);
return SVN_NO_ERROR;
@@ -639,11 +777,7 @@ aligned_seek_test(apr_pool_t *pool)
const apr_size_t file_size = 100000;
/* create a temp folder & schedule it for automatic cleanup */
-
- SVN_ERR(svn_dirent_get_absolute(&tmp_dir, "aligned_seek_tmp", pool));
- SVN_ERR(svn_io_remove_dir2(tmp_dir, TRUE, NULL, NULL, pool));
- SVN_ERR(svn_io_make_dir_recursively(tmp_dir, pool));
- svn_test_add_dir_cleanup(tmp_dir);
+ SVN_ERR(svn_test_make_sandbox_dir(&tmp_dir, "aligned_seek_tmp", pool));
/* create a temp file with know contents */
@@ -690,10 +824,7 @@ ignore_enoent(apr_pool_t *pool)
apr_file_t *file;
/* Create an empty directory. */
- SVN_ERR(svn_dirent_get_absolute(&tmp_dir, "ignore_enoent", pool));
- SVN_ERR(svn_io_remove_dir2(tmp_dir, TRUE, NULL, NULL, pool));
- SVN_ERR(svn_io_make_dir_recursively(tmp_dir, pool));
- svn_test_add_dir_cleanup(tmp_dir);
+ SVN_ERR(svn_test_make_sandbox_dir(&tmp_dir, "ignore_enoent", pool));
/* Path does not exist. */
path = svn_dirent_join(tmp_dir, "not-present", pool);
@@ -750,11 +881,9 @@ test_install_stream_to_longpath(apr_pool
int i;
/* Create an empty directory. */
- SVN_ERR(svn_dirent_get_absolute(&tmp_dir, "test_install_stream_to_longpath",
- pool));
- SVN_ERR(svn_io_remove_dir2(tmp_dir, TRUE, NULL, NULL, pool));
- SVN_ERR(svn_io_make_dir_recursively(tmp_dir, pool));
- svn_test_add_dir_cleanup(tmp_dir);
+ SVN_ERR(svn_test_make_sandbox_dir(&tmp_dir,
+ "test_install_stream_to_longpath",
+ pool));
deep_dir = tmp_dir;
@@ -792,11 +921,9 @@ test_install_stream_over_readonly_file(a
svn_stringbuf_t *actual_content;
/* Create an empty directory. */
- SVN_ERR(svn_dirent_get_absolute(&tmp_dir, "test_install_stream_over_readonly_file",
- pool));
- SVN_ERR(svn_io_remove_dir2(tmp_dir, TRUE, NULL, NULL, pool));
- SVN_ERR(svn_io_make_dir_recursively(tmp_dir, pool));
- svn_test_add_dir_cleanup(tmp_dir);
+ SVN_ERR(svn_test_make_sandbox_dir(&tmp_dir,
+ "test_install_stream_over_readonly_file",
+ pool));
final_abspath = svn_dirent_join(tmp_dir, "stream1", pool);
@@ -829,10 +956,7 @@ test_file_size_get(apr_pool_t *pool)
svn_filesize_t filesize;
/* Create an empty directory. */
- SVN_ERR(svn_dirent_get_absolute(&tmp_dir, "test_file_size_get", pool));
- SVN_ERR(svn_io_remove_dir2(tmp_dir, TRUE, NULL, NULL, pool));
- SVN_ERR(svn_io_make_dir_recursively(tmp_dir, pool));
- svn_test_add_dir_cleanup(tmp_dir);
+ SVN_ERR(svn_test_make_sandbox_dir(&tmp_dir, "test_file_size_get", pool));
/* Path does not exist. */
path = svn_dirent_join(tmp_dir, "file", pool);
@@ -871,10 +995,7 @@ test_file_rename2(apr_pool_t *pool)
svn_node_kind_t actual_kind;
/* Create an empty directory. */
- SVN_ERR(svn_dirent_get_absolute(&tmp_dir, "test_file_rename2", pool));
- SVN_ERR(svn_io_remove_dir2(tmp_dir, TRUE, NULL, NULL, pool));
- SVN_ERR(svn_io_make_dir_recursively(tmp_dir, pool));
- svn_test_add_dir_cleanup(tmp_dir);
+ SVN_ERR(svn_test_make_sandbox_dir(&tmp_dir, "test_file_rename2", pool));
foo_path = svn_dirent_join(tmp_dir, "foo", pool);
bar_path = svn_dirent_join(tmp_dir, "bar", pool);
@@ -948,6 +1069,10 @@ static struct svn_test_descriptor_t test
"test svn_io_file_size_get"),
SVN_TEST_PASS2(test_file_rename2,
"test svn_io_file_rename2"),
+ SVN_TEST_PASS2(test_read_length_line,
+ "test svn_io_read_length_line()"),
+ SVN_TEST_PASS2(test_file_readline,
+ "test svn_io_file_readline()"),
SVN_TEST_NULL
};
Modified: subversion/branches/authzperf/subversion/tests/libsvn_subr/packed-data-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/libsvn_subr/packed-data-test.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/libsvn_subr/packed-data-test.c (original)
+++ subversion/branches/authzperf/subversion/tests/libsvn_subr/packed-data-test.c Fri Apr 29 18:38:53 2016
@@ -222,6 +222,7 @@ test_byte_stream(apr_pool_t *pool)
/* the stream shall contain exactly the items we put into it */
SVN_TEST_ASSERT(svn_packed__byte_count(stream) == 20);
+ SVN_TEST_ASSERT(svn_packed__byte_block_count(stream) == COUNT);
for (i = 0; i < COUNT; ++i)
{
svn_string_t string;
Modified: subversion/branches/authzperf/subversion/tests/libsvn_subr/sqlite-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/libsvn_subr/sqlite-test.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/libsvn_subr/sqlite-test.c (original)
+++ subversion/branches/authzperf/subversion/tests/libsvn_subr/sqlite-test.c Fri Apr 29 18:38:53 2016
@@ -26,8 +26,10 @@
static svn_error_t *
open_db(svn_sqlite__db_t **sdb,
+ const char **db_abspath_p,
const char *db_name,
const char *const *statements,
+ apr_int32_t timeout,
apr_pool_t *pool)
{
const char *db_dir, *db_abspath;
@@ -40,8 +42,10 @@ open_db(svn_sqlite__db_t **sdb,
db_abspath = svn_dirent_join(db_dir, db_name, pool);
SVN_ERR(svn_sqlite__open(sdb, db_abspath, svn_sqlite__mode_rwcreate,
- statements, 0, NULL, 0, pool, pool));
+ statements, 0, NULL, timeout, pool, pool));
+ if (db_abspath_p)
+ *db_abspath_p = db_abspath;
return SVN_NO_ERROR;
}
@@ -83,7 +87,7 @@ test_sqlite_reset(apr_pool_t *pool)
NULL
};
- SVN_ERR(open_db(&sdb, "reset", statements, pool));
+ SVN_ERR(open_db(&sdb, NULL, "reset", statements, 0, pool));
SVN_ERR(svn_sqlite__create_scalar_function(sdb, "error_second",
1, FALSE /* deterministic */,
error_second, NULL));
@@ -113,6 +117,59 @@ test_sqlite_reset(apr_pool_t *pool)
return SVN_NO_ERROR;
}
+static svn_error_t *
+test_sqlite_txn_commit_busy(apr_pool_t *pool)
+{
+ svn_sqlite__db_t *sdb1;
+ svn_sqlite__db_t *sdb2;
+ const char *db_abspath;
+ svn_error_t *err;
+
+ static const char *const statements[] = {
+ "CREATE TABLE test (one TEXT NOT NULL PRIMARY KEY)",
+
+ "INSERT INTO test(one) VALUES ('foo')",
+
+ "SELECT one from test",
+
+ NULL
+ };
+
+ /* Open two db connections.
+
+ Use a small busy_timeout of 250ms, since we're about to receive an
+ SVN_ERR_SQLITE_BUSY error, and retrying for the default 10 seconds
+ would be a waste of time. */
+ SVN_ERR(open_db(&sdb1, &db_abspath, "txn_commit_busy",
+ statements, 250, pool));
+ SVN_ERR(svn_sqlite__open(&sdb2, db_abspath, svn_sqlite__mode_readwrite,
+ statements, 0, NULL, 250, pool, pool));
+ SVN_ERR(svn_sqlite__exec_statements(sdb1, 0));
+
+ /* Begin two deferred transactions. */
+ SVN_ERR(svn_sqlite__begin_transaction(sdb1));
+ SVN_ERR(svn_sqlite__exec_statements(sdb1, 1 /* INSERT */));
+ SVN_ERR(svn_sqlite__begin_transaction(sdb2));
+ SVN_ERR(svn_sqlite__exec_statements(sdb2, 2 /* SELECT */));
+
+ /* Try to COMMIT the first write transaction; this should fail due to
+ the concurrent read transaction that holds a shared lock on the db. */
+ err = svn_sqlite__finish_transaction(sdb1, SVN_NO_ERROR);
+ SVN_TEST_ASSERT_ERROR(err, SVN_ERR_SQLITE_BUSY);
+
+ /* We failed to COMMIT the first transaction, but COMMIT-ting the
+ second transaction through a different db connection should succeed.
+ Upgrade it to a write transaction by executing the INSERT statement,
+ and then commit. */
+ SVN_ERR(svn_sqlite__exec_statements(sdb2, 1 /* INSERT */));
+ SVN_ERR(svn_sqlite__finish_transaction(sdb2, SVN_NO_ERROR));
+
+ SVN_ERR(svn_sqlite__close(sdb2));
+ SVN_ERR(svn_sqlite__close(sdb1));
+
+ return SVN_NO_ERROR;
+}
+
static int max_threads = 1;
@@ -121,6 +178,8 @@ static struct svn_test_descriptor_t test
SVN_TEST_NULL,
SVN_TEST_PASS2(test_sqlite_reset,
"sqlite reset"),
+ SVN_TEST_PASS2(test_sqlite_txn_commit_busy,
+ "sqlite busy on transaction commit"),
SVN_TEST_NULL
};
Modified: subversion/branches/authzperf/subversion/tests/libsvn_subr/stream-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/libsvn_subr/stream-test.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/libsvn_subr/stream-test.c (original)
+++ subversion/branches/authzperf/subversion/tests/libsvn_subr/stream-test.c Fri Apr 29 18:38:53 2016
@@ -550,9 +550,27 @@ test_stream_base64(apr_pool_t *pool)
NULL
};
+ /* Test svn_base64_encode2() with BREAK_LINES=FALSE. */
stream = svn_stream_from_stringbuf(actual, pool);
stream = svn_base64_decode(stream, pool);
- stream = svn_base64_encode(stream, pool);
+ stream = svn_base64_encode2(stream, TRUE, pool);
+
+ for (i = 0; strings[i]; i++)
+ {
+ apr_size_t len = strlen(strings[i]);
+
+ svn_stringbuf_appendbytes(expected, strings[i], len);
+ SVN_ERR(svn_stream_write(stream, strings[i], &len));
+ }
+
+ SVN_ERR(svn_stream_close(stream));
+
+ SVN_TEST_STRING_ASSERT(actual->data, expected->data);
+
+ /* Test svn_base64_encode2() with BREAK_LINES=FALSE. */
+ stream = svn_stream_from_stringbuf(actual, pool);
+ stream = svn_base64_decode(stream, pool);
+ stream = svn_base64_encode2(stream, FALSE, pool);
for (i = 0; strings[i]; i++)
{
@@ -701,6 +719,32 @@ test_stream_base64_2(apr_pool_t *pool)
};
int i;
+ /* Test svn_base64_encode2() with BREAK_LINES=TRUE. */
+ for (i = 0; data[i].encoded1; i++)
+ {
+ apr_size_t len1 = strlen(data[i].encoded1);
+
+ svn_stringbuf_t *actual = svn_stringbuf_create_empty(pool);
+ svn_stringbuf_t *expected = svn_stringbuf_create_empty(pool);
+ svn_stream_t *stream = svn_stream_from_stringbuf(actual, pool);
+
+ stream = svn_base64_encode2(stream, TRUE, pool);
+ stream = svn_base64_decode(stream, pool);
+
+ SVN_ERR(svn_stream_write(stream, data[i].encoded1, &len1));
+ svn_stringbuf_appendbytes(expected, data[i].encoded1, len1);
+
+ if (data[i].encoded2)
+ {
+ apr_size_t len2 = strlen(data[i].encoded2);
+ SVN_ERR(svn_stream_write(stream, data[i].encoded2, &len2));
+ svn_stringbuf_appendbytes(expected, data[i].encoded2, len2);
+ }
+
+ SVN_ERR(svn_stream_close(stream));
+ }
+
+ /* Test svn_base64_encode2() with BREAK_LINES=FALSE. */
for (i = 0; data[i].encoded1; i++)
{
apr_size_t len1 = strlen(data[i].encoded1);
@@ -709,7 +753,7 @@ test_stream_base64_2(apr_pool_t *pool)
svn_stringbuf_t *expected = svn_stringbuf_create_empty(pool);
svn_stream_t *stream = svn_stream_from_stringbuf(actual, pool);
- stream = svn_base64_encode(stream, pool);
+ stream = svn_base64_encode2(stream, FALSE, pool);
stream = svn_base64_decode(stream, pool);
SVN_ERR(svn_stream_write(stream, data[i].encoded1, &len1));
Modified: subversion/branches/authzperf/subversion/tests/libsvn_subr/string-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/libsvn_subr/string-test.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/libsvn_subr/string-test.c (original)
+++ subversion/branches/authzperf/subversion/tests/libsvn_subr/string-test.c Fri Apr 29 18:38:53 2016
@@ -634,7 +634,15 @@ test_stringbuf_remove(apr_pool_t *pool)
SVN_TEST_STRING_ASSERT(a->data, "stell");
svn_stringbuf_remove(a, 1200, 393);
- return expect_stringbuf_equal(a, "stell", pool);
+ SVN_ERR(expect_stringbuf_equal(a, "stell", pool));
+
+ svn_stringbuf_remove(a, APR_SIZE_MAX, 2);
+ SVN_ERR(expect_stringbuf_equal(a, "stell", pool));
+
+ svn_stringbuf_remove(a, 1, APR_SIZE_MAX);
+ SVN_ERR(expect_stringbuf_equal(a, "s", pool));
+
+ return SVN_NO_ERROR;
}
static svn_error_t *
@@ -672,6 +680,12 @@ test_stringbuf_replace(apr_pool_t *pool)
svn_stringbuf_ncreate("test hello\0-\0world!\0-\0!",
23, pool)));
+ svn_stringbuf_replace(a, 1, APR_SIZE_MAX, "x", 1);
+ SVN_ERR(expect_stringbuf_equal(a, "tx", pool));
+
+ svn_stringbuf_replace(a, APR_SIZE_MAX, APR_SIZE_MAX, "y", 1);
+ SVN_ERR(expect_stringbuf_equal(a, "txy", pool));
+
return SVN_NO_ERROR;
}
Modified: subversion/branches/authzperf/subversion/tests/libsvn_subr/utf-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/libsvn_subr/utf-test.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/libsvn_subr/utf-test.c (original)
+++ subversion/branches/authzperf/subversion/tests/libsvn_subr/utf-test.c Fri Apr 29 18:38:53 2016
@@ -823,6 +823,155 @@ test_utf_conversions(apr_pool_t *pool)
}
+static svn_error_t *
+test_utf_normalize(apr_pool_t *pool)
+{
+ /* Normalized: NFC */
+ static const char nfc[] =
+ "\xe1\xb9\xa8" /* S with dot above and below */
+ "\xc5\xaf" /* u with ring */
+ "\xe1\xb8\x87" /* b with macron below */
+ "\xe1\xb9\xbd" /* v with tilde */
+ "\xe1\xb8\x9d" /* e with breve and cedilla */
+ "\xc8\x91" /* r with double grave */
+ "\xc5\xa1" /* s with caron */
+ "\xe1\xb8\xaf" /* i with diaeresis and acute */
+ "\xe1\xbb\x9d" /* o with grave and hook */
+ "\xe1\xb9\x8b"; /* n with circumflex below */
+
+ /* Normalized: NFD */
+ static const char nfd[] =
+ "S\xcc\xa3\xcc\x87" /* S with dot above and below */
+ "u\xcc\x8a" /* u with ring */
+ "b\xcc\xb1" /* b with macron below */
+ "v\xcc\x83" /* v with tilde */
+ "e\xcc\xa7\xcc\x86" /* e with breve and cedilla */
+ "r\xcc\x8f" /* r with double grave */
+ "s\xcc\x8c" /* s with caron */
+ "i\xcc\x88\xcc\x81" /* i with diaeresis and acute */
+ "o\xcc\x9b\xcc\x80" /* o with grave and hook */
+ "n\xcc\xad"; /* n with circumflex below */
+
+ /* Mixed, denormalized */
+ static const char mixup[] =
+ "S\xcc\x87\xcc\xa3" /* S with dot above and below */
+ "\xc5\xaf" /* u with ring */
+ "b\xcc\xb1" /* b with macron below */
+ "\xe1\xb9\xbd" /* v with tilde */
+ "e\xcc\xa7\xcc\x86" /* e with breve and cedilla */
+ "\xc8\x91" /* r with double grave */
+ "s\xcc\x8c" /* s with caron */
+ "\xe1\xb8\xaf" /* i with diaeresis and acute */
+ "o\xcc\x80\xcc\x9b" /* o with grave and hook */
+ "\xe1\xb9\x8b"; /* n with circumflex below */
+
+ /* Invalid UTF-8 */
+ static const char invalid[] =
+ "\xe1\xb9\xa8" /* S with dot above and below */
+ "\xc5\xaf" /* u with ring */
+ "\xe1\xb8\x87" /* b with macron below */
+ "\xe1\xb9\xbd" /* v with tilde */
+ "\xe1\xb8\x9d" /* e with breve and cedilla */
+ "\xc8\x91" /* r with double grave */
+ "\xc5\xa1" /* s with caron */
+ "\xe1\xb8\xaf" /* i with diaeresis and acute */
+ "\xe6" /* Invalid byte */
+ "\xe1\xb9\x8b"; /* n with circumflex below */
+
+ const char *result;
+ svn_membuf_t buf;
+
+ svn_membuf__create(&buf, 0, pool);
+ SVN_ERR(svn_utf__normalize(&result, nfc, strlen(nfc), &buf));
+ SVN_TEST_STRING_ASSERT(result, nfc);
+ SVN_ERR(svn_utf__normalize(&result, nfd, strlen(nfd), &buf));
+ SVN_TEST_STRING_ASSERT(result, nfc);
+ SVN_ERR(svn_utf__normalize(&result, mixup, strlen(mixup), &buf));
+ SVN_TEST_STRING_ASSERT(result, nfc);
+
+ SVN_TEST_ASSERT_ERROR(svn_utf__normalize(&result, invalid, strlen(invalid),
+ &buf),
+ SVN_ERR_UTF8PROC_ERROR);
+
+ return SVN_NO_ERROR;
+}
+
+
+static svn_error_t *
+test_utf_xfrm(apr_pool_t *pool)
+{
+ const char *str;
+ const char *result;
+ svn_membuf_t buf;
+
+ svn_membuf__create(&buf, 0, pool);
+
+ /* ASCII string */
+ str = "Subversion";
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), FALSE, FALSE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "Subversion");
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), TRUE, FALSE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "subversion");
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), FALSE, TRUE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "Subversion");
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), TRUE, TRUE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "subversion");
+
+ /* M (u with diaeresis) (sharp s) en */
+ str = "M" "\xc3\xbc" "\xc3\x9f" "en";
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), FALSE, FALSE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "M" "\xc3\xbc" "\xc3\x9f" "en");
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), TRUE, FALSE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "m" "\xc3\xbc" "ssen");
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), FALSE, TRUE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "Mu" "\xc3\x9f" "en");
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), TRUE, TRUE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "mussen");
+
+ /* Na (i with diaeresis) vet (e with acute), decomposed */
+ str = "Nai" "\xcc\x88" "vete" "\xcc\x81";
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), FALSE, FALSE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "Na" "\xc3\xaf" "vet" "\xc3\xa9");
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), TRUE, FALSE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "na" "\xc3\xaf" "vet" "\xc3\xa9");
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), FALSE, TRUE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "Naivete");
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), TRUE, TRUE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "naivete");
+
+ /* (I with dot above) stanbul */
+ str = "\xc4\xb0" "stanbul";
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), FALSE, FALSE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "\xc4\xb0" "stanbul");
+
+ /* The Latin Capital Letter I with Dot Above (0130) should fold into
+ Latin Small Letter I (0069) with Combining Dot Above (0307) per full
+ mapping in http://www.unicode.org/Public/UNIDATA/CaseFolding.txt */
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), TRUE, FALSE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "i" "\xcc\x87" "stanbul");
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), FALSE, TRUE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "Istanbul");
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), TRUE, TRUE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "istanbul");
+
+ /* Invalid UTF-8 */
+ str = "a" "\xe6" "bc";
+ SVN_TEST_ASSERT_ERROR(svn_utf__xfrm(&result, str, strlen(str),
+ FALSE, FALSE, &buf),
+ SVN_ERR_UTF8PROC_ERROR);
+ SVN_TEST_ASSERT_ERROR(svn_utf__xfrm(&result, str, strlen(str),
+ TRUE, FALSE, &buf),
+ SVN_ERR_UTF8PROC_ERROR);
+ SVN_TEST_ASSERT_ERROR(svn_utf__xfrm(&result, str, strlen(str),
+ FALSE, TRUE, &buf),
+ SVN_ERR_UTF8PROC_ERROR);
+ SVN_TEST_ASSERT_ERROR(svn_utf__xfrm(&result, str, strlen(str),
+ TRUE, TRUE, &buf),
+ SVN_ERR_UTF8PROC_ERROR);
+
+ return SVN_NO_ERROR;
+}
+
/* The test table. */
@@ -849,6 +998,10 @@ static struct svn_test_descriptor_t test
"test svn_utf__is_normalized"),
SVN_TEST_PASS2(test_utf_conversions,
"test svn_utf__utf{16,32}_to_utf8"),
+ SVN_TEST_PASS2(test_utf_normalize,
+ "test svn_utf__normalize"),
+ SVN_TEST_PASS2(test_utf_xfrm,
+ "test svn_utf__xfrm"),
SVN_TEST_NULL
};
Modified: subversion/branches/authzperf/subversion/tests/libsvn_wc/op-depth-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/libsvn_wc/op-depth-test.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/branches/authzperf/subversion/tests/libsvn_wc/op-depth-test.c Fri Apr 29 18:38:53 2016
@@ -12032,7 +12032,7 @@ static struct svn_test_descriptor_t test
"move depth expansion"),
SVN_TEST_OPTS_XFAIL(move_retract,
"move retract (issue 4336)"),
- SVN_TEST_OPTS_PASS(move_delete_file_externals,
+ SVN_TEST_OPTS_XFAIL(move_delete_file_externals,
"move/delete file externals (issue 4293)"),
SVN_TEST_OPTS_PASS(update_with_tree_conflict,
"update with tree conflict (issue 4347)"),
Modified: subversion/branches/authzperf/subversion/tests/svn_test.h
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/svn_test.h?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/svn_test.h (original)
+++ subversion/branches/authzperf/subversion/tests/svn_test.h Fri Apr 29 18:38:53 2016
@@ -131,6 +131,22 @@ extern "C" {
tst_str2, tst_str1, __FILE__, __LINE__); \
} while(0)
+ /** Handy macro for testing integer equality.
+ */
+#define SVN_TEST_INT_ASSERT(expr, expected_expr) \
+ do { \
+ apr_int64_t tst_int1 = (expr); \
+ apr_int64_t tst_int2 = (expected_expr); \
+ \
+ if (tst_int1 != tst_int2) \
+ return svn_error_createf(SVN_ERR_TEST_FAILED, NULL, \
+ "Integers not equal\n" \
+ " Expected: %" APR_INT64_T_FMT "\n" \
+ " Found: %" APR_INT64_T_FMT "\n" \
+ " at %s:%d", \
+ tst_int2, tst_int1, __FILE__, __LINE__); \
+ } while(0)
+
/* Baton for any arguments that need to be passed from main() to svn
* test functions.
@@ -331,6 +347,12 @@ svn_error_t *
svn_test__init_auth_baton(svn_auth_baton_t **baton,
apr_pool_t *result_pool);
+/* Create a temp folder for test & schedule it for automatic cleanup.
+ * Uses POOL for all allocations. */
+svn_error_t *
+svn_test_make_sandbox_dir(const char **sb_dir_p,
+ const char *sb_name,
+ apr_pool_t *pool);
/*
* Test predicates
Modified: subversion/branches/authzperf/subversion/tests/svn_test_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/svn_test_fs.c?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/svn_test_fs.c (original)
+++ subversion/branches/authzperf/subversion/tests/svn_test_fs.c Fri Apr 29 18:38:53 2016
@@ -119,7 +119,7 @@ create_fs(svn_fs_t **fs_p,
runs. */
SVN_ERR(svn_io_remove_dir2(name, TRUE, NULL, NULL, pool));
- SVN_ERR(svn_fs_create(fs_p, name, fs_config, pool));
+ SVN_ERR(svn_fs_create2(fs_p, name, fs_config, pool, pool));
if (! *fs_p)
return svn_error_create(SVN_ERR_FS_GENERAL, NULL,
"Couldn't alloc a new fs object.");
@@ -195,7 +195,7 @@ svn_test__create_fs2(svn_fs_t **fs_p,
SVN_ERR(maybe_install_fs_conf(*fs_p, opts, &must_reopen, pool));
if (must_reopen)
{
- SVN_ERR(svn_fs_open2(fs_p, name, NULL, pool, pool));
+ SVN_ERR(svn_fs_open2(fs_p, name, fs_config, pool, pool));
svn_fs_set_warning_func(*fs_p, fs_warning_handler, NULL);
}
@@ -364,15 +364,17 @@ svn_test__set_file_contents(svn_fs_root_
svn_txdelta_window_handler_t consumer_func;
void *consumer_baton;
svn_string_t string;
+ apr_pool_t *subpool = svn_pool_create(pool);
SVN_ERR(svn_fs_apply_textdelta(&consumer_func, &consumer_baton,
- root, path, NULL, NULL, pool));
+ root, path, NULL, NULL, subpool));
string.data = contents;
string.len = strlen(contents);
SVN_ERR(svn_txdelta_send_string(&string, consumer_func,
- consumer_baton, pool));
+ consumer_baton, subpool));
+ svn_pool_destroy(subpool);
return SVN_NO_ERROR;
}
@@ -644,10 +646,27 @@ svn_test__validate_changes(svn_fs_root_t
apr_hash_t *expected,
apr_pool_t *pool)
{
+ svn_fs_path_change_iterator_t *iter;
apr_hash_t *actual;
apr_hash_index_t *hi;
+ svn_fs_path_change3_t *change;
+
+ SVN_ERR(svn_fs_paths_changed3(&iter, root, pool, pool));
+ SVN_ERR(svn_fs_path_change_get(&change, iter));
+
+ /* We collect all changes b/c this is the easiest way to check for an
+ exact match against EXPECTED. */
+ actual = apr_hash_make(pool);
+ while (change)
+ {
+ const char *path = apr_pstrmemdup(pool, change->path.data,
+ change->path.len);
+ /* No duplicates! */
+ SVN_TEST_ASSERT(!apr_hash_get(actual, path, change->path.len));
+ apr_hash_set(actual, path, change->path.len, path);
- SVN_ERR(svn_fs_paths_changed2(&actual, root, pool));
+ SVN_ERR(svn_fs_path_change_get(&change, iter));
+ }
#if 0
/* Print ACTUAL and EXPECTED. */
@@ -847,6 +866,7 @@ svn_test__create_blame_repository(svn_re
svn_fs_txn_t *txn;
svn_fs_root_t *txn_root, *revision_root;
svn_revnum_t youngest_rev = 0;
+ apr_pool_t *subpool = svn_pool_create(pool);
/* Create a filesystem and repository. */
SVN_ERR(svn_test__create_repos(&repos, test_name,
@@ -857,87 +877,96 @@ svn_test__create_blame_repository(svn_re
/* Revision 1: Add trunk, tags, branches. */
SVN_ERR(svn_repos_fs_begin_txn_for_commit(&txn, repos, youngest_rev,
- "initial", "log msg", pool));
- SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
- SVN_ERR(svn_fs_make_dir(txn_root, "trunk", pool));
- SVN_ERR(svn_fs_make_dir(txn_root, "tags", pool));
- SVN_ERR(svn_fs_make_dir(txn_root, "branches", pool));
- SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, pool));
+ "initial", "log msg", subpool));
+ SVN_ERR(svn_fs_txn_root(&txn_root, txn, subpool));
+ SVN_ERR(svn_fs_make_dir(txn_root, "trunk", subpool));
+ SVN_ERR(svn_fs_make_dir(txn_root, "tags", subpool));
+ SVN_ERR(svn_fs_make_dir(txn_root, "branches", subpool));
+ SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, subpool));
SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(youngest_rev));
+ svn_pool_clear(subpool);
/* Revision 2: Add the Greek tree on the trunk. */
SVN_ERR(svn_repos_fs_begin_txn_for_commit(&txn, repos, youngest_rev,
- "initial", "log msg", pool));
- SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
- SVN_ERR(svn_test__create_greek_tree_at(txn_root, "trunk", pool));
- SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, pool));
+ "initial", "log msg", subpool));
+ SVN_ERR(svn_fs_txn_root(&txn_root, txn, subpool));
+ SVN_ERR(svn_test__create_greek_tree_at(txn_root, "trunk", subpool));
+ SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, subpool));
SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(youngest_rev));
+ svn_pool_clear(subpool);
/* Revision 3: Tweak trunk/A/mu. */
SVN_ERR(svn_repos_fs_begin_txn_for_commit(&txn, repos, youngest_rev,
- "user-trunk", "log msg", pool));
- SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
+ "user-trunk", "log msg", subpool));
+ SVN_ERR(svn_fs_txn_root(&txn_root, txn, subpool));
SVN_ERR(svn_test__set_file_contents(txn_root, "trunk/A/mu",
- "A\nB\nC\nD\nE\nF\nG\nH\nI", pool));
- SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, pool));
+ "A\nB\nC\nD\nE\nF\nG\nH\nI", subpool));
+ SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, subpool));
SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(youngest_rev));
+ svn_pool_clear(subpool);
/* Revision 4: Copy trunk to branches/1.0.x. */
SVN_ERR(svn_repos_fs_begin_txn_for_commit(&txn, repos, youngest_rev,
- "copy", "log msg", pool));
- SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
- SVN_ERR(svn_fs_revision_root(&revision_root, fs, youngest_rev, pool));
+ "copy", "log msg", subpool));
+ SVN_ERR(svn_fs_txn_root(&txn_root, txn, subpool));
+ SVN_ERR(svn_fs_revision_root(&revision_root, fs, youngest_rev, subpool));
SVN_ERR(svn_fs_copy(revision_root, "trunk",
txn_root, "branches/1.0.x",
- pool));
- SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, pool));
+ subpool));
+ SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, subpool));
SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(youngest_rev));
+ svn_pool_clear(subpool);
/* Revision 5: Tweak trunk/A/mu. */
SVN_ERR(svn_repos_fs_begin_txn_for_commit(&txn, repos, youngest_rev,
- "user-trunk", "log msg", pool));
- SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
+ "user-trunk", "log msg", subpool));
+ SVN_ERR(svn_fs_txn_root(&txn_root, txn, subpool));
SVN_ERR(svn_test__set_file_contents(txn_root, "trunk/A/mu",
"A\nB\nC -- trunk edit\nD\nE\nF\nG\nH\nI",
- pool));
- SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, pool));
+ subpool));
+ SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, subpool));
SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(youngest_rev));
+ svn_pool_clear(subpool);
/* Revision 6: Tweak branches/1.0.x/A/mu. */
SVN_ERR(svn_repos_fs_begin_txn_for_commit(&txn, repos, youngest_rev,
- "user-branch", "log msg", pool));
- SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
+ "user-branch", "log msg", subpool));
+ SVN_ERR(svn_fs_txn_root(&txn_root, txn, subpool));
SVN_ERR(svn_test__set_file_contents(txn_root, "branches/1.0.x/A/mu",
"A\nB\nC\nD -- branch edit\nE\nF\nG\nH\nI",
- pool));
- SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, pool));
+ subpool));
+ SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, subpool));
SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(youngest_rev));
+ svn_pool_clear(subpool);
/* Revision 7: Merge trunk to branch. */
SVN_ERR(svn_repos_fs_begin_txn_for_commit(&txn, repos, youngest_rev,
- "user-merge1", "log msg", pool));
- SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
+ "user-merge1", "log msg", subpool));
+ SVN_ERR(svn_fs_txn_root(&txn_root, txn, subpool));
SVN_ERR(svn_test__set_file_contents(txn_root, "branches/1.0.x/A/mu",
"A\nB\nC -- trunk edit\nD -- branch edit"
- "\nE\nF\nG\nH\nI", pool));
+ "\nE\nF\nG\nH\nI", subpool));
SVN_ERR(svn_fs_change_node_prop(txn_root, "/branches/1.0.x", "svn:mergeinfo",
- svn_string_create("/trunk:4-6", pool),
- pool));
- SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, pool));
+ svn_string_create("/trunk:4-6", subpool),
+ subpool));
+ SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, subpool));
SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(youngest_rev));
+ svn_pool_clear(subpool);
/* Revision 8: Merge branch to trunk. */
SVN_ERR(svn_repos_fs_begin_txn_for_commit(&txn, repos, youngest_rev,
- "user-merge2", "log msg", pool));
- SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
+ "user-merge2", "log msg", subpool));
+ SVN_ERR(svn_fs_txn_root(&txn_root, txn, subpool));
SVN_ERR(svn_test__set_file_contents(txn_root, "trunk/A/mu",
"A\nB\nC -- trunk edit\nD -- branch edit\n"
- "E\nF\nG\nH\nI", pool));
+ "E\nF\nG\nH\nI", subpool));
SVN_ERR(svn_fs_change_node_prop(txn_root, "/trunk", "svn:mergeinfo",
- svn_string_create("/branches/1.0.x:4-7", pool),
- pool));
- SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, pool));
+ svn_string_create("/branches/1.0.x:4-7", subpool),
+ subpool));
+ SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, subpool));
SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(youngest_rev));
+ svn_pool_destroy(subpool);
+
return SVN_NO_ERROR;
}
Modified: subversion/branches/authzperf/subversion/tests/svn_test_fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/tests/svn_test_fs.h?rev=1741682&r1=1741681&r2=1741682&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/tests/svn_test_fs.h (original)
+++ subversion/branches/authzperf/subversion/tests/svn_test_fs.h Fri Apr 29 18:38:53 2016
@@ -134,7 +134,7 @@ svn_test__validate_tree(svn_fs_root_t *r
int num_entries,
apr_pool_t *pool);
-/* Verify that svn_fs_paths_changed2(ROOT) returns a hash with exactly
+/* Verify that svn_fs_paths_changed3(ROOT) returns a hash with exactly
the same keys as EXPECTED_KEYS. Values are not currently verified.
*/
svn_error_t *