subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1659011 - /subversion/trunk/subversion/tests/libsvn_ra/ra-test.c
Date Wed, 11 Feb 2015 17:19:32 GMT
Author: rhuijben
Date: Wed Feb 11 17:19:32 2015
New Revision: 1659011

URL: http://svn.apache.org/r1659011
Log:
In the test where we use svnserve as a subprocess, close the repository
before using it via svnserve to avoid multiple races when closing down.

Our BDB handle and the ra session are in the same pool and are closed
around the same time, but once we may immediately start a delete
attempt as part of the test cleanup.

And we know BDB is not friendly towards outside DB changes....

* subversion/tests/libsvn_ra/ra-test.c
  (tunnel_repos_name): Move into only function that uses this.
  (tunnel_callback_test): Create repository in scratch pool.

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

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=1659011&r1=1659010&r2=1659011&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_ra/ra-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_ra/ra-test.c Wed Feb 11 17:19:32 2015
@@ -41,8 +41,6 @@
 #include "../svn_test_fs.h"
 #include "../../libsvn_ra_local/ra_local.h"
 
-static const char tunnel_repos_name[] = "test-repo-tunnel";
-
 /*-------------------------------------------------------------------*/
 
 /** Helper routines. **/
@@ -348,14 +346,18 @@ tunnel_callback_test(const svn_test_opts
                      apr_pool_t *pool)
 {
   tunnel_baton_t b = { TUNNEL_MAGIC };
-  apr_pool_t *connection_pool;
-  svn_repos_t *repos;
+  apr_pool_t *scratch_pool = svn_pool_create(pool);
   const char *url;
   svn_ra_callbacks2_t *cbtable;
   svn_ra_session_t *session;
   svn_error_t *err;
+  const char tunnel_repos_name[] = "test-repo-tunnel";
+
+  SVN_ERR(svn_test__create_repos(NULL, tunnel_repos_name, opts, scratch_pool));
 
-  SVN_ERR(svn_test__create_repos(&repos, tunnel_repos_name, opts, pool));
+  /* Immediately close the repository to avoid race condition with svnserve
+     (and then the cleanup code) with BDB when our pool is cleared. */
+  svn_pool_clear(scratch_pool);
 
   url = apr_pstrcat(pool, "svn+test://localhost/", tunnel_repos_name,
                     SVN_VA_NULL);
@@ -372,9 +374,8 @@ tunnel_callback_test(const svn_test_opts
                                         NULL, NULL, NULL, pool));
 
   b.last_check = FALSE;
-  connection_pool = svn_pool_create(pool);
   err = svn_ra_open4(&session, NULL, url, NULL, cbtable, NULL, NULL,
-                     connection_pool);
+                     scratch_pool);
   if (err && err->apr_err == SVN_ERR_TEST_FAILED)
     {
       svn_handle_error2(err, stderr, FALSE, "svn_tests: ");
@@ -384,7 +385,7 @@ tunnel_callback_test(const svn_test_opts
   SVN_ERR(err);
   SVN_TEST_ASSERT(b.last_check);
   SVN_TEST_ASSERT(b.open_count > 0);
-  svn_pool_destroy(connection_pool);
+  svn_pool_destroy(scratch_pool);
   SVN_TEST_ASSERT(b.open_count == 0);
   return SVN_NO_ERROR;
 }



Mime
View raw message