subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danie...@apache.org
Subject svn commit: r1494307 - in /subversion/trunk/subversion: libsvn_fs_fs/fs_fs.c tests/libsvn_fs_fs/fs-pack-test.c
Date Tue, 18 Jun 2013 21:12:21 GMT
Author: danielsh
Date: Tue Jun 18 21:12:21 2013
New Revision: 1494307

URL: http://svn.apache.org/r1494307
Log:
Document and test a special case.

* subversion/libsvn_fs_fs/fs_fs.c
  (pack_revprops_shard): Document it.

* subversion/tests/libsvn_fs_fs/fs-pack-test.c
  (pack_shard_size_one): New test for it.
  (test_funcs): Run the new tes

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

Modified: subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c?rev=1494307&r1=1494306&r2=1494307&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Tue Jun 18 21:12:21 2013
@@ -10047,6 +10047,9 @@ pack_revprops_shard(const char *pack_fil
   end_rev = (svn_revnum_t) ((shard + 1) * (max_files_per_dir) - 1);
   if (start_rev == 0)
     ++start_rev;
+    /* Special special case: if max_files_per_dir is 1, then at this point
+       start_rev == 1 and end_rev == 0 (!).  Fortunately, everything just
+       works. */
 
   /* initialize the revprop size info */
   sizes = apr_array_make(scratch_pool, max_files_per_dir, sizeof(apr_off_t));

Modified: subversion/trunk/subversion/tests/libsvn_fs_fs/fs-pack-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_fs_fs/fs-pack-test.c?rev=1494307&r1=1494306&r2=1494307&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_fs_fs/fs-pack-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_fs_fs/fs-pack-test.c Tue Jun 18 21:12:21 2013
@@ -124,6 +124,8 @@ pack_notify(void *baton,
   return SVN_NO_ERROR;
 }
 
+#define R1_LOG_MSG "Let's serf"
+
 /* Create a packed filesystem in DIR.  Set the shard size to
    SHARD_SIZE and create NUM_REVS number of revisions (in addition to
    r0).  Use POOL for allocations.  After this function successfully
@@ -165,6 +167,9 @@ create_packed_filesystem(const char *dir
   SVN_ERR(svn_fs_begin_txn(&txn, fs, 0, subpool));
   SVN_ERR(svn_fs_txn_root(&txn_root, txn, subpool));
   SVN_ERR(svn_test__create_greek_tree(txn_root, subpool));
+  SVN_ERR(svn_fs_change_txn_prop(txn, SVN_PROP_REVISION_LOG,
+                                 svn_string_create(R1_LOG_MSG, pool), 
+                                 pool));
   SVN_ERR(svn_fs_commit_txn(&conflict, &after_rev, txn, subpool));
   SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(after_rev));
 
@@ -823,6 +828,35 @@ test_info(const svn_test_opts_t *opts,
 #undef MAX_REV
 
 /* ------------------------------------------------------------------------ */
+#define REPO_NAME "test-repo-fsfs-pack-shard-size-one"
+#define SHARD_SIZE 1
+#define MAX_REV 4
+static svn_error_t *
+pack_shard_size_one(const svn_test_opts_t *opts,
+                     apr_pool_t *pool)
+{
+  svn_string_t *propval;
+  svn_fs_t *fs;
+
+  /* Bail (with success) on known-untestable scenarios */
+  if ((strcmp(opts->fs_type, "fsfs") != 0)
+      || (opts->server_minor_version && (opts->server_minor_version < 6)))
+    return SVN_NO_ERROR;
+
+  SVN_ERR(create_packed_filesystem(REPO_NAME, opts, MAX_REV, SHARD_SIZE,
+                                   pool));
+  SVN_ERR(svn_fs_open(&fs, REPO_NAME, NULL, pool));
+  /* whitebox: revprop packing special-cases r0, which causes
+     (start_rev==1, end_rev==0) in pack_revprops_shard().  So test that. */
+  SVN_ERR(svn_fs_revision_prop(&propval, fs, 1, SVN_PROP_REVISION_LOG, pool));
+  SVN_TEST_STRING_ASSERT(propval->data, R1_LOG_MSG);
+
+  return SVN_NO_ERROR;
+}
+#undef REPO_NAME
+#undef SHARD_SIZE
+#undef MAX_REV
+/* ------------------------------------------------------------------------ */
 
 /* The test table.  */
 
@@ -849,5 +883,7 @@ struct svn_test_descriptor_t test_funcs[
                        "test file hint at shard boundary"),
     SVN_TEST_OPTS_PASS(test_info,
                        "test svn_fs_info"),
+    SVN_TEST_OPTS_PASS(pack_shard_size_one,
+                       "test packing with shard size = 1"),
     SVN_TEST_NULL
   };



Mime
View raw message