subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1656841 - in /subversion/trunk/subversion: libsvn_ra_serf/lock.c tests/libsvn_ra/ra-test.c
Date Tue, 03 Feb 2015 17:29:41 GMT
Author: rhuijben
Date: Tue Feb  3 17:29:41 2015
New Revision: 1656841

URL: http://svn.apache.org/r1656841
Log:
Switch a few 'ra' C tests to using the current ra layer. Add regression test
for r1656713. Fix some actual consistency issues found for lock handling
in ra_serf.

* subversion/libsvn_ra_serf/lock.c
  (run_locks): Don't return locks without a token.

* subversion/tests/libsvn_ra/ra-test.c
  (make_and_open_local_repos): Rename to ...
  (make_and_open_repos): ... this. And open repos using ra layer.
  (location_segments_test): Update caller.
  (expect_error): Split assertion to show serf problem. Handle serf respons
    on svn_ra_get_lock().
  (lock_test): Update caller.
  (get_dir_test): New function.
  (max_threads): Allow using multiple threads.
  (test_funcs): Add get_dir_test.

Modified:
    subversion/trunk/subversion/libsvn_ra_serf/lock.c
    subversion/trunk/subversion/tests/libsvn_ra/ra-test.c

Modified: subversion/trunk/subversion/libsvn_ra_serf/lock.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/lock.c?rev=1656841&r1=1656840&r2=1656841&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/lock.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/lock.c Tue Feb  3 17:29:41 2015
@@ -336,7 +336,7 @@ run_locks(svn_ra_serf__session_t *sess,
                 {
                   svn_lock_t *report_lock = NULL;
 
-                  if (locking)
+                  if (locking && ctx->lock->token)
                     report_lock = ctx->lock;
 
                   cb_err = lock_func(lock_baton, ctx->path, locking,

Modified: subversion/trunk/subversion/tests/libsvn_ra/ra-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_ra/ra-test.c?rev=1656841&r1=1656840&r2=1656841&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_ra/ra-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_ra/ra-test.c Tue Feb  3 17:29:41 2015
@@ -49,29 +49,21 @@ static const char tunnel_repos_name[] =
 
 
 static svn_error_t *
-make_and_open_local_repos(svn_ra_session_t **session,
-                          const char *repos_name,
-                          const svn_test_opts_t *opts,
-                          apr_pool_t *pool)
+make_and_open_repos(svn_ra_session_t **session,
+                    const char *repos_name,
+                    const svn_test_opts_t *opts,
+                    apr_pool_t *pool)
 {
-  svn_repos_t *repos;
   const char *url;
   svn_ra_callbacks2_t *cbtable;
 
   SVN_ERR(svn_ra_create_callbacks(&cbtable, pool));
-  SVN_ERR(svn_cmdline_create_auth_baton(&cbtable->auth_baton,
-                                        TRUE  /* non_interactive */,
-                                        "jrandom", "rayjandom",
-                                        NULL,
-                                        TRUE  /* no_auth_cache */,
-                                        FALSE /* trust_server_cert */,
-                                        NULL, NULL, NULL, pool));
+  SVN_ERR(svn_test__init_auth_baton(&cbtable->auth_baton, pool));
 
-  SVN_ERR(svn_test__create_repos(&repos, repos_name, opts, pool));
+  SVN_ERR(svn_test__create_repos2(NULL, &url, NULL, repos_name, opts,
+                                  pool, pool));
   SVN_ERR(svn_ra_initialize(pool));
 
-  SVN_ERR(svn_uri_get_file_url_from_dirent(&url, repos_name, pool));
-
   SVN_ERR(svn_ra_open4(session, NULL, url, NULL, cbtable, NULL, NULL, pool));
 
   return SVN_NO_ERROR;
@@ -272,9 +264,9 @@ location_segments_test(const svn_test_op
   b.segments = segments;
   b.pool = pool;
 
-  SVN_ERR(make_and_open_local_repos(&session,
-                                    "test-repo-locsegs", opts,
-                                    pool));
+  SVN_ERR(make_and_open_repos(&session,
+                              "test-repo-locsegs", opts,
+                              pool));
 
   /* ### This currently tests only a small subset of what's possible. */
   SVN_ERR(commit_changes(session, pool));
@@ -438,9 +430,20 @@ expect_error(const char *path,
 {
   svn_lock_t *lock;
   struct lock_result_t *result = svn_hash_gets(results, path);
+  svn_error_t *err;
+
+  SVN_TEST_ASSERT(result && result->err);
+  SVN_TEST_ASSERT(!result->lock);
+  err = svn_ra_get_lock(session, &lock, path, scratch_pool);
+  if (err) /* ra_serf reports SVN_ERR_FS_NOT_FOUND. ### Consistency? */
+    {
+      if (err->apr_err != SVN_ERR_FS_NOT_FOUND)
+        return svn_error_trace(err);
+
+      svn_error_clear(err);
+      lock = NULL;
+    }
 
-  SVN_TEST_ASSERT(result && !result->lock && result->err);
-  SVN_ERR(svn_ra_get_lock(session, &lock, path, scratch_pool));
   SVN_TEST_ASSERT(!lock);
   return SVN_NO_ERROR;
 }
@@ -488,8 +491,7 @@ lock_test(const svn_test_opts_t *opts,
   struct lock_baton_t baton;
   apr_hash_index_t *hi;
 
-  SVN_ERR(make_and_open_local_repos(&session, "test-repo-lock", opts,
-                                    pool));
+  SVN_ERR(make_and_open_repos(&session, "test-repo-lock", opts, pool));
   SVN_ERR(commit_tree(session, pool));
 
   baton.results = apr_hash_make(pool);
@@ -564,11 +566,31 @@ lock_test(const svn_test_opts_t *opts,
   return SVN_NO_ERROR;
 }
 
+/* Test svn_ra_get_dir2(). */
+static svn_error_t *
+get_dir_test(const svn_test_opts_t *opts,
+             apr_pool_t *pool)
+{
+  svn_ra_session_t *session;
+  apr_hash_t *dirents;
+
+  SVN_ERR(make_and_open_repos(&session, "test-get-dir", opts, pool));
+  SVN_ERR(commit_tree(session, pool));
+
+  /* This call used to block on ra-svn for 1.8.0...r1656713 */
+  SVN_TEST_ASSERT_ERROR(svn_ra_get_dir2(session, &dirents, NULL, NULL,
+                                        "non/existing/relpath", 1,
+                                        SVN_DIRENT_KIND, pool),
+                        SVN_ERR_FS_NOT_FOUND);
+
+  return SVN_NO_ERROR;
+}
+
 
 
 /* The test table.  */
 
-static int max_threads = 1;
+static int max_threads = 2;
 
 static struct svn_test_descriptor_t test_funcs[] =
   {
@@ -581,6 +603,8 @@ static struct svn_test_descriptor_t test
                        "test ra_svn tunnel creation callbacks"),
     SVN_TEST_OPTS_PASS(lock_test,
                        "lock multiple paths"),
+    SVN_TEST_OPTS_PASS(get_dir_test,
+                       "test ra_get_dir2"),
     SVN_TEST_NULL
   };
 



Mime
View raw message