You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2014/12/19 17:10:53 UTC

svn commit: r1646785 - /subversion/trunk/subversion/tests/libsvn_subr/config-test.c

Author: philip
Date: Fri Dec 19 16:10:52 2014
New Revision: 1646785

URL: http://svn.apache.org/r1646785
Log:
Add a new test that demonstrates a bug in the config expansion code.

* subversion/tests/libsvn_subr/config-test.c
  (test_expand): New test.
  (test_funcs): Add new test, mark WIMP.

Modified:
    subversion/trunk/subversion/tests/libsvn_subr/config-test.c

Modified: subversion/trunk/subversion/tests/libsvn_subr/config-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_subr/config-test.c?rev=1646785&r1=1646784&r2=1646785&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_subr/config-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_subr/config-test.c Fri Dec 19 16:10:52 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);
+
+  /* This fails reliably with pool debugging enabled because the expanded
+     value of "c" was 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,9 @@ 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_WIMP(test_expand,
+                       "test r/o mode",
+                       "expansion fails with pool debugging"),
     SVN_TEST_NULL
   };