subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1656814 - in /subversion/trunk/subversion/tests: libsvn_client/mtcc-test.c libsvn_wc/utils.c svn_test.h svn_test_main.c
Date Tue, 03 Feb 2015 17:04:40 GMT
Author: rhuijben
Date: Tue Feb  3 17:04:40 2015
New Revision: 1656814

URL: http://svn.apache.org/r1656814
Log:
Make the MTCC tests use the current ra layer. Add a bit of plumbing
to make it easier to setup ra usage.

* subversion/tests/libsvn_client/mtcc-test.c
  (make_greek_tree,
   test_mkdir,
   test_mkgreek,
   test_swap,
   test_propset,
   test_update_files,
   test_overwrite,
   test_anchoring,
   test_replace_tree): Create test ra agnostic.

* subversion/tests/libsvn_wc/utils.c
  (svn_test__create_client_ctx):
    Extract some code to svn_cmdline_create_auth_baton.

* subversion/tests/svn_test.h
  (includes): Add svn_auth.h.
  (svn_test__init_auth_baton): New function.

* subversion/tests/svn_test_main.c
  (svn_test__init_auth_baton): New function.

Modified:
    subversion/trunk/subversion/tests/libsvn_client/mtcc-test.c
    subversion/trunk/subversion/tests/libsvn_wc/utils.c
    subversion/trunk/subversion/tests/svn_test.h
    subversion/trunk/subversion/tests/svn_test_main.c

Modified: 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=1656814&r1=1656813&r2=1656814&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_client/mtcc-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_client/mtcc-test.c Tue Feb  3 17:04:40 2015
@@ -87,6 +87,8 @@ make_greek_tree(const char *repos_url,
   subpool = svn_pool_create(scratch_pool);
 
   SVN_ERR(svn_client_create_context2(&ctx, NULL, subpool));
+  SVN_ERR(svn_test__init_auth_baton(&ctx->auth_baton, subpool));
+
   SVN_ERR(svn_client__mtcc_create(&mtcc, repos_url, 0, ctx, subpool, subpool));
 
   for (i = 0; svn_test__greek_tree_nodes[i].path; i++)
@@ -121,16 +123,14 @@ test_mkdir(const svn_test_opts_t *opts,
 {
   svn_client__mtcc_t *mtcc;
   svn_client_ctx_t *ctx;
-  const char *repos_abspath;
   const char *repos_url;
-  svn_repos_t* repos;
 
-  repos_abspath = svn_test_data_path("mtcc-mkdir", pool);
-  SVN_ERR(svn_dirent_get_absolute(&repos_abspath, repos_abspath, pool));
-  SVN_ERR(svn_uri_get_file_url_from_dirent(&repos_url, repos_abspath, pool));
-  SVN_ERR(svn_test__create_repos(&repos, repos_abspath, opts, pool));
+  SVN_ERR(svn_test__create_repos2(NULL, &repos_url, NULL, "mtcc-mkdir",
+                                  opts, pool, pool));
 
   SVN_ERR(svn_client_create_context2(&ctx, NULL, pool));
+  SVN_ERR(svn_test__init_auth_baton(&ctx->auth_baton, pool));
+
   SVN_ERR(svn_client__mtcc_create(&mtcc, repos_url, 0, ctx, pool, pool));
 
   SVN_ERR(svn_client__mtcc_add_mkdir("branches", mtcc, pool));
@@ -151,18 +151,16 @@ test_mkgreek(const svn_test_opts_t *opts
 {
   svn_client__mtcc_t *mtcc;
   svn_client_ctx_t *ctx;
-  const char *repos_abspath;
   const char *repos_url;
-  svn_repos_t* repos;
 
-  repos_abspath = svn_test_data_path("mtcc-mkgreek", pool);
-  SVN_ERR(svn_dirent_get_absolute(&repos_abspath, repos_abspath, pool));
-  SVN_ERR(svn_uri_get_file_url_from_dirent(&repos_url, repos_abspath, pool));
-  SVN_ERR(svn_test__create_repos(&repos, repos_abspath, opts, pool));
+  SVN_ERR(svn_test__create_repos2(NULL, &repos_url, NULL, "mtcc-mkgreek",
+                                  opts, pool, pool));
 
   SVN_ERR(make_greek_tree(repos_url, pool));
 
   SVN_ERR(svn_client_create_context2(&ctx, NULL, pool));
+  SVN_ERR(svn_test__init_auth_baton(&ctx->auth_baton, pool));
+
   SVN_ERR(svn_client__mtcc_create(&mtcc, repos_url, 1, ctx, pool, pool));
 
   SVN_ERR(svn_client__mtcc_add_copy("A", 1, "greek_A", mtcc, pool));
@@ -178,18 +176,16 @@ test_swap(const svn_test_opts_t *opts,
 {
   svn_client__mtcc_t *mtcc;
   svn_client_ctx_t *ctx;
-  const char *repos_abspath;
   const char *repos_url;
-  svn_repos_t* repos;
 
-  repos_abspath = svn_test_data_path("mtcc-swap", pool);
-  SVN_ERR(svn_dirent_get_absolute(&repos_abspath, repos_abspath, pool));
-  SVN_ERR(svn_uri_get_file_url_from_dirent(&repos_url, repos_abspath, pool));
-  SVN_ERR(svn_test__create_repos(&repos, repos_abspath, opts, pool));
+  SVN_ERR(svn_test__create_repos2(NULL, &repos_url, NULL, "mtcc-swap",
+                                  opts, pool, pool));
 
   SVN_ERR(make_greek_tree(repos_url, pool));
 
   SVN_ERR(svn_client_create_context2(&ctx, NULL, pool));
+  SVN_ERR(svn_test__init_auth_baton(&ctx->auth_baton, pool));
+
   SVN_ERR(svn_client__mtcc_create(&mtcc, repos_url, 1, ctx, pool, pool));
 
   SVN_ERR(svn_client__mtcc_add_move("A/B", "B", mtcc, pool));
@@ -207,18 +203,16 @@ test_propset(const svn_test_opts_t *opts
 {
   svn_client__mtcc_t *mtcc;
   svn_client_ctx_t *ctx;
-  const char *repos_abspath;
   const char *repos_url;
-  svn_repos_t* repos;
 
-  repos_abspath = svn_test_data_path("mtcc-propset", pool);
-  SVN_ERR(svn_dirent_get_absolute(&repos_abspath, repos_abspath, pool));
-  SVN_ERR(svn_uri_get_file_url_from_dirent(&repos_url, repos_abspath, pool));
-  SVN_ERR(svn_test__create_repos(&repos, repos_abspath, opts, pool));
+  SVN_ERR(svn_test__create_repos2(NULL, &repos_url, NULL, "mtcc-propset",
+                                  opts, pool, pool));
 
   SVN_ERR(make_greek_tree(repos_url, pool));
 
   SVN_ERR(svn_client_create_context2(&ctx, NULL, pool));
+  SVN_ERR(svn_test__init_auth_baton(&ctx->auth_baton, pool));
+
   SVN_ERR(svn_client__mtcc_create(&mtcc, repos_url, 1, ctx, pool, pool));
 
   SVN_ERR(svn_client__mtcc_add_propset("iota", "key",
@@ -281,18 +275,15 @@ test_update_files(const svn_test_opts_t
 {
   svn_client__mtcc_t *mtcc;
   svn_client_ctx_t *ctx;
-  const char *repos_abspath;
   const char *repos_url;
-  svn_repos_t* repos;
-
-  repos_abspath = svn_test_data_path("mtcc-update-files", pool);
-  SVN_ERR(svn_dirent_get_absolute(&repos_abspath, repos_abspath, pool));
-  SVN_ERR(svn_uri_get_file_url_from_dirent(&repos_url, repos_abspath, pool));
-  SVN_ERR(svn_test__create_repos(&repos, repos_abspath, opts, pool));
 
+  SVN_ERR(svn_test__create_repos2(NULL, &repos_url, NULL, "mtcc-update-files",
+                                  opts, pool, pool));
   SVN_ERR(make_greek_tree(repos_url, pool));
 
   SVN_ERR(svn_client_create_context2(&ctx, NULL, pool));
+  SVN_ERR(svn_test__init_auth_baton(&ctx->auth_baton, pool));
+
   SVN_ERR(svn_client__mtcc_create(&mtcc, repos_url, 1, ctx, pool, pool));
 
   /* Update iota with knowledge of the old data */
@@ -331,18 +322,16 @@ test_overwrite(const svn_test_opts_t *op
 {
   svn_client__mtcc_t *mtcc;
   svn_client_ctx_t *ctx;
-  const char *repos_abspath;
   const char *repos_url;
-  svn_repos_t* repos;
 
-  repos_abspath = svn_test_data_path("mtcc-overwrite", pool);
-  SVN_ERR(svn_dirent_get_absolute(&repos_abspath, repos_abspath, pool));
-  SVN_ERR(svn_uri_get_file_url_from_dirent(&repos_url, repos_abspath, pool));
-  SVN_ERR(svn_test__create_repos(&repos, repos_abspath, opts, pool));
+  SVN_ERR(svn_test__create_repos2(NULL, &repos_url, NULL, "mtcc-overwrite",
+                                  opts, pool, pool));
 
   SVN_ERR(make_greek_tree(repos_url, pool));
 
   SVN_ERR(svn_client_create_context2(&ctx, NULL, pool));
+  SVN_ERR(svn_test__init_auth_baton(&ctx->auth_baton, pool));
+
   SVN_ERR(svn_client__mtcc_create(&mtcc, repos_url, 1, ctx, pool, pool));
 
   SVN_ERR(svn_client__mtcc_add_copy("A", 1, "AA", mtcc, pool));
@@ -365,18 +354,15 @@ test_anchoring(const svn_test_opts_t *op
 {
   svn_client__mtcc_t *mtcc;
   svn_client_ctx_t *ctx;
-  const char *repos_abspath;
   const char *repos_url;
-  svn_repos_t* repos;
 
-  repos_abspath = svn_test_data_path("mtcc-anchoring", pool);
-  SVN_ERR(svn_dirent_get_absolute(&repos_abspath, repos_abspath, pool));
-  SVN_ERR(svn_uri_get_file_url_from_dirent(&repos_url, repos_abspath, pool));
-  SVN_ERR(svn_test__create_repos(&repos, repos_abspath, opts, pool));
+  SVN_ERR(svn_test__create_repos2(NULL, &repos_url, NULL, "mtcc-anchoring",
+                                  opts, pool, pool));
 
   SVN_ERR(make_greek_tree(repos_url, pool));
 
   SVN_ERR(svn_client_create_context2(&ctx, NULL, pool));
+  SVN_ERR(svn_test__init_auth_baton(&ctx->auth_baton, pool));
 
   /* Update a file as root operation */
   SVN_ERR(svn_client__mtcc_create(&mtcc,
@@ -454,18 +440,15 @@ test_replace_tree(const svn_test_opts_t
 {
   svn_client__mtcc_t *mtcc;
   svn_client_ctx_t *ctx;
-  const char *repos_abspath;
   const char *repos_url;
-  svn_repos_t* repos;
 
-  repos_abspath = svn_test_data_path("mtcc-replace_tree", pool);
-  SVN_ERR(svn_dirent_get_absolute(&repos_abspath, repos_abspath, pool));
-  SVN_ERR(svn_uri_get_file_url_from_dirent(&repos_url, repos_abspath, pool));
-  SVN_ERR(svn_test__create_repos(&repos, repos_abspath, opts, pool));
+  SVN_ERR(svn_test__create_repos2(NULL, &repos_url, NULL, "mtcc-replace_tree",
+                                  opts, pool, pool));
 
   SVN_ERR(make_greek_tree(repos_url, pool));
 
   SVN_ERR(svn_client_create_context2(&ctx, NULL, pool));
+  SVN_ERR(svn_test__init_auth_baton(&ctx->auth_baton, pool));
 
   /* Update a file as root operation */
   SVN_ERR(svn_client__mtcc_create(&mtcc, repos_url, 1, ctx, pool, 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=1656814&r1=1656813&r2=1656814&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/utils.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/utils.c Tue Feb  3 17:04:40 2015
@@ -41,13 +41,8 @@ svn_test__create_client_ctx(svn_client_c
 {
   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));
+  SVN_ERR(svn_test__init_auth_baton(&(*ctx)->auth_baton,
+                                    result_pool));
 
   if (sbox)
     (*ctx)->wc_ctx = sbox->wc_ctx;

Modified: subversion/trunk/subversion/tests/svn_test.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/svn_test.h?rev=1656814&r1=1656813&r2=1656814&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/svn_test.h (original)
+++ subversion/trunk/subversion/tests/svn_test.h Tue Feb  3 17:04:40 2015
@@ -34,6 +34,7 @@
 #include "svn_types.h"
 #include "svn_error.h"
 #include "svn_string.h"
+#include "svn_auth.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -277,6 +278,11 @@ svn_test_get_srcdir(const char **srcdir,
                     const svn_test_opts_t *opts,
                     apr_pool_t *pool);
 
+/* Initializes a standard auth baton for accessing the repositories */
+svn_error_t *
+svn_test__init_auth_baton(svn_auth_baton_t **baton,
+                          apr_pool_t *result_pool);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/trunk/subversion/tests/svn_test_main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/svn_test_main.c?rev=1656814&r1=1656813&r2=1656814&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/svn_test_main.c (original)
+++ subversion/trunk/subversion/tests/svn_test_main.c Tue Feb  3 17:04:40 2015
@@ -691,6 +691,21 @@ svn_test_get_srcdir(const char **srcdir,
   return SVN_NO_ERROR;
 }
 
+svn_error_t *
+svn_test__init_auth_baton(svn_auth_baton_t **ab,
+                          apr_pool_t *result_pool)
+{
+  SVN_ERR(svn_cmdline_create_auth_baton(ab,
+                                        TRUE  /* non_interactive */,
+                                        "jrandom", "rayjandom",
+                                        NULL,
+                                        TRUE  /* no_auth_cache */,
+                                        FALSE /* trust_server_cert */,
+                                        NULL, NULL, NULL, result_pool));
+
+  return SVN_NO_ERROR;
+}
+
 /* Standard svn test program */
 int
 svn_test_main(int argc, const char *argv[], int max_threads,



Mime
View raw message