subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1547099 - /subversion/trunk/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c
Date Mon, 02 Dec 2013 16:43:57 GMT
Author: stefan2
Date: Mon Dec  2 16:43:57 2013
New Revision: 1547099

URL: http://svn.apache.org/r1547099
Log:
Close file handles asap - even in test code.  Windows has trouble deleting
folders with open files in it.

* subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c
  (upgrade_txns_to_log_addressing): Use an iterpool inside our data 
                                    manipulation loops to have more control
                                    over open file handles.

Modified:
    subversion/trunk/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c

Modified: subversion/trunk/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c?rev=1547099&r1=1547098&r2=1547099&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c Mon Dec  2 16:43:57 2013
@@ -948,6 +948,8 @@ upgrade_txns_to_log_addressing(const svn
   int i, k;
   svn_test_opts_t temp_opts;
   svn_fs_root_t *root;
+  apr_pool_t *iterpool = svn_pool_create(pool);
+
   static const char * const paths[SHARD_SIZE][2]
     = {
         { "A/mu",        "A/B/lambda" },
@@ -1001,9 +1003,10 @@ upgrade_txns_to_log_addressing(const svn
         {
           svn_stream_t *stream;
           const char *file_path = paths[i][k];
+          svn_pool_clear(iterpool);
 
-          SVN_ERR(svn_fs_apply_text(&stream, root, file_path, NULL, pool));
-          SVN_ERR(svn_stream_printf(stream, pool,
+          SVN_ERR(svn_fs_apply_text(&stream, root, file_path, NULL, iterpool));
+          SVN_ERR(svn_stream_printf(stream, iterpool,
                                     "This is file %s in txn %d",
                                     file_path, i));
           SVN_ERR(svn_stream_close(stream));
@@ -1023,8 +1026,10 @@ upgrade_txns_to_log_addressing(const svn
     {
       svn_fs_txn_t *txn;
       const char *txn_name = APR_ARRAY_IDX(txn_names, i, const char *);
-      SVN_ERR(svn_fs_open_txn(&txn, fs, txn_name, pool));
-      SVN_ERR(svn_fs_commit_txn2(NULL, &rev, txn, TRUE, pool));
+      svn_pool_clear(iterpool);
+
+      SVN_ERR(svn_fs_open_txn(&txn, fs, txn_name, iterpool));
+      SVN_ERR(svn_fs_commit_txn2(NULL, &rev, txn, TRUE, iterpool));
     }
 
   /* Further changes to fill the shard */
@@ -1038,14 +1043,20 @@ upgrade_txns_to_log_addressing(const svn
       if (rev % SHARD_SIZE == 0)
         break;
 
-      SVN_ERR(svn_fs_begin_txn(&txn, fs, rev, pool));
-      SVN_ERR(svn_fs_txn_root(&root, txn, pool));
+      svn_pool_clear(iterpool);
+
+      SVN_ERR(svn_fs_begin_txn(&txn, fs, rev, iterpool));
+      SVN_ERR(svn_fs_txn_root(&root, txn, iterpool));
       SVN_ERR(svn_test__set_file_contents(root, "iota",
-                                          get_rev_contents(rev + 1, pool),
-                                          pool));
-      SVN_ERR(svn_fs_commit_txn(NULL, &rev, txn, pool));
+                                          get_rev_contents(rev + 1, iterpool),
+                                          iterpool));
+      SVN_ERR(svn_fs_commit_txn(NULL, &rev, txn, iterpool));
     }
 
+  /* Make sure to close all file handles etc. from the last iteration */
+
+  svn_pool_clear(iterpool);
+
   /* Pack repo to verify that old and new shard get packed according to
      their respective addressing mode */
 
@@ -1063,8 +1074,10 @@ upgrade_txns_to_log_addressing(const svn
           svn_string_t *string;
           const char *expected;
 
-          SVN_ERR(svn_fs_file_contents(&stream, root, file_path, pool));
-          SVN_ERR(svn_string_from_stream(&string, stream, pool, pool));
+          svn_pool_clear(iterpool);
+
+          SVN_ERR(svn_fs_file_contents(&stream, root, file_path, iterpool));
+          SVN_ERR(svn_string_from_stream(&string, stream, iterpool, iterpool));
 
           expected = apr_psprintf(pool,"This is file %s in txn %d",
                                   file_path, i);
@@ -1079,8 +1092,9 @@ upgrade_txns_to_log_addressing(const svn
                         NULL, NULL, NULL, NULL, pool));
   for (; rev >= 0; --rev)
     {
-      SVN_ERR(svn_fs_revision_root(&root, fs, rev, pool));
-      SVN_ERR(svn_fs_verify_root(root, pool));
+      svn_pool_clear(iterpool);
+      SVN_ERR(svn_fs_revision_root(&root, fs, rev, iterpool));
+      SVN_ERR(svn_fs_verify_root(root, iterpool));
     }
 
   return SVN_NO_ERROR;



Mime
View raw message