You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2014/04/09 13:05:40 UTC

svn commit: r1585931 - in /subversion/trunk: build.conf subversion/tests/libsvn_repos/dump-load-test.c subversion/tests/libsvn_repos/repos-test.c

Author: julianfoad
Date: Wed Apr  9 11:05:40 2014
New Revision: 1585931

URL: http://svn.apache.org/r1585931
Log:
Create a new test file for dump/load tests in the libsvn_repos test suite.

The all-in-one 'repos-test.c' file has grown rather large and I added the
first dump/load-related test to it only recently and I want to add more.

* build.conf
  (dump-load-test): New section.
  (__ALL_TESTS__): Add 'dump-load-test'.

* subversion/tests/libsvn_repos/repos-test.c
  (test_funcs): Remove 'test_dump_r0_mergeinfo'.
  (dump_r0_mergeinfo_notifier, test_dump_r0_mergeinfo): Move to ...

* subversion/tests/libsvn_repos/dump-load-test.c
  ... this new file.

Added:
    subversion/trunk/subversion/tests/libsvn_repos/dump-load-test.c   (with props)
Modified:
    subversion/trunk/build.conf
    subversion/trunk/subversion/tests/libsvn_repos/repos-test.c

Modified: subversion/trunk/build.conf
URL: http://svn.apache.org/viewvc/subversion/trunk/build.conf?rev=1585931&r1=1585930&r2=1585931&view=diff
==============================================================================
--- subversion/trunk/build.conf (original)
+++ subversion/trunk/build.conf Wed Apr  9 11:05:40 2014
@@ -852,6 +852,14 @@ sources = repos-test.c dir-delta-editor.
 install = test
 libs = libsvn_test libsvn_repos libsvn_fs libsvn_delta libsvn_subr apriconv apr
 
+[dump-load-test]
+description = Test dumping/loading repositories in libsvn_repos
+type = exe
+path = subversion/tests/libsvn_repos
+sources = dump-load-test.c
+install = test
+libs = libsvn_test libsvn_repos libsvn_fs libsvn_delta libsvn_subr apriconv apr
+
 # ----------------------------------------------------------------------------
 # Tests for libsvn_subr
 
@@ -1440,7 +1448,8 @@ path = build/win32
 libs = __ALL__
        fs-test fs-base-test fs-fsfs-test fs-fs-pack-test fs-x-pack-test
        string-table-test
-       skel-test strings-reps-test changes-test locks-test repos-test
+       skel-test strings-reps-test changes-test locks-test
+       repos-test dump-load-test
        checksum-test compat-test config-test hashdump-test mergeinfo-test
        opt-test packed-data-test path-test prefix-string-test
        priority-queue-test root-pools-test stream-test

Added: subversion/trunk/subversion/tests/libsvn_repos/dump-load-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_repos/dump-load-test.c?rev=1585931&view=auto
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_repos/dump-load-test.c (added)
+++ subversion/trunk/subversion/tests/libsvn_repos/dump-load-test.c Wed Apr  9 11:05:40 2014
@@ -0,0 +1,109 @@
+/* dump-load-test.c --- tests for dumping and loading repositories
+ *
+ * ====================================================================
+ *    Licensed to the Apache Software Foundation (ASF) under one
+ *    or more contributor license agreements.  See the NOTICE file
+ *    distributed with this work for additional information
+ *    regarding copyright ownership.  The ASF licenses this file
+ *    to you under the Apache License, Version 2.0 (the
+ *    "License"); you may not use this file except in compliance
+ *    with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing,
+ *    software distributed under the License is distributed on an
+ *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *    KIND, either express or implied.  See the License for the
+ *    specific language governing permissions and limitations
+ *    under the License.
+ * ====================================================================
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <apr_pools.h>
+
+#include "svn_pools.h"
+#include "svn_error.h"
+#include "svn_fs.h"
+#include "svn_repos.h"
+#include "private/svn_repos_private.h"
+
+#include "../svn_test.h"
+#include "../svn_test_fs.h"
+
+
+
+/* Notification receiver for test_dump_bad_mergeinfo(). This does not
+   need to do anything, it just needs to exist.
+ */
+static void
+dump_r0_mergeinfo_notifier(void *baton,
+                           const svn_repos_notify_t *notify,
+                           apr_pool_t *scratch_pool)
+{
+}
+
+/* Regression test for part the 'dump' part of issue #4476 "Mergeinfo
+   containing r0 makes svnsync and svnadmin dump fail". */
+static svn_error_t *
+test_dump_r0_mergeinfo(const svn_test_opts_t *opts,
+                       apr_pool_t *pool)
+{
+  svn_repos_t *repos;
+  svn_fs_t *fs;
+  svn_fs_txn_t *txn;
+  svn_fs_root_t *txn_root;
+  svn_revnum_t youngest_rev = 0;
+  const svn_string_t *bad_mergeinfo = svn_string_create("/foo:0", pool);
+
+  SVN_ERR(svn_test__create_repos(&repos, "test-repo-dump-r0-mergeinfo",
+                                 opts, pool));
+  fs = svn_repos_fs(repos);
+
+  /* Revision 1:  Any commit will do, here  */
+  SVN_ERR(svn_fs_begin_txn(&txn, fs, youngest_rev, pool));
+  SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
+  SVN_ERR(svn_fs_make_dir(txn_root, "/bar", pool));
+  SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, pool));
+  SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(youngest_rev));
+
+  /* Revision 2:  Add bad mergeinfo */
+  SVN_ERR(svn_fs_begin_txn(&txn, fs, youngest_rev, pool));
+  SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
+  SVN_ERR(svn_fs_change_node_prop(txn_root, "/bar", "svn:mergeinfo", bad_mergeinfo, pool));
+  SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, pool));
+  SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(youngest_rev));
+
+  /* Test that a dump completes without error. In order to exercise the
+     functionality under test -- that is, in order for the dump to try to
+     parse the mergeinfo it is dumping -- the dump must start from a
+     revision greater than 1 and must take a notification callback. */
+  {
+    svn_stringbuf_t *stringbuf = svn_stringbuf_create_empty(pool);
+    svn_stream_t *stream = svn_stream_from_stringbuf(stringbuf, pool);
+
+    SVN_ERR(svn_repos_dump_fs3(repos, stream, 2, SVN_INVALID_REVNUM,
+                               FALSE, FALSE,
+                               dump_r0_mergeinfo_notifier, NULL,
+                               NULL, NULL,
+                               pool));
+  }
+
+  return SVN_NO_ERROR;
+}
+
+/* The test table.  */
+
+static int max_threads = 4;
+
+static struct svn_test_descriptor_t test_funcs[] =
+  {
+    SVN_TEST_NULL,
+    SVN_TEST_OPTS_PASS(test_dump_r0_mergeinfo,
+                       "test dumping with r0 mergeinfo"),
+    SVN_TEST_NULL
+  };
+
+SVN_TEST_MAIN

Propchange: subversion/trunk/subversion/tests/libsvn_repos/dump-load-test.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: subversion/trunk/subversion/tests/libsvn_repos/dump-load-test.c
------------------------------------------------------------------------------
    svn:mime-type = text/x-csrc

Modified: subversion/trunk/subversion/tests/libsvn_repos/repos-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_repos/repos-test.c?rev=1585931&r1=1585930&r2=1585931&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_repos/repos-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_repos/repos-test.c Wed Apr  9 11:05:40 2014
@@ -3538,65 +3538,6 @@ test_repos_fs_type(const svn_test_opts_t
   return SVN_NO_ERROR;
 }
 
-/* Notification receiver for test_dump_bad_mergeinfo(). This does not
-   need to do anything, it just needs to exist.
- */
-static void
-dump_r0_mergeinfo_notifier(void *baton,
-                           const svn_repos_notify_t *notify,
-                           apr_pool_t *scratch_pool)
-{
-}
-
-/* Regression test for part the 'dump' part of issue #4476 "Mergeinfo
-   containing r0 makes svnsync and svnadmin dump fail". */
-static svn_error_t *
-test_dump_r0_mergeinfo(const svn_test_opts_t *opts,
-                       apr_pool_t *pool)
-{
-  svn_repos_t *repos;
-  svn_fs_t *fs;
-  svn_fs_txn_t *txn;
-  svn_fs_root_t *txn_root;
-  svn_revnum_t youngest_rev = 0;
-  const svn_string_t *bad_mergeinfo = svn_string_create("/foo:0", pool);
-
-  SVN_ERR(svn_test__create_repos(&repos, "test-repo-dump-r0-mergeinfo",
-                                 opts, pool));
-  fs = svn_repos_fs(repos);
-
-  /* Revision 1:  Any commit will do, here  */
-  SVN_ERR(svn_fs_begin_txn(&txn, fs, youngest_rev, pool));
-  SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
-  SVN_ERR(svn_fs_make_dir(txn_root, "/bar", pool));
-  SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, pool));
-  SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(youngest_rev));
-
-  /* Revision 2:  Add bad mergeinfo */
-  SVN_ERR(svn_fs_begin_txn(&txn, fs, youngest_rev, pool));
-  SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
-  SVN_ERR(svn_fs_change_node_prop(txn_root, "/bar", "svn:mergeinfo", bad_mergeinfo, pool));
-  SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, pool));
-  SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(youngest_rev));
-
-  /* Test that a dump completes without error. In order to exercise the
-     functionality under test -- that is, in order for the dump to try to
-     parse the mergeinfo it is dumping -- the dump must start from a
-     revision greater than 1 and must take a notification callback. */
-  {
-    svn_stringbuf_t *stringbuf = svn_stringbuf_create_empty(pool);
-    svn_stream_t *stream = svn_stream_from_stringbuf(stringbuf, pool);
-
-    SVN_ERR(svn_repos_dump_fs3(repos, stream, 2, SVN_INVALID_REVNUM,
-                               FALSE, FALSE,
-                               dump_r0_mergeinfo_notifier, NULL,
-                               NULL, NULL,
-                               pool));
-  }
-
-  return SVN_NO_ERROR;
-}
-
 /* The test table.  */
 
 static int max_threads = 4;
@@ -3650,8 +3591,6 @@ static struct svn_test_descriptor_t test
                        "test svn_repos__config_pool_*"),
     SVN_TEST_OPTS_PASS(test_repos_fs_type,
                        "test test_repos_fs_type"),
-    SVN_TEST_OPTS_PASS(test_dump_r0_mergeinfo,
-                       "test dumping with r0 mergeinfo"),
     SVN_TEST_NULL
   };