subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1656778 - in /subversion/trunk: build/run_tests.py subversion/tests/svn_test.h subversion/tests/svn_test_main.c
Date Tue, 03 Feb 2015 16:23:19 GMT
Author: rhuijben
Date: Tue Feb  3 16:23:19 2015
New Revision: 1656778

URL: http://svn.apache.org/r1656778
Log:
Optionally provide information about the ra layer we are testing to the C
tests. This will (after a few followup patches) allow running several
C tests against svn:// and http://.

* build/run_tests.py
  (_run_c_test): Pass more information.

* subversion/tests/svn_test.h
  (svn_test_opts_t): Add a few more fields.

* subversion/tests/svn_test_main.c
  (test_options_e): Handle three arguments.
  (cl_options): Document new arguments.
  (svn_test_main): Store prog_name. Parse new arguments.

Modified:
    subversion/trunk/build/run_tests.py
    subversion/trunk/subversion/tests/svn_test.h
    subversion/trunk/subversion/tests/svn_test_main.c

Modified: subversion/trunk/build/run_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/build/run_tests.py?rev=1656778&r1=1656777&r2=1656778&view=diff
==============================================================================
--- subversion/trunk/build/run_tests.py (original)
+++ subversion/trunk/build/run_tests.py Tue Feb  3 16:23:19 2015
@@ -385,6 +385,22 @@ class TestHarness:
     if self.config_file is not None:
       cmdline.append('--config-file=' + self.config_file)
 
+    if self.base_url is not None:
+      subdir = 'subversion/tests/cmdline/svn-test-work'
+
+      cmdline.append('--repos-url=%s' % self.base_url +
+                        '/svn-test-work/repositories')
+      cmdline.append('--repos-dir=%s'
+                     % os.path.abspath(
+                         os.path.join(self.builddir, subdir, 'repositories')))
+
+      # Enable access for http
+      if self.base_url.startswith('http'):
+        open(os.path.join(self.builddir, 'authz'), 'w').write(
+                '[/]\n' +
+                '* = rw\n')
+
+    # ### Support --repos-template
     if self.verbose is not None:
       cmdline.append('--verbose')
     if self.cleanup is not None:

Modified: subversion/trunk/subversion/tests/svn_test.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/svn_test.h?rev=1656778&r1=1656777&r2=1656778&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/svn_test.h (original)
+++ subversion/trunk/subversion/tests/svn_test.h Tue Feb  3 16:23:19 2015
@@ -117,12 +117,20 @@ extern "C" {
  */
 typedef struct svn_test_opts_t
 {
+  /* The name of the application (to generate unique names) */
+  const char *prog_name;
   /* Description of the fs backend that should be used for testing. */
   const char *fs_type;
   /* Config file. */
   const char *config_file;
   /* Source dir. */
   const char *srcdir;
+  /* Repository dir: temporary directory to create repositories in as subdir */
+  const char *repos_dir;
+  /* Repository url: The url to access REPOS_DIR as */
+  const char *repos_url;
+  /* Repository template: pre-created repository to copy for tests */
+  const char *repos_template;
   /* Minor version to use for servers and FS backends, or zero to use
      the current latest version. */
   int server_minor_version;

Modified: subversion/trunk/subversion/tests/svn_test_main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/svn_test_main.c?rev=1656778&r1=1656777&r2=1656778&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/svn_test_main.c (original)
+++ subversion/trunk/subversion/tests/svn_test_main.c Tue Feb  3 16:23:19 2015
@@ -101,6 +101,9 @@ enum test_options_e {
   server_minor_version_opt,
   allow_segfault_opt,
   srcdir_opt,
+  reposdir_opt,
+  reposurl_opt,
+  repostemplate_opt,
   mode_filter_opt,
   sqlite_log_opt,
   parallel_opt,
@@ -135,6 +138,12 @@ static const apr_getopt_option_t cl_opti
                     N_("don't trap seg faults (useful for debugging)")},
   {"srcdir",        srcdir_opt, 1,
                     N_("directory which contains test's C source files")},
+  {"repos-dir",     reposdir_opt, 1,
+                    N_("directory to create repositories in")},
+  {"repos-url",     reposurl_opt, 1,
+                    N_("the url to access reposdir as")},
+  {"repos-template",repostemplate_opt, 1,
+                    N_("the repository to use as template")},
   {"sqlite-logging", sqlite_log_opt, 0,
                     N_("enable SQLite logging")},
   {"parallel",      parallel_opt, 0,
@@ -687,7 +696,6 @@ int
 svn_test_main(int argc, const char *argv[], int max_threads,
               struct svn_test_descriptor_t *test_funcs)
 {
-  const char *prog_name;
   int i;
   svn_boolean_t got_error = FALSE;
   apr_pool_t *pool, *test_pool;
@@ -745,19 +753,8 @@ svn_test_main(int argc, const char *argv
   os->interleave = TRUE; /* Let options and arguments be interleaved */
 
   /* Strip off any leading path components from the program name.  */
-  prog_name = strrchr(argv[0], '/');
-  if (prog_name)
-    prog_name++;
-  else
-    {
-      /* Just check if this is that weird platform that uses \ instead
-         of / for the path separator. */
-      prog_name = strrchr(argv[0], '\\');
-      if (prog_name)
-        prog_name++;
-      else
-        prog_name = argv[0];
-    }
+  opts.prog_name = svn_dirent_internal_style(argv[0], pool);
+  opts.prog_name = svn_dirent_basename(opts.prog_name, NULL);
 
 #ifdef WIN32
 #if _MSC_VER >= 1400
@@ -781,7 +778,7 @@ svn_test_main(int argc, const char *argv
 #endif
 
   if (err)
-    return svn_cmdline_handle_exit_error(err, pool, prog_name);
+    return svn_cmdline_handle_exit_error(err, pool, opts.prog_name);
   while (1)
     {
       const char *opt_arg;
@@ -800,7 +797,7 @@ svn_test_main(int argc, const char *argv
 
       switch (opt_id) {
         case help_opt:
-          help(prog_name, pool);
+          help(opts.prog_name, pool);
           exit(0);
         case cleanup_opt:
           cleanup_mode = TRUE;
@@ -815,6 +812,20 @@ svn_test_main(int argc, const char *argv
           SVN_INT_ERR(svn_utf_cstring_to_utf8(&opts.srcdir, opt_arg, pool));
           opts.srcdir = svn_dirent_internal_style(opts.srcdir, pool);
           break;
+        case reposdir_opt:
+          SVN_INT_ERR(svn_utf_cstring_to_utf8(&opts.repos_dir, opt_arg, pool));
+          opts.repos_dir = svn_dirent_internal_style(opts.repos_dir, pool);
+          break;
+        case reposurl_opt:
+          SVN_INT_ERR(svn_utf_cstring_to_utf8(&opts.repos_url, opt_arg, pool));
+          opts.repos_url = svn_uri_canonicalize(opts.repos_url, pool);
+          break;
+        case repostemplate_opt:
+          SVN_INT_ERR(svn_utf_cstring_to_utf8(&opts.repos_template, opt_arg,
+                                              pool));
+          opts.repos_template = svn_dirent_internal_style(opts.repos_template,
+                                                          pool);
+          break;
         case list_opt:
           list_mode = TRUE;
           break;
@@ -903,7 +914,7 @@ svn_test_main(int argc, const char *argv
                        "------  -----  ----------------\n";
           for (i = 1; i <= array_size; i++)
             {
-              if (do_test_num(prog_name, i, test_funcs,
+              if (do_test_num(opts.prog_name, i, test_funcs,
                               TRUE, &opts, &header_msg, test_pool))
                 got_error = TRUE;
 
@@ -924,7 +935,7 @@ svn_test_main(int argc, const char *argv
                     continue;
 
                   ran_a_test = TRUE;
-                  if (do_test_num(prog_name, test_num, test_funcs,
+                  if (do_test_num(opts.prog_name, test_num, test_funcs,
                                   FALSE, &opts, NULL, test_pool))
                     got_error = TRUE;
 
@@ -946,7 +957,7 @@ svn_test_main(int argc, const char *argv
         {
           for (i = 1; i <= array_size; i++)
             {
-              if (do_test_num(prog_name, i, test_funcs,
+              if (do_test_num(opts.prog_name, i, test_funcs,
                               FALSE, &opts, NULL, test_pool))
                 got_error = TRUE;
 
@@ -958,7 +969,7 @@ svn_test_main(int argc, const char *argv
 #if APR_HAS_THREADS
       else
         {
-          got_error = do_tests_concurrently(prog_name, test_funcs,
+          got_error = do_tests_concurrently(opts.prog_name, test_funcs,
                                             array_size, max_threads,
                                             &opts, test_pool);
 



Mime
View raw message