You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2013/12/13 17:43:39 UTC
svn commit: r1550765 - in /subversion/trunk: build.conf
subversion/libsvn_client/mtcc.c subversion/tests/libsvn_client/mtcc-test.c
Author: rhuijben
Date: Fri Dec 13 16:43:39 2013
New Revision: 1550765
URL: http://svn.apache.org/r1550765
Log:
Following up on r1550758, add an initial testcase for the svn_client_mtcc
api and fix the first few issues found by running this test.
* build.conf
(mtcc-test): New test.
* subversion/libsvn_client/mtcc.c
(mtcc_op_find): Calculate basename correctly. Set output argument.
(svn_client_mtcc_create): Allocate enough memory.
* subversion/tests/libsvn_client/mtcc-test.c
New file.
Added:
subversion/trunk/subversion/tests/libsvn_client/mtcc-test.c (with props)
Modified:
subversion/trunk/build.conf
subversion/trunk/subversion/libsvn_client/mtcc.c
Modified: subversion/trunk/build.conf
URL: http://svn.apache.org/viewvc/subversion/trunk/build.conf?rev=1550765&r1=1550764&r2=1550765&view=diff
==============================================================================
--- subversion/trunk/build.conf (original)
+++ subversion/trunk/build.conf Fri Dec 13 16:43:39 2013
@@ -1126,6 +1126,14 @@ install = test
libs = libsvn_test libsvn_client libsvn_wc libsvn_repos libsvn_ra libsvn_fs libsvn_delta libsvn_subr apriconv apr
msvc-force-static = yes
+[mtcc-test]
+description = Test Multi Command Context
+type = exe
+path = subversion/tests/libsvn_client
+sources = mtcc-test.c ../libsvn_wc/utils.c
+install = test
+libs = libsvn_test libsvn_client libsvn_wc libsvn_repos libsvn_ra libsvn_fs libsvn_delta libsvn_subr apriconv apr
+
# ----------------------------------------------------------------------------
# Tests for libsvn_diff
@@ -1434,7 +1442,7 @@ libs = __ALL__
sqlite-test
svndiff-test vdelta-test
entries-dump atomic-ra-revprop-change wc-lock-tester wc-incomplete-tester
- client-test
+ client-test mtcc-test
conflict-data-test db-test pristine-store-test entries-compat-test
op-depth-test dirent_uri-test wc-queries-test wc-test
auth-test
Modified: subversion/trunk/subversion/libsvn_client/mtcc.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/mtcc.c?rev=1550765&r1=1550764&r2=1550765&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/mtcc.c (original)
+++ subversion/trunk/subversion/libsvn_client/mtcc.c Fri Dec 13 16:43:39 2013
@@ -91,7 +91,7 @@ mtcc_op_find(svn_client_mtcc_op_t **op,
if (child)
{
- name = apr_pstrmemdup(scratch_pool, relpath, (relpath-child));
+ name = apr_pstrmemdup(scratch_pool, relpath, (child-relpath));
child++; /* Skip '/' */
}
else
@@ -134,6 +134,7 @@ mtcc_op_find(svn_client_mtcc_op_t **op,
if (!child)
{
+ *op = cop;
*created = TRUE;
return SVN_NO_ERROR;
}
@@ -157,7 +158,7 @@ svn_client_mtcc_create(svn_client_mtcc_t
mtcc_pool = svn_pool_create(result_pool);
- *mtcc = apr_pcalloc(mtcc_pool, sizeof(*mtcc));
+ *mtcc = apr_pcalloc(mtcc_pool, sizeof(**mtcc));
(*mtcc)->pool = mtcc_pool;
(*mtcc)->base_revision = base_revision;
@@ -591,7 +592,7 @@ commit_file(const svn_delta_editor_t *ed
}
static svn_error_t *
-commit_directory(svn_delta_editor_t *editor,
+commit_directory(const svn_delta_editor_t *editor,
svn_client_mtcc_op_t *op,
const char *relpath,
svn_revnum_t base_rev,
@@ -669,7 +670,7 @@ svn_client_mtcc_commit(apr_hash_t *revpr
svn_client_mtcc_t *mtcc,
apr_pool_t *scratch_pool)
{
- svn_delta_editor_t *editor;
+ const svn_delta_editor_t *editor;
void *edit_baton;
svn_error_t *err;
void *root_baton;
Added: subversion/trunk/subversion/tests/libsvn_client/mtcc-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_client/mtcc-test.c?rev=1550765&view=auto
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_client/mtcc-test.c (added)
+++ subversion/trunk/subversion/tests/libsvn_client/mtcc-test.c Fri Dec 13 16:43:39 2013
@@ -0,0 +1,108 @@
+/*
+ * Regression tests for mtcc code in the libsvn_client library.
+ *
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ */
+
+#define SVN_DEPRECATED
+
+#include "svn_mergeinfo.h"
+#include "svn_pools.h"
+#include "svn_client.h"
+#include "svn_repos.h"
+#include "svn_subst.h"
+#include "private/svn_wc_private.h"
+
+#include "../svn_test.h"
+#include "../svn_test_fs.h"
+#include "../libsvn_wc/utils.h"
+
+
+/* Create a repository with a filesystem based on OPTS in a subdir NAME,
+ * commit the standard Greek tree as revision 1, and set *REPOS_URL to
+ * the URL we will use to access it.
+ *
+ * ### This always returns a file: URL. We should upgrade this to use the
+ * test suite's specified URL scheme instead. */
+static svn_error_t *
+create_greek_repos(const char **repos_url,
+ const char *name,
+ const svn_test_opts_t *opts,
+ apr_pool_t *pool)
+{
+ svn_repos_t *repos;
+ svn_revnum_t committed_rev;
+ svn_fs_txn_t *txn;
+ svn_fs_root_t *txn_root;
+
+ /* Create a filesytem and repository. */
+ SVN_ERR(svn_test__create_repos(
+ &repos, svn_test_data_path(name, pool), opts, pool));
+
+ /* Prepare and commit a txn containing the Greek tree. */
+ SVN_ERR(svn_fs_begin_txn2(&txn, svn_repos_fs(repos), 0 /* rev */,
+ 0 /* flags */, pool));
+ SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
+ SVN_ERR(svn_test__create_greek_tree(txn_root, pool));
+ SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &committed_rev, txn, pool));
+ SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(committed_rev));
+
+ SVN_ERR(svn_uri_get_file_url_from_dirent(
+ repos_url, svn_test_data_path(name, pool), pool));
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+test_mkdir(const svn_test_opts_t *opts,
+ apr_pool_t *pool)
+{
+ svn_test__sandbox_t b;
+ svn_client_mtcc_t *mtcc;
+ svn_client_ctx_t *ctx;
+
+ SVN_ERR(svn_test__sandbox_create(&b, "mtcc-mkdir", opts, pool));
+
+ SVN_ERR(svn_client_create_context2(&ctx, NULL, pool));
+
+ SVN_ERR(svn_client_mtcc_create(&mtcc, b.repos_url, 1, ctx, pool, pool));
+
+ SVN_ERR(svn_client_mtcc_add_mkdir("A", mtcc, pool));
+ SVN_ERR(svn_client_mtcc_add_mkdir("B", mtcc, pool));
+ SVN_ERR(svn_client_mtcc_add_mkdir("A/C", mtcc, pool));
+ SVN_ERR(svn_client_mtcc_add_mkdir("A/D", mtcc, pool));
+
+ SVN_ERR(svn_client_mtcc_commit(apr_hash_make(pool), NULL, NULL, mtcc, pool));
+
+ return SVN_NO_ERROR;
+}
+
+/* ========================================================================== */
+
+
+int svn_test_max_threads = 3;
+
+struct svn_test_descriptor_t test_funcs[] =
+ {
+ SVN_TEST_NULL,
+ SVN_TEST_OPTS_PASS(test_mkdir,
+ "test mtcc mkdir"),
+ SVN_TEST_NULL
+ };
+
Propchange: subversion/trunk/subversion/tests/libsvn_client/mtcc-test.c
------------------------------------------------------------------------------
svn:eol-style = native