subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1733818 - /subversion/trunk/subversion/tests/libsvn_fs/fs-test.c
Date Sun, 06 Mar 2016 18:20:19 GMT
Author: stefan2
Date: Sun Mar  6 18:20:18 2016
New Revision: 1733818

URL: http://svn.apache.org/viewvc?rev=1733818&view=rev
Log:
Extend the large changed paths tests to also test access to cached data.

* subversion/tests/libsvn_fs/fs-test.c
  (CHANGES_COUNT,
   verify_added_files_list): Factored out from ...
  (test_large_changed_paths_list): ... this. Verify twice to cover caching.

Modified:
    subversion/trunk/subversion/tests/libsvn_fs/fs-test.c

Modified: subversion/trunk/subversion/tests/libsvn_fs/fs-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_fs/fs-test.c?rev=1733818&r1=1733817&r2=1733818&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_fs/fs-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_fs/fs-test.c Sun Mar  6 18:20:18 2016
@@ -7033,48 +7033,32 @@ freeze_and_commit(const svn_test_opts_t
   return SVN_NO_ERROR;
 }
 
+/* Number of changes in a revision.
+ * Should be > 100 to span multiple blocks. */
+#define CHANGES_COUNT 1017
+
+/* Check that REVISION in FS reports the expected changes. */
 static svn_error_t *
-test_large_changed_paths_list(const svn_test_opts_t *opts,
-                              apr_pool_t *pool)
+verify_added_files_list(svn_fs_t *fs,
+                        svn_revnum_t revision,
+                        apr_pool_t *scratch_pool)
 {
-  svn_fs_t *fs;
-  svn_fs_txn_t *txn;
-  svn_fs_root_t *txn_root, *root;
   int i;
-  svn_revnum_t rev = 0;
-  apr_pool_t *iterpool = svn_pool_create(pool);
-  const char *repo_name = "test-repo-changed-paths-list";
+  svn_fs_root_t *root;
   apr_hash_t *changed_paths;
   svn_fs_path_change_iterator_t *iterator;
   svn_fs_path_change3_t *change;
-  enum { CHANGES_COUNT = 1017 };
+  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
 
-  SVN_ERR(svn_test__create_fs(&fs, repo_name, opts, pool));
+  /* Collect changes and test that no path gets reported twice. */
+  SVN_ERR(svn_fs_revision_root(&root, fs, revision, scratch_pool));
+  SVN_ERR(svn_fs_paths_changed3(&iterator, root, scratch_pool, scratch_pool));
 
-  /* r1: Add many empty files - just to amass a long list of changes. */
-  SVN_ERR(svn_fs_begin_txn(&txn, fs, rev, pool));
-  SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
-
-  for (i = 0; i < CHANGES_COUNT; ++i)
-    {
-      const char *file_name;
-      svn_pool_clear(iterpool);
-
-      file_name = apr_psprintf(iterpool, "/file-%d", i);
-      SVN_ERR(svn_fs_make_file(txn_root, file_name, iterpool));
-    }
-
-  SVN_ERR(test_commit_txn(&rev, txn, NULL, pool));
-
-  /* Now, read the change list.  Test that no path gets reported twice. */
-  SVN_ERR(svn_fs_revision_root(&root, fs, rev, pool));
-  SVN_ERR(svn_fs_paths_changed3(&iterator, root, pool, pool));
-
-  changed_paths = apr_hash_make(pool);
+  changed_paths = apr_hash_make(scratch_pool);
   SVN_ERR(svn_fs_path_change_get(&change, iterator));
   while (change)
     {
-      const char *path = apr_pstrmemdup(pool, change->path.data,
+      const char *path = apr_pstrmemdup(scratch_pool, change->path.data,
                                         change->path.len);
       SVN_TEST_ASSERT(change->change_kind == svn_fs_path_change_add);
       SVN_TEST_ASSERT(!apr_hash_get(changed_paths, path, change->path.len));
@@ -7094,11 +7078,51 @@ test_large_changed_paths_list(const svn_
       SVN_TEST_ASSERT(svn_hash_gets(changed_paths, file_name));
     }
 
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+test_large_changed_paths_list(const svn_test_opts_t *opts,
+                              apr_pool_t *pool)
+{
+  svn_fs_t *fs;
+  svn_fs_txn_t *txn;
+  svn_fs_root_t *txn_root;
+  int i;
+  svn_revnum_t rev = 0;
+  apr_pool_t *iterpool = svn_pool_create(pool);
+  const char *repo_name = "test-repo-changed-paths-list";
+
+  SVN_ERR(svn_test__create_fs(&fs, repo_name, opts, pool));
+
+  /* r1: Add many empty files - just to amass a long list of changes. */
+  SVN_ERR(svn_fs_begin_txn(&txn, fs, rev, pool));
+  SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
+
+  for (i = 0; i < CHANGES_COUNT; ++i)
+    {
+      const char *file_name;
+      svn_pool_clear(iterpool);
+
+      file_name = apr_psprintf(iterpool, "/file-%d", i);
+      SVN_ERR(svn_fs_make_file(txn_root, file_name, iterpool));
+    }
+
+  SVN_ERR(test_commit_txn(&rev, txn, NULL, pool));
+
+  /* Now, read the change list.
+   * Do it twice to cover cached data as well. */
+  svn_pool_clear(iterpool);
+  verify_added_files_list(fs, rev, iterpool);
+  svn_pool_clear(iterpool);
+  verify_added_files_list(fs, rev, iterpool);
   svn_pool_destroy(iterpool);
 
   return SVN_NO_ERROR;
 }
 
+#undef CHANGES_COUNT
+
 /* ------------------------------------------------------------------------ */
 
 /* The test table.  */



Mime
View raw message