subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1656785 - in /subversion/trunk/subversion/tests/libsvn_wc: op-depth-test.c utils.c utils.h
Date Tue, 03 Feb 2015 16:30:31 GMT
Author: rhuijben
Date: Tue Feb  3 16:30:31 2015
New Revision: 1656785

URL: http://svn.apache.org/r1656785
Log:
Following up on r1656778 and r1656779, start using the current ra layer
in the tests that use the standard C sbox infrastructure, like op-depth-test.

* subversion/tests/libsvn_wc/op-depth-test.c
  (repo_wc_copies): Use helper function that sets up authz.
  (repo_wc_copy): Use new information to avoid file:// assumption.

* subversion/tests/libsvn_wc/utils.c
  (includes): Add svn_cmdline.h.
  (svn_test__create_client_ctx): New function.
  (create_repos_and_wc): Add argument and use new functions to work
    with other ra layers.
  (svn_test__sandbox_create): Update caller.
  (sbox_wc_copy_url,
   sbox_wc_commit_ex,
   sbox_wc_update_depth,
   sbox_wc_switch,
   sbox_wc_move,
   sbox_wc_propset,
   sbox_wc_relocate): Create ctx using helper.

* subversion/tests/libsvn_wc/utils.h
  (svn_test__sandbox_t): Add repos_dir member.
  (svn_client_ctx_t): Add prototype.
  (svn_test__create_client_ctx): New function.

Modified:
    subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c
    subversion/trunk/subversion/tests/libsvn_wc/utils.c
    subversion/trunk/subversion/tests/libsvn_wc/utils.h

Modified: subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c?rev=1656785&r1=1656784&r2=1656785&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c Tue Feb  3 16:30:31 2015
@@ -718,7 +718,7 @@ repo_wc_copies(svn_test__sandbox_t *b)
       }
 
     /* Perform each copy. */
-    SVN_ERR(svn_client_create_context(&ctx, b->pool));
+    SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
     for (subtest = subtests; subtest->from_path; subtest++)
       {
         svn_opt_revision_t rev = { svn_opt_revision_number, { 1 } };
@@ -9690,7 +9690,6 @@ static svn_error_t *
 repo_wc_copy(const svn_test_opts_t *opts, apr_pool_t *pool)
 {
   svn_test__sandbox_t b;
-  const char *repos_dir;
   const char *new_repos_dir;
   const char *new_repos_url;
 
@@ -9718,15 +9717,13 @@ repo_wc_copy(const svn_test_opts_t *opts
     SVN_ERR(check_db_rows(&b, "AA", nodes));
   }
 
-  SVN_ERR(svn_uri_get_dirent_from_file_url(&repos_dir, b.repos_url,
-                                           pool));
-  new_repos_dir = apr_pstrcat(pool, repos_dir, "-2", SVN_VA_NULL);
+  new_repos_dir = apr_pstrcat(pool, b.repos_dir, "-2", SVN_VA_NULL);
   new_repos_url = apr_pstrcat(pool, b.repos_url, "-2", SVN_VA_NULL);
 
   svn_test_add_dir_cleanup(new_repos_dir);
 
   SVN_ERR(svn_io_remove_dir2(new_repos_dir, TRUE, NULL, NULL, pool));
-  SVN_ERR(svn_io_copy_dir_recursively(repos_dir,
+  SVN_ERR(svn_io_copy_dir_recursively(b.repos_dir,
                                       svn_dirent_dirname(new_repos_dir, pool),
                                       svn_dirent_basename(new_repos_dir, pool),
                                       FALSE, NULL, NULL, pool));

Modified: subversion/trunk/subversion/tests/libsvn_wc/utils.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/utils.c?rev=1656785&r1=1656784&r2=1656785&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/utils.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/utils.c Tue Feb  3 16:30:31 2015
@@ -22,6 +22,7 @@
 
 #include "svn_error.h"
 #include "svn_client.h"
+#include "svn_cmdline.h"
 #include "svn_pools.h"
 
 #include "utils.h"
@@ -33,9 +34,30 @@
 #define SVN_WC__I_AM_WC_DB
 #include "../../libsvn_wc/wc_db_private.h"
 
+svn_error_t *
+svn_test__create_client_ctx(svn_client_ctx_t **ctx,
+                            svn_test__sandbox_t *sbox,
+                            apr_pool_t *result_pool)
+{
+  SVN_ERR(svn_client_create_context2(ctx, NULL, result_pool));
+
+  SVN_ERR(svn_cmdline_create_auth_baton(&(*ctx)->auth_baton,
+                                        TRUE  /* non_interactive */,
+                                        "jrandom", "rayjandom",
+                                        NULL,
+                                        TRUE  /* no_auth_cache */,
+                                        FALSE /* trust_server_cert */,
+                                        NULL, NULL, NULL, result_pool));
+
+  if (sbox)
+    (*ctx)->wc_ctx = sbox->wc_ctx;
+
+  return SVN_NO_ERROR;
+}
 
 /* Create an empty repository and WC for the test TEST_NAME.  Set *REPOS_URL
- * to the URL of the new repository and *WC_ABSPATH to the root path of the
+ * to the URL of the new repository, *REPOS_DIR to its local path and
+ * *WC_ABSPATH to the root path of the
  * new WC.
  *
  * Create the repository and WC in subdirectories called
@@ -45,6 +67,7 @@
  * Register the repo and WC to be cleaned up when the test suite exits. */
 static svn_error_t *
 create_repos_and_wc(const char **repos_url,
+                    const char **repos_dir,
                     const char **wc_abspath,
                     const char *test_name,
                     const svn_test_opts_t *opts,
@@ -65,8 +88,6 @@ create_repos_and_wc(const char **repos_u
 
   /* Create a repos. Register it for clean-up. Set *REPOS_URL to its path. */
   {
-    svn_repos_t *repos;
-
     /* Use a subpool to create the repository and then destroy the subpool
        so the repository's underlying filesystem is closed.  If opts->fs_type
        is BDB this prevents any attempt to open a second environment handle
@@ -74,8 +95,8 @@ create_repos_and_wc(const char **repos_u
        only a single environment handle to be open per process. */
     apr_pool_t *subpool = svn_pool_create(pool);
 
-    SVN_ERR(svn_test__create_repos(&repos, repos_path, opts, subpool));
-    SVN_ERR(svn_uri_get_file_url_from_dirent(repos_url, repos_path, pool));
+    SVN_ERR(svn_test__create_repos2(NULL, repos_url, repos_dir, repos_path,
+                                    opts, pool, subpool));
     svn_pool_destroy(subpool);
   }
 
@@ -85,7 +106,7 @@ create_repos_and_wc(const char **repos_u
     svn_client_ctx_t *ctx;
     svn_opt_revision_t head_rev = { svn_opt_revision_head, {0} };
 
-    SVN_ERR(svn_client_create_context2(&ctx, NULL, subpool));
+    SVN_ERR(svn_test__create_client_ctx(&ctx, NULL, subpool));
     SVN_ERR(svn_dirent_get_absolute(wc_abspath, wc_path, pool));
     SVN_ERR(svn_client_checkout3(NULL, *repos_url, *wc_abspath,
                                  &head_rev, &head_rev, svn_depth_infinity,
@@ -101,7 +122,6 @@ create_repos_and_wc(const char **repos_u
   return SVN_NO_ERROR;
 }
 
-
 WC_QUERIES_SQL_DECLARE_STATEMENTS(statements);
 
 svn_error_t *
@@ -149,7 +169,8 @@ svn_test__sandbox_create(svn_test__sandb
                          apr_pool_t *pool)
 {
   sandbox->pool = pool;
-  SVN_ERR(create_repos_and_wc(&sandbox->repos_url, &sandbox->wc_abspath,
+  SVN_ERR(create_repos_and_wc(&sandbox->repos_url, &sandbox->repos_dir,
+                              &sandbox->wc_abspath,
                               test_name, opts, pool));
   SVN_ERR(svn_wc_context_create(&sandbox->wc_ctx, NULL, pool, pool));
   return SVN_NO_ERROR;
@@ -240,8 +261,7 @@ sbox_wc_copy_url(svn_test__sandbox_t *b,
                                         scratch_pool, 1,
                                         sizeof(svn_client_copy_source_t *));
 
-  SVN_ERR(svn_client_create_context2(&ctx, NULL, scratch_pool));
-  ctx->wc_ctx = b->wc_ctx;
+  SVN_ERR(svn_test__create_client_ctx(&ctx, b, scratch_pool));
 
   if (SVN_IS_VALID_REVNUM(revision))
     {
@@ -334,8 +354,7 @@ sbox_wc_commit_ex(svn_test__sandbox_t *b
   apr_pool_t *scratch_pool = svn_pool_create(b->pool);
   svn_error_t *err;
 
-  SVN_ERR(svn_client_create_context2(&ctx, NULL, scratch_pool));
-  ctx->wc_ctx = b->wc_ctx;
+  SVN_ERR(svn_test__create_client_ctx(&ctx, b, scratch_pool));
 
   /* A successfull commit doesn't close the ra session, but leaves that
      to the caller. This leaves the BDB handle open, which might cause
@@ -387,8 +406,8 @@ sbox_wc_update_depth(svn_test__sandbox_t
     }
 
   APR_ARRAY_PUSH(paths, const char *) = sbox_wc_path(b, path);
-  SVN_ERR(svn_client_create_context2(&ctx, NULL, b->pool));
-  ctx->wc_ctx = b->wc_ctx;
+  SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
+
   return svn_client_update4(&result_revs, paths, &revision, depth,
                             sticky, FALSE, FALSE, FALSE, FALSE,
                             ctx, b->pool);
@@ -412,8 +431,8 @@ sbox_wc_switch(svn_test__sandbox_t *b,
   svn_opt_revision_t head_rev = { svn_opt_revision_head, {0} };
 
   url = apr_pstrcat(b->pool, b->repos_url, url, SVN_VA_NULL);
-  SVN_ERR(svn_client_create_context2(&ctx, NULL, b->pool));
-  ctx->wc_ctx = b->wc_ctx;
+  SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
+
   return svn_client_switch3(&result_rev, sbox_wc_path(b, path), url,
                             &head_rev, &head_rev, depth,
                             FALSE /* depth_is_sticky */,
@@ -464,8 +483,8 @@ sbox_wc_move(svn_test__sandbox_t *b, con
   apr_array_header_t *paths = apr_array_make(b->pool, 1,
                                              sizeof(const char *));
 
-  SVN_ERR(svn_client_create_context2(&ctx, NULL, b->pool));
-  ctx->wc_ctx = b->wc_ctx;
+  SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
+
   APR_ARRAY_PUSH(paths, const char *) = sbox_wc_path(b, src);
   return svn_client_move7(paths, sbox_wc_path(b, dst),
                           FALSE /* move_as_child */,
@@ -488,8 +507,8 @@ sbox_wc_propset(svn_test__sandbox_t *b,
                                              sizeof(const char *));
   svn_string_t *pval = value ? svn_string_create(value, b->pool) : NULL;
 
-  SVN_ERR(svn_client_create_context2(&ctx, NULL, b->pool));
-  ctx->wc_ctx = b->wc_ctx;
+  SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
+
   APR_ARRAY_PUSH(paths, const char *) = sbox_wc_path(b, path);
   return svn_client_propset_local(name, pval, paths, svn_depth_empty,
                                   TRUE /* skip_checks */,
@@ -503,8 +522,7 @@ sbox_wc_relocate(svn_test__sandbox_t *b,
   apr_pool_t *scratch_pool = b->pool;
   svn_client_ctx_t *ctx;
 
-  SVN_ERR(svn_client_create_context2(&ctx, NULL, scratch_pool));
-  ctx->wc_ctx = b->wc_ctx;
+  SVN_ERR(svn_test__create_client_ctx(&ctx, b, scratch_pool));
 
   SVN_ERR(svn_client_relocate2(b->wc_abspath, b->repos_url,
                                new_repos_url, FALSE, ctx,scratch_pool));

Modified: subversion/trunk/subversion/tests/libsvn_wc/utils.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/utils.h?rev=1656785&r1=1656784&r2=1656785&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/utils.h (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/utils.h Tue Feb  3 16:30:31 2015
@@ -53,6 +53,8 @@ typedef struct svn_test__sandbox_t
   svn_wc_context_t *wc_ctx;
   /* The repository URL. */
   const char *repos_url;
+  /* Local path to the repository */
+  const char *repos_dir;
   /* The absolute local path of the WC root. */
   const char *wc_abspath;
   /* A pool that can be used for all allocations. */
@@ -185,6 +187,15 @@ svn_test__create_fake_wc(const char *wc_
                          apr_pool_t *scratch_pool);
 
 
+typedef struct svn_client_ctx_t svn_client_ctx_t;
+
+/* Create a client context for the specified sandbox */
+svn_error_t *
+svn_test__create_client_ctx(svn_client_ctx_t **ctx,
+                            svn_test__sandbox_t *sbox,
+                            apr_pool_t *result_pool);
+
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */



Mime
View raw message