Author: julianfoad
Date: Wed Feb  9 13:28:39 2022
New Revision: 1897906

URL: http://svn.apache.org/viewvc?rev=1897906&view=rev
Log:
On the 'multi-wc-format' branch: test suite now takes '--wc-format-version'.

This patch changes the test suite option from '--wc-format' accepting a WC
format number (such as 31), to a'--wc-format-version' accepting a version
string like '1.14.0'.

* subversion/include/private/svn_wc_private.h,
  subversion/libsvn_wc/upgrade.c
  (svn_wc__is_supported_format_version,
   svn_wc__max_supported_format_version,
   svn_wc__min_supported_format_version): New functions.

* build/run_tests.py
  (TestHarness): Update accordingly.

* Makefile.in
  (check): Update accordingly.

* subversion/tests/cmdline/svntest/main.py
  (SVN_WC__VERSION, SVN_WC__SUPPORTED_VERSION): Delete.
  (svn_wc__is_supported_format_version,
   svn_wc__max_supported_format_version,
   svn_wc__min_supported_format_version): New functions.
  (TestSpawningThread.run_one,
   _create_parser,
   parse_options): Update accordingly.

* subversion/tests/svn_test.h,
  subversion/tests/svn_test_main.c
  (svn_test_opts_t,
   test_options_e,
   apr_getopt_option_t,
   svn_test_main): Update accordingly.

Modified:
    subversion/branches/multi-wc-format/Makefile.in
    subversion/branches/multi-wc-format/build/run_tests.py
    
subversion/branches/multi-wc-format/subversion/include/private/svn_wc_private.h
    subversion/branches/multi-wc-format/subversion/libsvn_wc/upgrade.c
    subversion/branches/multi-wc-format/subversion/tests/cmdline/svntest/main.py
    subversion/branches/multi-wc-format/subversion/tests/svn_test.h
    subversion/branches/multi-wc-format/subversion/tests/svn_test_main.c

Modified: subversion/branches/multi-wc-format/Makefile.in
URL: 
http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/Makefile.in?rev=1897906&r1=1897905&r2=1897906&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/Makefile.in (original)
+++ subversion/branches/multi-wc-format/Makefile.in Wed Feb  9 13:28:39 2022
@@ -576,8 +576,8 @@ check: bin @TRANSFORM_LIBTOOL_SCRIPTS@ $
          if test "$(SERVER_MINOR_VERSION)" != ""; then                      \
            flags="--server-minor-version $(SERVER_MINOR_VERSION) $$flags";  \
          fi;                                                                \
-         if test "$(WC_FORMAT)" != ""; then                                 \
-           flags="--wc-format $(WC_FORMAT) $$flags";                        \
+         if test "$(WC_FORMAT_VERSION)" != ""; then                         \
+           flags="--wc-format-version $(WC_FORMAT_VERSION) $$flags";        \
          fi;                                                                \
          if test "$(ENABLE_SASL)" != ""; then                               \
            flags="--enable-sasl $$flags";                                   \

Modified: subversion/branches/multi-wc-format/build/run_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/build/run_tests.py?rev=1897906&r1=1897905&r2=1897906&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/build/run_tests.py (original)
+++ subversion/branches/multi-wc-format/build/run_tests.py Wed Feb  9 13:28:39 
2022
@@ -29,7 +29,7 @@
             [--url=<base-url>] [--http-library=<http-library>] [--enable-sasl]
             [--fs-type=<fs-type>] [--fsfs-packing] [--fsfs-sharding=<n>]
             [--list] [--milestone-filter=<regex>] [--mode-filter=<type>]
-            [--server-minor-version=<version>] [--wc-format=<format>]
+            [--server-minor-version=<version>] [--wc-format-version=<version>]
             [--http-proxy=<host>:<port>]
             [--httpd-version=<version>] [--httpd-whitelist=<version>]
             [--config-file=<file>] [--ssl-cert=<file>]
@@ -258,8 +258,8 @@ class TestHarness:
     if self.opts.server_minor_version is not None:
       cmdline.append('--server-minor-version=%d' %
                      self.opts.server_minor_version)
-    if self.opts.wc_format is not None:
-      cmdline.append('--wc-format=%d' % self.opts.wc_format)
+    if self.opts.wc_format_version is not None:
+      cmdline.append('--wc-format-version=%s' % self.opts.wc_format_version)
     if self.opts.mode_filter is not None:
       cmdline.append('--mode-filter=' + self.opts.mode_filter)
     if self.opts.parallel is not None:
@@ -295,8 +295,8 @@ class TestHarness:
       cmdline.append('--fsfs-version=%d' % self.opts.fsfs_version)
     if self.opts.server_minor_version is not None:
       cmdline.append('--server-minor-version=%d' % 
self.opts.server_minor_version)
-    if self.opts.wc_format is not None:
-      cmdline.append('--wc-format=%d' % self.opts.wc_format)
+    if self.opts.wc_format_version is not None:
+      cmdline.append('--wc-format-version=%s' % self.opts.wc_format_version)
     if self.opts.dump_load_cross_check is not None:
       cmdline.append('--dump-load-cross-check')
     if self.opts.enable_sasl is not None:
@@ -1040,8 +1040,8 @@ def create_parser():
                     help="Run 'svnadmin pack' automatically")
   parser.add_option('--server-minor-version', type='int', action='store',
                     help="Set the minor version for the server")
-  parser.add_option('--wc-format', type='int', action='store',
-                    help="Set the WC format")
+  parser.add_option('--wc-format-version', action='store',
+                    help="Set the WC format version")
   parser.add_option('--skip-c-tests', '--skip-C-tests', action='store_true',
                     help="Run only the Python tests")
   parser.add_option('--dump-load-cross-check', action='store_true',

Modified: 
subversion/branches/multi-wc-format/subversion/include/private/svn_wc_private.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/include/private/svn_wc_private.h?rev=1897906&r1=1897905&r2=1897906&view=diff
==============================================================================
--- 
subversion/branches/multi-wc-format/subversion/include/private/svn_wc_private.h 
(original)
+++ 
subversion/branches/multi-wc-format/subversion/include/private/svn_wc_private.h 
Wed Feb  9 13:28:39 2022
@@ -2211,6 +2211,24 @@ int
 svn_wc__min_supported_format(void);
 
 /**
+ * Return true iff @a version is a supported format version.
+ */
+svn_boolean_t
+svn_wc__is_supported_format_version(const svn_version_t *version);
+
+/**
+ * Return the highest WC format supported by this client.
+ */
+const svn_version_t *
+svn_wc__max_supported_format_version(void);
+
+/**
+ * Return the lowest WC format supported by this client.
+ */
+const svn_version_t *
+svn_wc__min_supported_format_version(void);
+
+/**
  * Set @a format to the format of the nearest parent working copy root of
  * @a local_abspath in @a wc_ctx, or to the oldest format of any root stored
  * there. If @a wc_ctx is empty, return the newset supported format.

Modified: subversion/branches/multi-wc-format/subversion/libsvn_wc/upgrade.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/libsvn_wc/upgrade.c?rev=1897906&r1=1897905&r2=1897906&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/libsvn_wc/upgrade.c 
(original)
+++ subversion/branches/multi-wc-format/subversion/libsvn_wc/upgrade.c Wed Feb  
9 13:28:39 2022
@@ -1698,6 +1698,31 @@ svn_wc__min_supported_format(void)
   return SVN_WC__SUPPORTED_VERSION;
 }
 
+svn_boolean_t
+svn_wc__is_supported_format_version(const svn_version_t *version)
+{
+  return (version->major == 1
+          && (version->minor >= 8 && version->minor <= 15));
+}
+
+const svn_version_t *
+svn_wc__max_supported_format_version(void)
+{
+  /* NOTE: For consistency, always return the version
+     that first introduced the latest supported format. */
+  static const svn_version_t version = { 1, 15, 0, NULL };
+  return &version;
+}
+
+const svn_version_t *
+svn_wc__min_supported_format_version(void)
+{
+  /* NOTE: For consistency, always return the version
+     that first introduced the earliest supported format. */
+  static const svn_version_t version = { 1, 8, 0, NULL };
+  return &version;
+}
+
 svn_error_t *
 svn_wc__upgrade_sdb(int *result_format,
                     const char *wcroot_abspath,

Modified: 
subversion/branches/multi-wc-format/subversion/tests/cmdline/svntest/main.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/tests/cmdline/svntest/main.py?rev=1897906&r1=1897905&r2=1897906&view=diff
==============================================================================
--- 
subversion/branches/multi-wc-format/subversion/tests/cmdline/svntest/main.py 
(original)
+++ 
subversion/branches/multi-wc-format/subversion/tests/cmdline/svntest/main.py 
Wed Feb  9 13:28:39 2022
@@ -58,8 +58,16 @@ from svntest import Skip
 from svntest.wc import StateItem as Item
 
 SVN_VER_MINOR = 15
-SVN_WC__VERSION = 32
-SVN_WC__SUPPORTED_VERSION = 31
+
+def svn_wc__min_supported_format_version():
+  return '1.8'
+
+def svn_wc__max_supported_format_version():
+  return '1.15'
+
+def svn_wc__is_supported_format_version(v):
+  major, minor = v.split('.')
+  return int(major) == 1 and int(minor) in range(8, 15+1)
 
 ######################################################################
 #
@@ -1770,8 +1778,8 @@ class TestSpawningThread(threading.Threa
       args.append('--http-library=' + options.http_library)
     if options.server_minor_version:
       args.append('--server-minor-version=' + 
str(options.server_minor_version))
-    if options.wc_format:
-      args.append('--wc-format=' + str(options.wc_format))
+    if options.wc_format_version:
+      args.append('--wc-format-version=' + options.wc_format_version)
     if options.mode_filter:
       args.append('--mode-filter=' + options.mode_filter)
     if options.milestone_filter:
@@ -2189,9 +2197,10 @@ def _create_parser(usage=None):
   parser.add_option('--server-minor-version', type='int', action='store',
                     help="Set the minor version for the server ('3'..'%d')."
                     % SVN_VER_MINOR)
-  parser.add_option('--wc-format', type='int', action='store',
-                    help="Set the WC format for all tests ('%d'..'%d')."
-                    % (SVN_WC__SUPPORTED_VERSION, SVN_WC__VERSION))
+  parser.add_option('--wc-format-version', action='store',
+                    help="Set the WC format version for all tests 
('%s'..'%s')."
+                    % (svn_wc__min_supported_format_version(),
+                       svn_wc__max_supported_format_version()))
   parser.add_option('--fsfs-packing', action='store_true',
                     help="Run 'svnadmin pack' automatically")
   parser.add_option('--fsfs-sharding', action='store', type='int',
@@ -2250,7 +2259,7 @@ def _create_parser(usage=None):
   # most of the defaults are None, but some are other values, set them here
   parser.set_defaults(
         server_minor_version=SVN_VER_MINOR,
-        wc_format=SVN_WC__VERSION,
+        wc_format_version=svn_wc__max_supported_format_version(),
         url=file_scheme_prefix + \
                         svntest.wc.svn_uri_quote(
                            os.path.abspath(
@@ -2319,9 +2328,11 @@ def parse_options(arglist=sys.argv[1:],
     parser.error("test harness only supports server minor versions 3-%d"
                  % SVN_VER_MINOR)
 
-  if options.wc_format not in range(SVN_WC__SUPPORTED_VERSION, 
SVN_WC__VERSION+1):
-    parser.error("test harness only supports WC formats %d-%d"
-                 % (SVN_WC__SUPPORTED_VERSION, SVN_WC__VERSION))
+  if not svn_wc__is_supported_format_version(options.wc_format_version):
+    parser.error("test harness only supports WC formats %s to %s, not '%s'"
+                 % (svn_wc__min_supported_format_version(),
+                    svn_wc__max_supported_format_version(),
+                    options.wc_format_version))
 
   pass
 

Modified: subversion/branches/multi-wc-format/subversion/tests/svn_test.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/tests/svn_test.h?rev=1897906&r1=1897905&r2=1897906&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/tests/svn_test.h (original)
+++ subversion/branches/multi-wc-format/subversion/tests/svn_test.h Wed Feb  9 
13:28:39 2022
@@ -216,8 +216,8 @@ typedef struct svn_test_opts_t
   /* Minor version to use for servers and FS backends, or zero to use
      the current latest version. */
   int server_minor_version;
-  /* WC format to use for all tests (except tests for a specific format) */
-  int wc_format;
+  /* WC format version to use for all tests (except tests for a specific 
format) */
+  const svn_version_t *wc_format_version;
   svn_boolean_t verbose;
   /* Add future "arguments" here. */
 } svn_test_opts_t;

Modified: subversion/branches/multi-wc-format/subversion/tests/svn_test_main.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/multi-wc-format/subversion/tests/svn_test_main.c?rev=1897906&r1=1897905&r2=1897906&view=diff
==============================================================================
--- subversion/branches/multi-wc-format/subversion/tests/svn_test_main.c 
(original)
+++ subversion/branches/multi-wc-format/subversion/tests/svn_test_main.c Wed 
Feb  9 13:28:39 2022
@@ -52,6 +52,7 @@
 #include "private/svn_mutex.h"
 #include "private/svn_sqlite.h"
 #include "private/svn_wc_private.h"
+#include "private/svn_subr_private.h"
 
 #include "svn_private_config.h"
 
@@ -100,7 +101,7 @@ enum test_options_e {
   quiet_opt,
   config_opt,
   server_minor_version_opt,
-  wc_format_opt,
+  wc_format_version_opt,
   allow_segfault_opt,
   srcdir_opt,
   reposdir_opt,
@@ -135,8 +136,9 @@ static const apr_getopt_option_t cl_opti
   {"server-minor-version", server_minor_version_opt, 1,
                     N_("set the minor version for the server ('3', '4', "
                        "'5', or '6')")},
-  {"wc-format",     wc_format_opt, 1,
-                    N_("set the WC format to use for all tests")},
+  {"wc-format-version", wc_format_version_opt, 1,
+                    N_("set the WC format version to use for all tests "
+                       "(1.8 to 1.15)")},
   {"quiet",         quiet_opt, 0,
                     N_("print only unexpected results")},
   {"allow-segfaults", allow_segfault_opt, 0,
@@ -806,6 +808,7 @@ svn_test_main(int argc, const char *argv
   svn_test_opts_t opts = { NULL };
 
   opts.fs_type = DEFAULT_FS_TYPE;
+  opts.wc_format_version = svn_wc__max_supported_format_version();
 
   /* Initialize APR (Apache pools) */
   if (apr_initialize() != APR_SUCCESS)
@@ -998,24 +1001,20 @@ svn_test_main(int argc, const char *argv
               }
             break;
           }
-        case wc_format_opt:
+        case wc_format_version_opt:
           {
-            char *end;
-            opts.wc_format = (int) strtol(opt_arg, &end, 10);
-            if (end == opt_arg || *end != '\0')
-              {
-                fprintf(stderr, "FAIL: Non-numeric WC format given\n");
-                exit(1);
-              }
-            if (!svn_wc__is_supported_format(opts.wc_format))
+            svn_version_t *ver;
+            SVN_INT_ERR(svn_version__parse_version_string(&ver, opt_arg, 
pool));
+            if (!svn_wc__is_supported_format_version(ver))
               {
-                fprintf(stderr, "FAIL: Unsupported WC format given (%d); "
-                                "supported formats are %d to %d\n",
-                                opts.wc_format,
-                                svn_wc__min_supported_format(),
-                                svn_wc__max_supported_format());
+                fprintf(stderr, "FAIL: Unsupported WC format version given 
(%s); "
+                                "supported format versions are 1.%d to 1.%d\n",
+                                opt_arg,
+                                svn_wc__min_supported_format_version()->minor,
+                                svn_wc__max_supported_format_version()->minor);
                 exit(1);
               }
+            opts.wc_format_version = ver;
             break;
           }
         case sqlite_log_opt:


Reply via email to