You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2013/10/29 14:07:49 UTC

svn commit: r1536700 - in /subversion/trunk/subversion/tests: libsvn_client/ libsvn_client/client-test.c libsvn_delta/random-test.c libsvn_diff/ libsvn_diff/diff-diff3-test.c svn_test.h svn_test_main.c

Author: brane
Date: Tue Oct 29 13:07:49 2013
New Revision: 1536700

URL: http://svn.apache.org/r1536700
Log:
Begin converting C tests to use the same transient directory as the Python
tests, so that both can be run off a RAM disk.

* subversion/tests/svn_test.h (svn_test_data_path): New prototype.
* subversion/tests/svn_test_main.c: Include svn_utf.h.
  (data_path): New static variable.
  (init_test_data): New; initializes the value of data_path.
  (svn_test_data_path): Implement.
  (main): Call init_test_data and handle any resulting errors.

* subversion/tests/libsvn_client/client-test.c,
  subversion/tests/libsvn_delta/random-test.c,
  subversion/tests/libsvn_diff/diff-diff3-test.c: Update tests to only
   create files in the transient directory.

* subversion/tests/libsvn_client,
  subversion/tests/libsvn_diff: Do not ignore names that are no longer
   created in the source directory, even for in-tree builds.

Modified:
    subversion/trunk/subversion/tests/libsvn_client/   (props changed)
    subversion/trunk/subversion/tests/libsvn_client/client-test.c
    subversion/trunk/subversion/tests/libsvn_delta/random-test.c
    subversion/trunk/subversion/tests/libsvn_diff/   (props changed)
    subversion/trunk/subversion/tests/libsvn_diff/diff-diff3-test.c
    subversion/trunk/subversion/tests/svn_test.h
    subversion/trunk/subversion/tests/svn_test_main.c

Propchange: subversion/trunk/subversion/tests/libsvn_client/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Oct 29 13:07:49 2013
@@ -1,9 +1,3 @@
 .libs
 client-test
 *.lo
-test-patch*
-test-wc*
-test-copy-crash
-test-youngest-common-ancestor
-foreign-copy1
-foreign-copy2

Modified: subversion/trunk/subversion/tests/libsvn_client/client-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_client/client-test.c?rev=1536700&r1=1536699&r2=1536700&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_client/client-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_client/client-test.c Tue Oct 29 13:07:49 2013
@@ -57,7 +57,8 @@ create_greek_repos(const char **repos_ur
   svn_fs_root_t *txn_root;
 
   /* Create a filesytem and repository. */
-  SVN_ERR(svn_test__create_repos(&repos, name, opts, pool));
+  SVN_ERR(svn_test__create_repos(
+              &repos, svn_test_data_path(name, pool), opts, pool));
 
   /* Prepare and commit a txn containing the Greek tree. */
   SVN_ERR(svn_fs_begin_txn2(&txn, svn_repos_fs(repos), 0 /* rev */,
@@ -67,7 +68,8 @@ create_greek_repos(const char **repos_ur
   SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &committed_rev, txn, pool));
   SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(committed_rev));
 
-  SVN_ERR(svn_uri_get_file_url_from_dirent(repos_url, name, pool));
+  SVN_ERR(svn_uri_get_file_url_from_dirent(
+              repos_url, svn_test_data_path(name, pool), pool));
   return SVN_NO_ERROR;
 }
 
@@ -331,7 +333,6 @@ test_patch(const svn_test_opts_t *opts,
 {
   const char *repos_url;
   const char *wc_path;
-  const char *cwd;
   svn_opt_revision_t rev;
   svn_opt_revision_t peg_rev;
   svn_client_ctx_t *ctx;
@@ -370,12 +371,11 @@ test_patch(const svn_test_opts_t *opts,
   SVN_ERR(create_greek_repos(&repos_url, "test-patch-repos", opts, pool));
 
   /* Check out the HEAD revision */
-  SVN_ERR(svn_dirent_get_absolute(&cwd, "", pool));
 
   /* Put wc inside an unversioned directory.  Checking out a 1.7 wc
      directly inside a 1.6 wc doesn't work reliably, an intervening
      unversioned directory prevents the problems. */
-  wc_path = svn_dirent_join(cwd, "test-patch", pool);
+  wc_path = svn_test_data_path("test-patch", pool);
   SVN_ERR(svn_io_make_dir_recursively(wc_path, pool));
   svn_test_add_dir_cleanup(wc_path);
 
@@ -389,9 +389,9 @@ test_patch(const svn_test_opts_t *opts,
                                TRUE, FALSE, ctx, pool));
 
   /* Create the patch file. */
-  patch_file_path = svn_dirent_join_many(pool, cwd,
-                                         "test-patch", "test-patch.diff",
-                                         SVN_VA_NULL);
+  patch_file_path = svn_dirent_join_many(
+      pool, svn_test_data_path("test-patch", pool),
+      "test-patch.diff", SVN_VA_NULL);
   SVN_ERR(svn_io_file_open(&patch_file, patch_file_path,
                            (APR_READ | APR_WRITE | APR_CREATE | APR_TRUNCATE),
                            APR_OS_DEFAULT, pool));
@@ -446,7 +446,7 @@ test_wc_add_scenarios(const svn_test_opt
   SVN_ERR(create_greek_repos(&repos_url, "test-wc-add-repos", opts, pool));
   committed_rev = 1;
 
-  SVN_ERR(svn_dirent_get_absolute(&wc_path, "test-wc-add", pool));
+  wc_path = svn_test_data_path("test-wc-add", pool);
 
   /* Remove old test data from the previous run */
   SVN_ERR(svn_io_remove_dir2(wc_path, TRUE, NULL, NULL, pool));
@@ -599,7 +599,7 @@ test_16k_add(const svn_test_opts_t *opts
   svn_opt_revision_t rev;
   svn_client_ctx_t *ctx;
   const char *repos_url;
-  const char *cwd, *wc_path;
+  const char *wc_path;
   svn_opt_revision_t peg_rev;
   apr_array_header_t *targets;
   apr_pool_t *iterpool = svn_pool_create(pool);
@@ -609,12 +609,11 @@ test_16k_add(const svn_test_opts_t *opts
   SVN_ERR(create_greek_repos(&repos_url, "test-16k-repos", opts, pool));
 
   /* Check out the HEAD revision */
-  SVN_ERR(svn_dirent_get_absolute(&cwd, "", pool));
 
   /* Put wc inside an unversioned directory.  Checking out a 1.7 wc
      directly inside a 1.6 wc doesn't work reliably, an intervening
      unversioned directory prevents the problems. */
-  wc_path = svn_dirent_join(cwd, "test-16k", pool);
+  wc_path = svn_test_data_path("test-16k", pool);
   SVN_ERR(svn_io_make_dir_recursively(wc_path, pool));
   svn_test_add_dir_cleanup(wc_path);
 
@@ -736,7 +735,7 @@ test_foreign_repos_copy(const svn_test_o
   SVN_ERR(create_greek_repos(&repos_url, "foreign-copy1", opts, pool));
   SVN_ERR(create_greek_repos(&repos2_url, "foreign-copy2", opts, pool));
 
-  SVN_ERR(svn_dirent_get_absolute(&wc_path, "test-wc-add", pool));
+  wc_path = svn_test_data_path("test-wc-add", pool);
 
   wc_path = svn_dirent_join(wc_path, "foreign-wc", pool);
 

Modified: subversion/trunk/subversion/tests/libsvn_delta/random-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_delta/random-test.c?rev=1536700&r1=1536699&r2=1536700&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_delta/random-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_delta/random-test.c Tue Oct 29 13:07:49 2013
@@ -109,12 +109,9 @@ open_tempfile(const char *name_template,
 {
   apr_status_t apr_err;
   apr_file_t *fp = NULL;
-  char *templ;
-
-  if (!name_template)
-    templ = apr_pstrdup(pool, "tempfile_XXXXXX");
-  else
-    templ = apr_pstrdup(pool, name_template);
+  char *templ = (char *)apr_pstrdup(
+      pool, svn_test_data_path(
+          name_template ? name_template : "tempfile_XXXXXX", pool));
 
   apr_err = apr_file_mktemp(&fp, templ, 0, pool);
   assert(apr_err == 0);

Propchange: subversion/trunk/subversion/tests/libsvn_diff/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Oct 29 13:07:49 2013
@@ -8,9 +8,3 @@ parse-diff-test
 *~
 .*~
 *.exe
-B*
-T*
-combined
-modified1
-modified2
-original

Modified: subversion/trunk/subversion/tests/libsvn_diff/diff-diff3-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_diff/diff-diff3-test.c?rev=1536700&r1=1536699&r2=1536700&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_diff/diff-diff3-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_diff/diff-diff3-test.c Tue Oct 29 13:07:49 2013
@@ -137,9 +137,9 @@ make_file(const char *filename,
    "merge-FILENAME1-FILENAME2-FILENAME3".  The conflict style STYLE is
    used. */
 static svn_error_t *
-three_way_merge(const char *filename1,
-                const char *filename2,
-                const char *filename3,
+three_way_merge(const char *base_filename1,
+                const char *base_filename2,
+                const char *base_filename3,
                 const char *contents1,
                 const char *contents2,
                 const char *contents3,
@@ -152,8 +152,12 @@ three_way_merge(const char *filename1,
   apr_file_t *output;
   svn_stream_t *ostream;
   svn_stringbuf_t *actual;
-  char *merge_name = apr_psprintf(pool, "merge-%s-%s-%s",
-                                  filename1, filename2, filename3);
+  char *merge_name = apr_psprintf(
+      pool, "merge-%s-%s-%s", base_filename1, base_filename2, base_filename3);
+
+  const char *filename1 = svn_test_data_path(base_filename1, pool);
+  const char *filename2 = svn_test_data_path(base_filename2, pool);
+  const char *filename3 = svn_test_data_path(base_filename3, pool);
 
   /* We have an EXPECTED string we can match, because we don't support
      any other combinations (yet) than the ones above. */
@@ -171,9 +175,9 @@ three_way_merge(const char *filename1,
 
   SVN_ERR(svn_diff_mem_string_output_merge2
           (ostream, diff, original, modified, latest,
-           apr_psprintf(pool, "||||||| %s", filename1),
-           apr_psprintf(pool, "<<<<<<< %s", filename2),
-           apr_psprintf(pool, ">>>>>>> %s", filename3),
+           apr_psprintf(pool, "||||||| %s", base_filename1),
+           apr_psprintf(pool, "<<<<<<< %s", base_filename2),
+           apr_psprintf(pool, ">>>>>>> %s", base_filename3),
            NULL, /* separator */
            style, pool));
 
@@ -195,17 +199,20 @@ three_way_merge(const char *filename1,
                            APR_OS_DEFAULT, pool));
 
   ostream = svn_stream_from_aprfile2(output, FALSE, pool);
-  SVN_ERR(svn_diff_file_output_merge2(ostream, diff,
-                                      filename1, filename2, filename3,
-                                      NULL, NULL, NULL, NULL,
-                                      style,
-                                      pool));
+  SVN_ERR(svn_diff_file_output_merge2(
+              ostream, diff,
+              filename1, filename2, filename3,
+              apr_psprintf(pool, "||||||| %s", base_filename1),
+              apr_psprintf(pool, "<<<<<<< %s", base_filename2),
+              apr_psprintf(pool, ">>>>>>> %s", base_filename3),
+              NULL, /* separator */
+              style, pool));
   SVN_ERR(svn_stream_close(ostream));
   SVN_ERR(svn_stringbuf_from_file2(&actual, merge_name, pool));
   if (strcmp(actual->data, expected))
     return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
                              "failed merging diff '%s' to '%s' into '%s'",
-                             filename1, filename2, filename3);
+                             base_filename1, base_filename2, base_filename3);
 
   SVN_ERR(svn_io_remove_file2(filename1, TRUE, pool));
   if (strcmp(filename1, filename2))
@@ -227,8 +234,8 @@ three_way_merge(const char *filename1,
    preserved otherwise.  If the diff fails the diff output will be in
    a file called "diff-FILENAME1-FILENAME2".  */
 static svn_error_t *
-two_way_diff(const char *filename1,
-             const char *filename2,
+two_way_diff(const char *base_filename1,
+             const char *base_filename2,
              const char *contents1,
              const char *contents2,
              const char *expected,
@@ -239,7 +246,13 @@ two_way_diff(const char *filename1,
   apr_file_t *output;
   svn_stream_t *ostream;
   svn_stringbuf_t *actual;
-  char *diff_name = apr_psprintf(pool, "diff-%s-%s", filename1, filename2);
+  char *diff_name = (char *)apr_pstrdup(
+      pool, svn_test_data_path(
+          apr_psprintf(pool, "diff-%s-%s", base_filename1, base_filename2),
+          pool));
+
+  const char *filename1 = svn_test_data_path(base_filename1, pool);
+  const char *filename2 = svn_test_data_path(base_filename2, pool);
 
   /* Some of the tests have lots of lines, although not much data as
      the lines are short, and the in-memory diffs allocate a lot of
@@ -261,7 +274,7 @@ two_way_diff(const char *filename1,
   ostream = svn_stream_from_stringbuf(actual, pool);
 
   SVN_ERR(svn_diff_mem_string_output_unified(ostream, diff,
-                                             filename1, filename2,
+                                             base_filename1, base_filename2,
                                              SVN_APR_LOCALE_CHARSET,
                                              original, modified, subpool));
   svn_pool_clear(subpool);
@@ -286,7 +299,7 @@ two_way_diff(const char *filename1,
   ostream = svn_stream_from_aprfile2(output, FALSE, pool);
   SVN_ERR(svn_diff_file_output_unified2(ostream, diff,
                                         filename1, filename2,
-                                        filename1, filename2,
+                                        base_filename1, base_filename2,
                                         SVN_APR_LOCALE_CHARSET, pool));
   SVN_ERR(svn_stream_close(ostream));
 
@@ -312,16 +325,16 @@ two_way_diff(const char *filename1,
       return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
                                "failed comparing '%s' and '%s'"
                                " (memory and file results are different)",
-                               filename1, filename2);
+                               base_filename1, base_filename2);
     }
 
   /* May as well do the trivial merges while we are here */
-  SVN_ERR(three_way_merge(filename1, filename2, filename1,
+  SVN_ERR(three_way_merge(base_filename1, base_filename2, base_filename1,
                           contents1, contents2, contents1, contents2, NULL,
                           svn_diff_conflict_display_modified_latest,
                           subpool));
   svn_pool_clear(subpool);
-  SVN_ERR(three_way_merge(filename2, filename1, filename2,
+  SVN_ERR(three_way_merge(base_filename2, base_filename1, base_filename2,
                           contents2, contents1, contents2, contents1, NULL,
                           svn_diff_conflict_display_modified_latest,
                           subpool));
@@ -2141,14 +2154,20 @@ test_diff4(apr_pool_t *pool)
     "  /* line plus-four of context */\n"
     "  /* line plus-five of context */\n"
     "}\n");
-  SVN_ERR(make_file("B2", B2.data, pool));
-  SVN_ERR(make_file("T1", T1.data, pool));
-  SVN_ERR(make_file("T2", T2.data, pool));
-  SVN_ERR(make_file("T3", T3.data, pool));
+
+  const char *B2_path = svn_test_data_path("B2", pool);
+  const char *T1_path = svn_test_data_path("T1", pool);
+  const char *T2_path = svn_test_data_path("T2", pool);
+  const char *T3_path = svn_test_data_path("T3", pool);
+
+  SVN_ERR(make_file(B2_path, B2.data, pool));
+  SVN_ERR(make_file(T1_path, T1.data, pool));
+  SVN_ERR(make_file(T2_path, T2.data, pool));
+  SVN_ERR(make_file(T3_path, T3.data, pool));
 
   /* Usage: tools/diff/diff4 <mine> <older> <yours> <ancestor> */
   /* tools/diff/diff4 B2 T2 T3 T1 > B2new */
-  SVN_ERR(svn_diff_file_diff4(&diff, "T2", "B2", "T3", "T1", pool));
+  SVN_ERR(svn_diff_file_diff4(&diff, T2_path, B2_path, T3_path, T1_path, pool));
 
   /* Sanity. */
   SVN_TEST_ASSERT(! svn_diff_contains_conflicts(diff));
@@ -2161,7 +2180,7 @@ test_diff4(apr_pool_t *pool)
              svn_stringbuf_create_ensure(417, pool), /* 417 == wc -c < B2new */
              pool);
   SVN_ERR(svn_diff_file_output_merge(actual, diff,
-                                     "T2", "B2", "T3",
+                                     T2_path, B2_path, T3_path,
                                      NULL, NULL, NULL, NULL,
                                      FALSE,
                                      FALSE,
@@ -2179,12 +2198,16 @@ random_trivial_merge(apr_pool_t *pool)
   int i;
   apr_pool_t *subpool = svn_pool_create(pool);
 
+  const char *base_filename1 = "trivial1";
+  const char *base_filename2 = "trivial2";
+
+  const char *filename1 = svn_test_data_path(base_filename1, pool);
+  const char *filename2 = svn_test_data_path(base_filename2, pool);
+
   seed_val();
 
   for (i = 0; i < 5; ++i)
     {
-      const char *filename1 = "trivial1";
-      const char *filename2 = "trivial2";
       int min_lines = 1000;
       int max_lines = 1100;
       int var_lines = 50;
@@ -2201,12 +2224,12 @@ random_trivial_merge(apr_pool_t *pool)
       SVN_ERR(svn_stringbuf_from_file2(&contents1, filename1, subpool));
       SVN_ERR(svn_stringbuf_from_file2(&contents2, filename2, subpool));
 
-      SVN_ERR(three_way_merge(filename1, filename2, filename1,
+      SVN_ERR(three_way_merge(base_filename1, base_filename2, base_filename1,
                               contents1->data, contents2->data,
                               contents1->data, contents2->data, NULL,
                               svn_diff_conflict_display_modified_latest,
                               subpool));
-      SVN_ERR(three_way_merge(filename2, filename1, filename2,
+      SVN_ERR(three_way_merge(base_filename2, base_filename1, base_filename2,
                               contents2->data, contents1->data,
                               contents2->data, contents1->data, NULL,
                               svn_diff_conflict_display_modified_latest,
@@ -2231,14 +2254,20 @@ random_three_way_merge(apr_pool_t *pool)
   int i;
   apr_pool_t *subpool = svn_pool_create(pool);
 
+  const char *base_filename1 = "original";
+  const char *base_filename2 = "modified1";
+  const char *base_filename3 = "modified2";
+  const char *base_filename4 = "combined";
+
+  const char *filename1 = svn_test_data_path(base_filename1, pool);
+  const char *filename2 = svn_test_data_path(base_filename2, pool);
+  const char *filename3 = svn_test_data_path(base_filename3, pool);
+  const char *filename4 = svn_test_data_path(base_filename4, pool);
+
   seed_val();
 
   for (i = 0; i < 20; ++i)
     {
-      const char *filename1 = "original";
-      const char *filename2 = "modified1";
-      const char *filename3 = "modified2";
-      const char *filename4 = "combined";
       svn_stringbuf_t *original, *modified1, *modified2, *combined;
       /* Pick NUM_LINES large enough so that the 'strip identical suffix' code
          gets triggered with reasonable probability.  (Currently it ignores
@@ -2272,12 +2301,12 @@ random_three_way_merge(apr_pool_t *pool)
       SVN_ERR(svn_stringbuf_from_file2(&modified2, filename3, pool));
       SVN_ERR(svn_stringbuf_from_file2(&combined, filename4, pool));
 
-      SVN_ERR(three_way_merge(filename1, filename2, filename3,
+      SVN_ERR(three_way_merge(base_filename1, base_filename2, base_filename3,
                               original->data, modified1->data,
                               modified2->data, combined->data, NULL,
                               svn_diff_conflict_display_modified_latest,
                               subpool));
-      SVN_ERR(three_way_merge(filename1, filename3, filename2,
+      SVN_ERR(three_way_merge(base_filename1, base_filename3, base_filename2,
                               original->data, modified2->data,
                               modified1->data, combined->data, NULL,
                               svn_diff_conflict_display_modified_latest,
@@ -2303,14 +2332,20 @@ merge_with_part_already_present(apr_pool
   int i;
   apr_pool_t *subpool = svn_pool_create(pool);
 
+  const char *base_filename1 = "pap-original";
+  const char *base_filename2 = "pap-modified1";
+  const char *base_filename3 = "pap-modified2";
+  const char *base_filename4 = "pap-combined";
+
+  const char *filename1 = svn_test_data_path(base_filename1, pool);
+  const char *filename2 = svn_test_data_path(base_filename2, pool);
+  const char *filename3 = svn_test_data_path(base_filename3, pool);
+  const char *filename4 = svn_test_data_path(base_filename4, pool);
+
   seed_val();
 
   for (i = 0; i < 20; ++i)
     {
-      const char *filename1 = "pap-original";
-      const char *filename2 = "pap-modified1";
-      const char *filename3 = "pap-modified2";
-      const char *filename4 = "pap-combined";
       svn_stringbuf_t *original, *modified1, *modified2, *combined;
       int num_lines = 200, num_src = 20, num_dst = 20;
       svn_boolean_t *lines = apr_pcalloc(subpool, sizeof(*lines) * num_lines);
@@ -2345,12 +2380,12 @@ merge_with_part_already_present(apr_pool
       SVN_ERR(svn_stringbuf_from_file2(&modified2, filename3, pool));
       SVN_ERR(svn_stringbuf_from_file2(&combined, filename4, pool));
 
-      SVN_ERR(three_way_merge(filename1, filename2, filename3,
+      SVN_ERR(three_way_merge(base_filename1, base_filename2, base_filename3,
                               original->data, modified1->data,
                               modified2->data, combined->data, NULL,
                               svn_diff_conflict_display_modified_latest,
                               subpool));
-      SVN_ERR(three_way_merge(filename1, filename3, filename2,
+      SVN_ERR(three_way_merge(base_filename1, base_filename3, base_filename2,
                               original->data, modified2->data,
                               modified1->data, combined->data, NULL,
                               svn_diff_conflict_display_modified_latest,

Modified: subversion/trunk/subversion/tests/svn_test.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/svn_test.h?rev=1536700&r1=1536699&r2=1536700&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/svn_test.h (original)
+++ subversion/trunk/subversion/tests/svn_test.h Tue Oct 29 13:07:49 2013
@@ -222,6 +222,12 @@ svn_test__tree_t;
 extern const svn_test__tree_entry_t svn_test__greek_tree_nodes[21];
 
 
+/* Returns a path to BASENAME within the transient data area for the
+   current test. */
+const char *
+svn_test_data_path(const char* basename, apr_pool_t *result_pool);
+
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/trunk/subversion/tests/svn_test_main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/svn_test_main.c?rev=1536700&r1=1536699&r2=1536700&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/svn_test_main.c (original)
+++ subversion/trunk/subversion/tests/svn_test_main.c Tue Oct 29 13:07:49 2013
@@ -44,6 +44,7 @@
 #include "svn_io.h"
 #include "svn_path.h"
 #include "svn_ctype.h"
+#include "svn_utf.h"
 
 #include "private/svn_cmdline_private.h"
 
@@ -54,6 +55,10 @@
 int test_argc;
 const char **test_argv;
 
+/* Many tests write to disk. Instead of writing to the current
+   directory, they should use this path as the root of the test data
+   area. */
+static const char *data_path;
 
 /* Test option: Print more output */
 static svn_boolean_t verbose_mode = FALSE;
@@ -365,6 +370,51 @@ static void help(const char *progname, a
   svn_error_clear(svn_cmdline_fprintf(stdout, pool, "\n"));
 }
 
+static svn_error_t *init_test_data(const char *argv0, apr_pool_t *pool)
+{
+  const char *temp_path;
+  const char *base_name;
+
+  /* Convert the program path to an absolute path. */
+  SVN_ERR(svn_utf_cstring_to_utf8(&temp_path, argv0, pool));
+  temp_path = svn_dirent_internal_style(temp_path, pool);
+  SVN_ERR(svn_dirent_get_absolute(&temp_path, temp_path, pool));
+  SVN_ERR_ASSERT(!svn_dirent_is_root(temp_path, strlen(temp_path)));
+
+  /* Extract the interesting bits of the path. */
+  temp_path = svn_dirent_dirname(temp_path, pool);
+  base_name = svn_dirent_basename(temp_path, pool);
+  if (0 == strcmp(base_name, ".libs"))
+    {
+      /* This is a libtoolized binary, skip the .libs directory. */
+      temp_path = svn_dirent_dirname(temp_path, pool);
+      base_name = svn_dirent_basename(temp_path, pool);
+    }
+  temp_path = svn_dirent_dirname(temp_path, pool);
+
+  /* temp_path should now point to the root of the test
+     builddir. Construct the path to the transient dir.  Note that we
+     put the path insinde the cmdline/svn-test-work area. This is
+     becasue trying to get the cmdline tests to use a different work
+     area is unprintable; so we put the C test transient dir in the
+     cmdline tests area, as the lesser of evils ... */
+  temp_path = svn_dirent_join_many(pool, temp_path,
+                                   "cmdline", "svn-test-work",
+                                   base_name, SVN_VA_NULL);
+
+  /* Finally, create the transient directory. */
+  SVN_ERR(svn_io_make_dir_recursively(temp_path, pool));
+
+  data_path = temp_path;
+  return SVN_NO_ERROR;
+}
+
+const char *
+svn_test_data_path(const char *basename, apr_pool_t *result_pool)
+{
+  return svn_dirent_join(data_path, basename, result_pool);
+}
+
 
 /* Standard svn test program */
 int
@@ -404,7 +454,20 @@ main(int argc, const char *argv[])
   test_argc = argc;
   test_argv = argv;
 
+  err = init_test_data(argv[0], pool);
+  if (err)
+    {
+      svn_handle_error2(err, stderr, TRUE, "svn_tests: ");
+      svn_error_clear(err);
+    }
+
   err = svn_cmdline__getopt_init(&os, argc, argv, pool);
+  if (err)
+    {
+      svn_handle_error2(err, stderr, TRUE, "svn_tests: ");
+      svn_error_clear(err);
+    }
+
 
   os->interleave = TRUE; /* Let options and arguments be interleaved */
 



Re: svn commit: r1536700 - in /subversion/trunk/subversion/tests: libsvn_client/ libsvn_client/client-test.c libsvn_delta/random-test.c libsvn_diff/ libsvn_diff/diff-diff3-test.c svn_test.h svn_test_main.c

Posted by Branko Čibej <br...@wandisco.com>.
On 29.10.2013 14:19, C. Michael Pilato wrote:
> On 10/29/2013 09:07 AM, brane@apache.org wrote:
>> Author: brane
>> Date: Tue Oct 29 13:07:49 2013
>> New Revision: 1536700
>>
>> URL: http://svn.apache.org/r1536700
>> Log:
>> Begin converting C tests to use the same transient directory as the Python
>> tests, so that both can be run off a RAM disk.
> Great move, Brane!

I'm glad you approve. I only hope I didn't bork the Windows tests with
this change.


-- 
Branko Čibej | Director of Subversion
WANdisco // Non-Stop Data
e. brane@wandisco.com

Re: svn commit: r1536700 - in /subversion/trunk/subversion/tests: libsvn_client/ libsvn_client/client-test.c libsvn_delta/random-test.c libsvn_diff/ libsvn_diff/diff-diff3-test.c svn_test.h svn_test_main.c

Posted by "C. Michael Pilato" <cm...@collab.net>.
On 10/29/2013 09:07 AM, brane@apache.org wrote:
> Author: brane
> Date: Tue Oct 29 13:07:49 2013
> New Revision: 1536700
> 
> URL: http://svn.apache.org/r1536700
> Log:
> Begin converting C tests to use the same transient directory as the Python
> tests, so that both can be run off a RAM disk.

Great move, Brane!

Re: svn commit: r1536700 - in /subversion/trunk/subversion/tests: libsvn_client/ libsvn_client/client-test.c libsvn_delta/random-test.c libsvn_diff/ libsvn_diff/diff-diff3-test.c svn_test.h svn_test_main.c

Posted by "C. Michael Pilato" <cm...@collab.net>.
On 10/29/2013 09:07 AM, brane@apache.org wrote:
> Author: brane
> Date: Tue Oct 29 13:07:49 2013
> New Revision: 1536700
> 
> URL: http://svn.apache.org/r1536700
> Log:
> Begin converting C tests to use the same transient directory as the Python
> tests, so that both can be run off a RAM disk.

Great move, Brane!

Re: svn commit: r1536700 - in /subversion/trunk/subversion/tests: libsvn_client/ libsvn_client/client-test.c libsvn_delta/random-test.c libsvn_diff/ libsvn_diff/diff-diff3-test.c svn_test.h svn_test_main.c

Posted by Ben Reser <be...@reser.org>.
On 10/29/13 6:07 AM, brane@apache.org wrote:
> Author: brane
> Date: Tue Oct 29 13:07:49 2013
> New Revision: 1536700
> 
> URL: http://svn.apache.org/r1536700
> Log:
> Begin converting C tests to use the same transient directory as the Python
> tests, so that both can be run off a RAM disk.

I gave this a spin (with a r1536831 checkout).  Some results of `make check
PARALLEL=1`:

Ubuntu 12.04 on a VM (disk I/O is slow):
subversion/tests on RAM disk: 8:22.25 (m:ss)
subversion/tests/cmdline/svn-test-work on RAM disk: 12:05.16 (m:ss)
subversion/tests/cmdline/svn-test-work on RAM disk (without r1536700): 12:03.78
(m:ss)

OS X 10.7.5 (SSD, disk I/O is fast):
subversion/tests on RAM disk:  9:47.735(m:ss)
subversion/tests/cmdline/svn-test-work on RAM disk:  9:52.231 (m:ss)
subversion/tests/cmdline/svn-test-work on RAM disk (without r1536700): 10:6.924
(m:ss)

So it appears to nominally help.  But mounting all of subversion/tests still is
much better for me on my VM with slow I/O.  As in the past mounting all of
subversion/tests on OS X isn't worth the added hassle that it entails.

The extra time on the VM run is probably just a fluke.  I was only running this
to see if I could ditch the subversion/tests mount on my VM.