Author: kotkov
Date: Tue Nov 22 19:22:02 2022
New Revision: 1905459

URL: http://svn.apache.org/viewvc?rev=1905459&view=rev
Log:
On the 'pristines-on-demand-on-mwf' branch: Allow the test suite to run
with different --store-pristine options:

    win-tests.py --store-pristine=yes|no
    make check STORE_PRISTINE=yes|no

(There are some remaining issues in the --store-pristine=no mode, but I'll
 try to handle them separately.)

* Makefile.in
  (check): Handle STORE_PRISTINE and pass it to the test suite.

* win-tests.py
  (): Handle the new --store-pristine option.
  (_usage_exit): Adjust usage text.

* build/run_tests.py
  (): Update usage comment.
  (create_parser): Parse --store-pristine.
  (_init_py_tests, _init_c_tests): Propagate the new option further.

* subversion/tests/cmdline/svntest/main.py
  (_create_parser): Parse --store-pristine.
  (run_one): Propagate the new option further.
  (_with_store_pristine): New helper, that is…
  (run_svn): …being used here.

* subversion/tests/svn_test_main.c
  (test_options_e, cl_options): Add --store-pristine option.
  (svn_test_main): Parse the new option.

Modified:
    subversion/branches/pristines-on-demand-on-mwf/Makefile.in
    subversion/branches/pristines-on-demand-on-mwf/build/run_tests.py
    
subversion/branches/pristines-on-demand-on-mwf/subversion/tests/cmdline/svntest/main.py
    
subversion/branches/pristines-on-demand-on-mwf/subversion/tests/svn_test_main.c
    subversion/branches/pristines-on-demand-on-mwf/win-tests.py

Modified: subversion/branches/pristines-on-demand-on-mwf/Makefile.in
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-on-mwf/Makefile.in?rev=1905459&r1=1905458&r2=1905459&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-on-mwf/Makefile.in (original)
+++ subversion/branches/pristines-on-demand-on-mwf/Makefile.in Tue Nov 22 
19:22:02 2022
@@ -629,6 +629,9 @@ check: bin @TRANSFORM_LIBTOOL_SCRIPTS@ $
          if test "$(SVN_BIN_DIR)" != ""; then                               \
            flags="--bin $(SVN_BIN_DIR) $$flags";                            \
          fi;                                                                \
+         if test "$(STORE_PRISTINE)" != ""; then                            \
+           flags="--store-pristine $(STORE_PRISTINE) $$flags";              \
+         fi;                                                                \
          LD_LIBRARY_PATH='$(auth_plugin_dirs):$(LD_LIBRARY_PATH)'           \
          $(PYTHON) $(top_srcdir)/build/run_tests.py                         \
                    --config-file $(top_srcdir)/subversion/tests/tests.conf  \

Modified: subversion/branches/pristines-on-demand-on-mwf/build/run_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-on-mwf/build/run_tests.py?rev=1905459&r1=1905458&r2=1905459&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-on-mwf/build/run_tests.py (original)
+++ subversion/branches/pristines-on-demand-on-mwf/build/run_tests.py Tue Nov 
22 19:22:02 2022
@@ -35,7 +35,7 @@
             [--config-file=<file>] [--ssl-cert=<file>]
             [--exclusive-wc-locks] [--memcached-server=<url:port>]
             [--fsfs-compression=<type>] [--fsfs-dir-deltification=<true|false>]
-            [--allow-remote-http-connection]
+            [--allow-remote-http-connection] [--store-pristine=<val>]
             <abs_srcdir> <abs_builddir>
             <prog ...>
 
@@ -264,6 +264,8 @@ class TestHarness:
       cmdline.append('--mode-filter=' + self.opts.mode_filter)
     if self.opts.parallel is not None:
       cmdline.append('--parallel')
+    if self.opts.store_pristine is not None:
+      cmdline.append('--store-pristine=%s' % self.opts.store_pristine)
 
     self.c_test_cmdline = cmdline
 
@@ -331,6 +333,8 @@ class TestHarness:
       cmdline.append('--fsfs-dir-deltification=%s' % 
self.opts.fsfs_dir_deltification)
     if self.opts.allow_remote_http_connection is not None:
       cmdline.append('--allow-remote-http-connection')
+    if self.opts.store_pristine is not None:
+      cmdline.append('--store-pristine=%s' % self.opts.store_pristine)
 
     self.py_test_cmdline = cmdline
 
@@ -1089,6 +1093,8 @@ def create_parser():
                     help='Set directory deltification option (for fsfs)')
   parser.add_option('--allow-remote-http-connection', action='store_true',
                     help='Run tests that connect to remote HTTP(S) servers')
+  parser.add_option('--store-pristine', action='store', type='str',
+                    help='Set the WC pristine mode')
 
   parser.set_defaults(set_log_level=None)
   return parser

Modified: 
subversion/branches/pristines-on-demand-on-mwf/subversion/tests/cmdline/svntest/main.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-on-mwf/subversion/tests/cmdline/svntest/main.py?rev=1905459&r1=1905458&r2=1905459&view=diff
==============================================================================
--- 
subversion/branches/pristines-on-demand-on-mwf/subversion/tests/cmdline/svntest/main.py
 (original)
+++ 
subversion/branches/pristines-on-demand-on-mwf/subversion/tests/cmdline/svntest/main.py
 Tue Nov 22 19:22:02 2022
@@ -800,6 +800,18 @@ def copy_trust(dst_cfgdir, src_cfgdir):
   for f in os.listdir(src_ssl_dir):
     shutil.copy(os.path.join(src_ssl_dir, f), os.path.join(dst_ssl_dir, f))
 
+def _with_store_pristine(args):
+  if '--store-pristine' in args \
+      or any(str(one_arg).startswith('--store-pristine=') for one_arg in args) 
\
+      or options.store_pristine is None:
+    return args
+  non_opt_args = [a for a in args if not str(a).startswith('-')]
+  if non_opt_args:
+    subcommand = non_opt_args[0]
+    if subcommand in ['co', 'checkout']:
+      return args + ('--store-pristine', options.store_pristine)
+  return args
+
 def _with_wc_format_version(args):
   if '--compatible-version' in args \
       or any(str(one_arg).startswith('--compatible-version=') for one_arg in 
args) \
@@ -847,7 +859,8 @@ def run_svn(error_expected, *varargs):
   you're just checking that something does/doesn't come out of
   stdout/stderr, you might want to use actions.run_and_verify_svn()."""
   return run_command(svn_binary, error_expected, False,
-                     
*(_with_wc_format_version(_with_auth(_with_config_dir(varargs)))))
+                     *(_with_store_pristine(_with_wc_format_version(
+                       _with_auth(_with_config_dir(varargs))))))
 
 # For running svnadmin.  Ignores the output.
 def run_svnadmin(*varargs):
@@ -1857,6 +1870,8 @@ class TestSpawningThread(threading.Threa
       args.append('--allow-remote-http-connection')
     if options.svn_bin:
       args.append('--bin=' + options.svn_bin)
+    if options.store_pristine:
+      args.append('--store-pristine=' + options.store_pristine)
 
     result, stdout_lines, stderr_lines = spawn_process(command, 0, False, None,
                                                        *args)
@@ -2296,6 +2311,8 @@ def _create_parser(usage=None):
                     help='Set directory deltification option (for fsfs)')
   parser.add_option('--allow-remote-http-connection', action='store_true',
                     help='Run tests that connect to remote HTTP(S) servers')
+  parser.add_option('--store-pristine', action='store', type='str',
+                    help='Set the WC pristine mode')
 
   # most of the defaults are None, but some are other values, set them here
   parser.set_defaults(

Modified: 
subversion/branches/pristines-on-demand-on-mwf/subversion/tests/svn_test_main.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-on-mwf/subversion/tests/svn_test_main.c?rev=1905459&r1=1905458&r2=1905459&view=diff
==============================================================================
--- 
subversion/branches/pristines-on-demand-on-mwf/subversion/tests/svn_test_main.c 
(original)
+++ 
subversion/branches/pristines-on-demand-on-mwf/subversion/tests/svn_test_main.c 
Tue Nov 22 19:22:02 2022
@@ -111,7 +111,8 @@ enum test_options_e {
   mode_filter_opt,
   sqlite_log_opt,
   parallel_opt,
-  fsfs_version_opt
+  fsfs_version_opt,
+  store_pristine_opt
 };
 
 static const apr_getopt_option_t cl_options[] =
@@ -157,6 +158,8 @@ static const apr_getopt_option_t cl_opti
                     N_("enable SQLite logging")},
   {"parallel",      parallel_opt, 0,
                     N_("allow concurrent execution of tests")},
+  {"store-pristine", store_pristine_opt, 1,
+                    N_("set the WC pristine mode")},
   {0,               0, 0, 0}
 };
 
@@ -1026,6 +1029,18 @@ svn_test_main(int argc, const char *argv
           parallel = TRUE;
           break;
 #endif
+        case store_pristine_opt:
+          {
+            const char *utf8_opt_arg;
+            SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
+            opts.store_pristine = svn_tristate__from_word(utf8_opt_arg);
+            if (opts.store_pristine == svn_tristate_unknown)
+              {
+                fprintf(stderr, "FAIL: Invalid --store-pristine option.\n");
+                exit(1);
+              }
+            break;
+          }
       }
     }
   opts.verbose = verbose_mode;

Modified: subversion/branches/pristines-on-demand-on-mwf/win-tests.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-on-mwf/win-tests.py?rev=1905459&r1=1905458&r2=1905459&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-on-mwf/win-tests.py (original)
+++ subversion/branches/pristines-on-demand-on-mwf/win-tests.py Tue Nov 22 
19:22:02 2022
@@ -115,6 +115,7 @@ def _usage_exit():
   print("  --fsfs-packing         : Run 'svnadmin pack' automatically")
   print("  --fsfs-compression=VAL : Set compression type to VAL (for fsfs)")
   print("  --wc-format-version=VAL: Set the WC format version")
+  print("  --store-pristine=VAL   : Set the WC pristine mode")
   print("  -q, --quiet            : Deprecated; this is the default.")
   print("                           Use --set-log-level instead.")
 
@@ -147,6 +148,7 @@ opts, args = my_getopt(sys.argv[1:], 'hr
                         'ssl-cert=', 'exclusive-wc-locks', 'memcached-server=',
                         'skip-c-tests', 'dump-load-cross-check', 
'memcached-dir=',
                         'fsfs-compression=', 'wc-format-version=',
+                        'store-pristine='
                         ])
 if len(args) > 1:
   print('Warning: non-option arguments after the first one will be ignored')
@@ -195,6 +197,7 @@ dump_load_cross_check = None
 fsfs_compression = None
 fsfs_dir_deltification = None
 wc_format_version = None
+store_pristine = None
 
 for opt, val in opts:
   if opt in ('-h', '--help'):
@@ -295,6 +298,8 @@ for opt, val in opts:
     fsfs_dir_deltification = val
   elif opt == '--wc-format-version':
     wc_format_version = val
+  elif opt == '--store-pristine':
+    store_pristine = val
 
 # Calculate the source and test directory names
 abs_srcdir = os.path.abspath("")
@@ -1137,6 +1142,7 @@ if not test_javahl and not test_swig:
   opts.fsfs_compression = fsfs_compression
   opts.fsfs_dir_deltification = fsfs_dir_deltification
   opts.wc_format_version = wc_format_version
+  opts.store_pristine = store_pristine
   th = run_tests.TestHarness(abs_srcdir, abs_builddir,
                              log_file, fail_log_file, opts)
   old_cwd = os.getcwd()


Reply via email to