You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2014/12/28 13:18:44 UTC

svn commit: r1648191 [2/2] - in /subversion/branches/fsx-id: ./ subversion/bindings/swig/python/tests/ subversion/include/ subversion/include/private/ subversion/libsvn_client/ subversion/libsvn_diff/ subversion/libsvn_fs_fs/ subversion/libsvn_fs_x/ su...

Modified: subversion/branches/fsx-id/subversion/tests/cmdline/svnsync_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-id/subversion/tests/cmdline/svnsync_tests.py?rev=1648191&r1=1648190&r2=1648191&view=diff
==============================================================================
--- subversion/branches/fsx-id/subversion/tests/cmdline/svnsync_tests.py (original)
+++ subversion/branches/fsx-id/subversion/tests/cmdline/svnsync_tests.py Sun Dec 28 12:18:43 2014
@@ -209,8 +209,12 @@ def setup_and_sync(sbox, dump_file_conte
 
   return dest_sbox
 
-def verify_mirror(dest_sbox, src_sbox):
-  """Compare the contents of the DEST_SBOX repository with EXP_DUMP_FILE_CONTENTS."""
+def verify_mirror(dest_sbox, exp_dump_file_contents):
+  """Compare the contents of the mirror repository in DEST_SBOX with
+     EXP_DUMP_FILE_CONTENTS, by comparing the parsed dump stream content.
+
+     First remove svnsync rev-props from the DEST_SBOX repository.
+  """
 
   # Remove some SVNSync-specific housekeeping properties from the
   # mirror repository in preparation for the comparison dump.
@@ -222,10 +226,9 @@ def verify_mirror(dest_sbox, src_sbox):
 
   # Create a dump file from the mirror repository.
   dest_dump = svntest.actions.run_and_verify_dump(dest_sbox.repo_dir)
-  src_dump = svntest.actions.run_and_verify_dump(src_sbox.repo_dir)
 
   svntest.verify.compare_dump_files(
-    "Dump files", "DUMP", src_dump, dest_dump)
+    "Dump files", "DUMP", exp_dump_file_contents, dest_dump)
 
 def run_test(sbox, dump_file_name, subdir=None, exp_dump_file_name=None,
              bypass_prop_validation=False, source_prop_encoding=None,
@@ -251,16 +254,12 @@ or another dump file."""
   # dump file (used to create the master repository) or another specified dump
   # file.
   if exp_dump_file_name:
-    build_repos(sbox)
-    svntest.actions.run_and_verify_load(sbox.repo_dir,
-                                        open(os.path.join(svnsync_tests_dir,
-                                                          exp_dump_file_name),
-                                             'rb').readlines())
-    src_sbox = sbox
+    exp_dump_file_contents = open(os.path.join(svnsync_tests_dir,
+                                  exp_dump_file_name), 'rb').readlines()
   else:
-    src_sbox = sbox
+    exp_dump_file_contents = master_dumpfile_contents
 
-  verify_mirror(dest_sbox, sbox)
+  verify_mirror(dest_sbox, exp_dump_file_contents)
 
 
 
@@ -564,9 +563,7 @@ def delete_revprops(sbox):
   run_copy_revprops(dest_sbox.repo_url, sbox.repo_url)
 
   # Does the result look as we expected?
-  build_repos(sbox)
-  svntest.actions.run_and_verify_load(sbox.repo_dir, expected_contents)
-  verify_mirror(dest_sbox, sbox)
+  verify_mirror(dest_sbox, expected_contents)
 
 @Issue(3870)
 @SkipUnless(svntest.main.is_posix_os)
@@ -576,6 +573,15 @@ def fd_leak_sync_from_serf_to_local(sbox
   resource.setrlimit(resource.RLIMIT_NOFILE, (128, 128))
   run_test(sbox, "largemods.dump", is_src_ra_local=None, is_dest_ra_local=True)
 
+#----------------------------------------------------------------------
+
+@Issue(4476)
+def mergeinfo_contains_r0(sbox):
+  "mergeinfo contains r0"
+  run_test(sbox, "mergeinfo-contains-r0.dump",
+           exp_dump_file_name="mergeinfo-contains-r0.expected.dump",
+           bypass_prop_validation=True)
+
 
 ########################################################################
 # Run the tests
@@ -612,6 +618,7 @@ test_list = [ None,
               descend_into_replace,
               delete_revprops,
               fd_leak_sync_from_serf_to_local, # calls setrlimit
+              mergeinfo_contains_r0,
              ]
 
 if __name__ == '__main__':

Modified: subversion/branches/fsx-id/subversion/tests/libsvn_fs/fs-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-id/subversion/tests/libsvn_fs/fs-test.c?rev=1648191&r1=1648190&r2=1648191&view=diff
==============================================================================
--- subversion/branches/fsx-id/subversion/tests/libsvn_fs/fs-test.c (original)
+++ subversion/branches/fsx-id/subversion/tests/libsvn_fs/fs-test.c Sun Dec 28 12:18:43 2014
@@ -6640,6 +6640,62 @@ test_txn_pool_lifetime(const svn_test_op
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+test_modify_txn_being_written(const svn_test_opts_t *opts,
+                              apr_pool_t *pool)
+{
+  /* FSFS has a limitation (and check) that only one file can be
+   * modified in TXN at time: see r861812 and svn_fs_apply_text() docstring.
+   * This is regression test for this behavior. */
+  svn_fs_t *fs;
+  svn_fs_txn_t *txn;
+  const char *txn_name;
+  svn_fs_root_t *txn_root;
+  svn_stream_t *foo_contents;
+  svn_stream_t *bar_contents;
+
+  /* Bail (with success) on known-untestable scenarios */
+  if (strcmp(opts->fs_type, SVN_FS_TYPE_FSFS) != 0)
+    return svn_error_create(SVN_ERR_TEST_SKIPPED, NULL,
+                            "this will test FSFS repositories only");
+
+  /* Create a new repo. */
+  SVN_ERR(svn_test__create_fs(&fs, "test-modify-txn-being-written",
+                              opts, pool));
+
+  /* Create a TXN_ROOT referencing FS. */
+  SVN_ERR(svn_fs_begin_txn(&txn, fs, 0, pool));
+  SVN_ERR(svn_fs_txn_name(&txn_name, txn, pool));
+  SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
+
+  /* Make file /foo and open for writing.*/
+  SVN_ERR(svn_fs_make_file(txn_root, "/foo", pool));
+  SVN_ERR(svn_fs_apply_text(&foo_contents, txn_root, "/foo", NULL, pool));
+
+  /* Attempt to modify another file '/bar' -- FSFS doesn't allow this. */
+  SVN_ERR(svn_fs_make_file(txn_root, "/bar", pool));
+  SVN_TEST_ASSERT_ERROR(
+      svn_fs_apply_text(&bar_contents, txn_root, "/bar", NULL, pool),
+      SVN_ERR_FS_REP_BEING_WRITTEN);
+
+  /* *Reopen TXN. */
+  SVN_ERR(svn_fs_open_txn(&txn, fs, txn_name, pool));
+  SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
+
+  /* Check that file '/bar' still cannot be modified */
+  SVN_TEST_ASSERT_ERROR(
+      svn_fs_apply_text(&bar_contents, txn_root, "/bar", NULL, pool),
+      SVN_ERR_FS_REP_BEING_WRITTEN);
+
+  /* Close file '/foo'. */
+  SVN_ERR(svn_stream_close(foo_contents));
+
+  /* Now file '/bar' can be modified. */
+  SVN_ERR(svn_fs_apply_text(&bar_contents, txn_root, "/bar", NULL, pool));
+
+  return SVN_NO_ERROR;
+}
+
 /* ------------------------------------------------------------------------ */
 
 /* The test table.  */
@@ -6767,6 +6823,8 @@ static struct svn_test_descriptor_t test
                        "test creating FSFS repository with different opts"),
     SVN_TEST_OPTS_PASS(test_txn_pool_lifetime,
                        "test pool lifetime dependencies with txn roots"),
+    SVN_TEST_OPTS_PASS(test_modify_txn_being_written,
+                       "test modify txn being written in FSFS"),
     SVN_TEST_NULL
   };
 

Modified: subversion/branches/fsx-id/subversion/tests/libsvn_fs_fs/fs-fs-private-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-id/subversion/tests/libsvn_fs_fs/fs-fs-private-test.c?rev=1648191&r1=1648190&r2=1648191&view=diff
==============================================================================
--- subversion/branches/fsx-id/subversion/tests/libsvn_fs_fs/fs-fs-private-test.c (original)
+++ subversion/branches/fsx-id/subversion/tests/libsvn_fs_fs/fs-fs-private-test.c Sun Dec 28 12:18:43 2014
@@ -79,7 +79,7 @@ create_greek_repo(svn_repos_t **repos,
 
 static svn_error_t *
 verify_representation_stats(const svn_fs_fs__representation_stats_t *stats,
-                            apr_int64_t expected_count)
+                            apr_uint64_t expected_count)
 {
   /* Small items, no packing (but inefficiency due to packing attempt). */
   SVN_TEST_ASSERT(stats->total.count == expected_count);
@@ -110,7 +110,7 @@ verify_representation_stats(const svn_fs
 
 static svn_error_t *
 verify_node_stats(const svn_fs_fs__node_stats_t *node_stats,
-                  apr_int64_t expected_count)
+                  apr_uint64_t expected_count)
 {
   SVN_TEST_ASSERT(node_stats->count == expected_count);
   SVN_TEST_ASSERT(   node_stats->size > 100 * node_stats->count
@@ -162,8 +162,8 @@ verify_large_change(const svn_fs_fs__lar
 static svn_error_t *
 verify_histogram(const svn_fs_fs__histogram_t *histogram)
 {
-  apr_int64_t sum_count = 0;
-  apr_int64_t sum_size = 0;
+  apr_uint64_t sum_count = 0;
+  apr_uint64_t sum_size = 0;
 
   int i;
   for (i = 0; i < 64; ++i)

Modified: subversion/branches/fsx-id/subversion/tests/libsvn_subr/cache-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-id/subversion/tests/libsvn_subr/cache-test.c?rev=1648191&r1=1648190&r2=1648191&view=diff
==============================================================================
--- subversion/branches/fsx-id/subversion/tests/libsvn_subr/cache-test.c (original)
+++ subversion/branches/fsx-id/subversion/tests/libsvn_subr/cache-test.c Sun Dec 28 12:18:43 2014
@@ -201,6 +201,102 @@ test_membuffer_cache_basic(apr_pool_t *p
   return basic_cache_test(cache, FALSE, pool);
 }
 
+/* Implements svn_cache__deserialize_func_t */
+static svn_error_t *
+raise_error_deserialize_func(void **out,
+                             void *data,
+                             apr_size_t data_len,
+                             apr_pool_t *pool)
+{
+  return svn_error_create(APR_EGENERAL, NULL, NULL);
+}
+
+/* Implements svn_cache__partial_getter_func_t */
+static svn_error_t *
+raise_error_partial_getter_func(void **out,
+                                const void *data,
+                                apr_size_t data_len,
+                                void *baton,
+                                apr_pool_t *result_pool)
+{
+  return svn_error_create(APR_EGENERAL, NULL, NULL);
+}
+
+/* Implements svn_cache__partial_setter_func_t */
+static svn_error_t *
+raise_error_partial_setter_func(void **data,
+                                apr_size_t *data_len,
+                                void *baton,
+                                apr_pool_t *result_pool)
+{
+  return svn_error_create(APR_EGENERAL, NULL, NULL);
+}
+
+static svn_error_t *
+test_membuffer_serializer_error_handling(apr_pool_t *pool)
+{
+  svn_cache__t *cache;
+  svn_membuffer_t *membuffer;
+  svn_revnum_t twenty = 20;
+  svn_boolean_t found;
+  void *val;
+
+  SVN_ERR(svn_cache__membuffer_cache_create(&membuffer, 10*1024, 1, 0,
+                                            TRUE, TRUE, pool));
+
+  /* Create a cache with just one entry. */
+  SVN_ERR(svn_cache__create_membuffer_cache(&cache,
+                                            membuffer,
+                                            serialize_revnum,
+                                            raise_error_deserialize_func,
+                                            APR_HASH_KEY_STRING,
+                                            "cache:",
+                                            SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY,
+                                            FALSE,
+                                            pool, pool));
+
+  SVN_ERR(svn_cache__set(cache, "twenty", &twenty, pool));
+
+  /* Test retrieving data from cache using full getter that
+     always raises an error. */
+  SVN_TEST_ASSERT_ERROR(
+    svn_cache__get(&val, &found, cache, "twenty", pool),
+    APR_EGENERAL);
+
+  /* Test retrieving data from cache using partial getter that
+     always raises an error. */
+  SVN_TEST_ASSERT_ERROR(
+    svn_cache__get_partial(&val, &found, cache, "twenty",
+                           raise_error_partial_getter_func,
+                           NULL, pool),
+    APR_EGENERAL);
+
+  /* Create a new cache. */
+  SVN_ERR(svn_cache__membuffer_cache_create(&membuffer, 10*1024, 1, 0,
+                                            TRUE, TRUE, pool));
+  SVN_ERR(svn_cache__create_membuffer_cache(&cache,
+                                            membuffer,
+                                            serialize_revnum,
+                                            deserialize_revnum,
+                                            APR_HASH_KEY_STRING,
+                                            "cache:",
+                                            SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY,
+                                            FALSE,
+                                            pool, pool));
+
+  /* Store one entry in cache. */
+  SVN_ERR(svn_cache__set(cache, "twenty", &twenty, pool));
+
+  /* Test setting data in cache using partial setter that
+     always raises an error. */
+  SVN_TEST_ASSERT_ERROR(
+    svn_cache__set_partial(cache, "twenty", 
+                           raise_error_partial_setter_func,
+                           NULL, pool),
+    APR_EGENERAL);
+
+  return SVN_NO_ERROR;
+}
 
 static svn_error_t *
 test_memcache_long_key(const svn_test_opts_t *opts,
@@ -274,6 +370,8 @@ static struct svn_test_descriptor_t test
                        "memcache svn_cache with very long keys"),
     SVN_TEST_PASS2(test_membuffer_cache_basic,
                    "basic membuffer svn_cache test"),
+    SVN_TEST_PASS2(test_membuffer_serializer_error_handling,
+                   "test for error handling in membuffer svn_cache"),
     SVN_TEST_NULL
   };
 

Modified: subversion/branches/fsx-id/subversion/tests/libsvn_subr/config-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-id/subversion/tests/libsvn_subr/config-test.c?rev=1648191&r1=1648190&r2=1648191&view=diff
==============================================================================
--- subversion/branches/fsx-id/subversion/tests/libsvn_subr/config-test.c (original)
+++ subversion/branches/fsx-id/subversion/tests/libsvn_subr/config-test.c Sun Dec 28 12:18:43 2014
@@ -347,6 +347,29 @@ test_read_only_mode(const svn_test_opts_
   return SVN_NO_ERROR;
 }
 
+static svn_error_t *
+test_expand(const svn_test_opts_t *opts,
+            apr_pool_t *pool)
+{
+  svn_config_t *cfg;
+  const char *cfg_file, *val;
+
+  SVN_ERR(get_config_file_path(&cfg_file, opts, pool));
+  SVN_ERR(svn_config_read3(&cfg, cfg_file, TRUE, TRUE, FALSE, pool));
+
+  /* Get expanded "g" which requires expanding "c". */
+  svn_config_get(cfg, &val, "section1", "g", NULL);
+
+  /* Get expanded "c". */
+  svn_config_get(cfg, &val, "section1", "c", NULL);
+
+  /* With pool debugging enabled this ensures that the expanded value 
+     of "c" was not created in a temporary pool when expanding "g". */
+  SVN_TEST_STRING_ASSERT(val, "bar");
+
+  return SVN_NO_ERROR;
+}
+
 /*
    ====================================================================
    If you add a new test to this file, update this array.
@@ -377,6 +400,8 @@ static struct svn_test_descriptor_t test
                    "test parsing config file with BOM"),
     SVN_TEST_OPTS_PASS(test_read_only_mode,
                        "test r/o mode"),
+    SVN_TEST_OPTS_PASS(test_expand,
+                       "test variable expansion"),
     SVN_TEST_NULL
   };
 

Modified: subversion/branches/fsx-id/subversion/tests/libsvn_subr/mergeinfo-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsx-id/subversion/tests/libsvn_subr/mergeinfo-test.c?rev=1648191&r1=1648190&r2=1648191&view=diff
==============================================================================
--- subversion/branches/fsx-id/subversion/tests/libsvn_subr/mergeinfo-test.c (original)
+++ subversion/branches/fsx-id/subversion/tests/libsvn_subr/mergeinfo-test.c Sun Dec 28 12:18:43 2014
@@ -114,7 +114,7 @@ verify_mergeinfo_parse(const char *input
 }
 
 
-#define NBR_MERGEINFO_VALS 24
+#define NBR_MERGEINFO_VALS 25
 
 /* Valid mergeinfo values. */
 static const char * const mergeinfo_vals[NBR_MERGEINFO_VALS] =
@@ -148,7 +148,8 @@ static const char * const mergeinfo_vals
     "/A/:7-8",
     "/A///:7-8",
     "/A/.:7-8",
-    "/A/./B:7-8"
+    "/A/./B:7-8",
+    ":7-8",
   };
 /* Paths corresponding to mergeinfo_vals. */
 static const char * const mergeinfo_paths[NBR_MERGEINFO_VALS] =
@@ -181,7 +182,8 @@ static const char * const mergeinfo_path
     "/A",
     "/A",
     "/A",
-    "/A/B"
+    "/A/B",
+    "/",
   };
 /* First ranges from the paths identified by mergeinfo_paths. */
 static svn_merge_range_t mergeinfo_ranges[NBR_MERGEINFO_VALS][MAX_NBR_RANGES] =
@@ -212,6 +214,7 @@ static svn_merge_range_t mergeinfo_range
     { {6, 8, TRUE} },
     { {6, 8, TRUE} },
     { {6, 8, TRUE} },
+    { {6, 8, TRUE} },
   };
 
 static svn_error_t *
@@ -298,7 +301,7 @@ test_parse_combine_rangeinfo(apr_pool_t
 }
 
 
-#define NBR_BROKEN_MERGEINFO_VALS 27
+#define NBR_BROKEN_MERGEINFO_VALS 26
 /* Invalid mergeinfo values. */
 static const char * const broken_mergeinfo_vals[NBR_BROKEN_MERGEINFO_VALS] =
   {
@@ -330,8 +333,6 @@ static const char * const broken_mergein
     "/trunk:",
     "/trunk:2-9\n/branch:",
     "::",
-    /* No path */
-    ":1-3",
     /* Invalid revisions */
     "trunk:a-3",
     "branch:3-four",