You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2014/03/19 21:06:34 UTC

svn commit: r1579376 - in /subversion/trunk: Makefile.in build/run_tests.py subversion/tests/cmdline/svntest/main.py

Author: stsp
Date: Wed Mar 19 20:06:33 2014
New Revision: 1579376

URL: http://svn.apache.org/r1579376
Log:
Allow memcached to be enabled on the 'make check' command line.

So far, tests could be run with memcached by tweaking the file
subversion/tests/tests.conf before running the tests.
With this commit, a running memcached server can specified directly
on the command line, like so:

  make check MEMCACHED_SERVER=127.0.0.1:11211
 
This is similar to how other test options are enabled/disabled.

Currently, a lot of tests fail if this option is used, mostly due
to checksum mismatch errors like:

W: svn: E200014: Checksum mismatch for '/home/stsp/svn/svn-trunk/subversion/tests/cmdline/svn-test-work/working_copies/basic_tests-19/A/D/gamma':
W:    expected:  412138bd677d64cd1c32fafbffe6245d
W:      actual:  ada10d942b1964d359e048dbacff3460
W: 

I believe the reason for such failures is that the test suite copies an
existing repository for each test without changing the repository UUID.
Memcached cache might return wrong fulltexts if a repository UUID is reused.

* Makefile.in
  (check): Pass $(MEMCACHED_SERVER) to run_tests.py's --memcache-server flag.

* build/run_tests.py
  (usage, main): add --memcached-server option
  (TestHarness): Add memcached_server parameter and pass it on
   to snvtest.main.options.

* subversion/tests/cmdline/svntest/main.py
  (create_repos): For >=1.6, enable use specified memcached in fsfs.conf
   if --memcached-server was provided.

Modified:
    subversion/trunk/Makefile.in
    subversion/trunk/build/run_tests.py
    subversion/trunk/subversion/tests/cmdline/svntest/main.py

Modified: subversion/trunk/Makefile.in
URL: http://svn.apache.org/viewvc/subversion/trunk/Makefile.in?rev=1579376&r1=1579375&r2=1579376&view=diff
==============================================================================
--- subversion/trunk/Makefile.in (original)
+++ subversion/trunk/Makefile.in Wed Mar 19 20:06:33 2014
@@ -557,6 +557,9 @@ check: bin @TRANSFORM_LIBTOOL_SCRIPTS@ $
 	  if test "$(EXCLUSIVE_WC_LOCKS)" != ""; then                        \
 	    flags="--exclusive-wc-locks $$flags";                            \
 	  fi;                                                                \
+	  if test "$(MEMCACHED_SERVER)" != ""; then                          \
+	    flags="--memcached-server $(MEMCACHED_SERVER) $$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/trunk/build/run_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/build/run_tests.py?rev=1579376&r1=1579375&r2=1579376&view=diff
==============================================================================
--- subversion/trunk/build/run_tests.py (original)
+++ subversion/trunk/build/run_tests.py Wed Mar 19 20:06:33 2014
@@ -30,7 +30,7 @@
             [--list] [--milestone-filter=<regex>] [--mode-filter=<type>]
             [--server-minor-version=<version>] [--http-proxy=<host>:<port>]
             [--config-file=<file>] [--ssl-cert=<file>]
-            [--exclusive-wc-locks]
+            [--exclusive-wc-locks] [--memcached-server=<url:port>]
             <abs_srcdir> <abs_builddir>
             <prog ...>
 
@@ -127,7 +127,8 @@ class TestHarness:
                list_tests=None, svn_bin=None, mode_filter=None,
                milestone_filter=None, set_log_level=None, ssl_cert=None,
                http_proxy=None, http_proxy_username=None,
-               http_proxy_password=None, exclusive_wc_locks=None):
+               http_proxy_password=None, exclusive_wc_locks=None,
+               memcached_server=None):
     '''Construct a TestHarness instance.
 
     ABS_SRCDIR and ABS_BUILDDIR are the source and build directories.
@@ -185,6 +186,7 @@ class TestHarness:
     self.http_proxy_username = http_proxy_username
     self.http_proxy_password = http_proxy_password
     self.exclusive_wc_locks = exclusive_wc_locks
+    self.memcached_server = memcached_server
     if not sys.stdout.isatty() or sys.platform == 'win32':
       TextColors.disable()
 
@@ -505,6 +507,8 @@ class TestHarness:
         svntest.main.options.http_proxy_password = self.http_proxy_password
     if self.exclusive_wc_locks is not None:
       svntest.main.options.exclusive_wc_locks = self.exclusive_wc_locks
+    if self.memcached_server is not None:
+      svntest.main.options.memcached_server = self.memcached_server
 
     svntest.main.options.srcdir = self.srcdir
 
@@ -670,7 +674,8 @@ def main():
                             'log-to-stdout', 'list', 'milestone-filter=',
                             'mode-filter=', 'set-log-level=', 'ssl-cert=',
                             'http-proxy=', 'http-proxy-username=',
-                            'http-proxy-password=','exclusive-wc-locks'])
+                            'http-proxy-password=','exclusive-wc-locks',
+                            'memcached-server='])
   except getopt.GetoptError:
     args = []
 
@@ -682,9 +687,9 @@ def main():
     server_minor_version, fsfs_sharding, fsfs_packing, parallel, \
     config_file, log_to_stdout, list_tests, mode_filter, milestone_filter, \
     set_log_level, ssl_cert, http_proxy, http_proxy_username, \
-    http_proxy_password, exclusive_wc_locks = \
+    http_proxy_password, exclusive_wc_locks, memcached_server = \
             None, None, None, None, None, None, None, None, None, None, None, \
-            None, None, None, None, None, None, None, None, None, None
+            None, None, None, None, None, None, None, None, None, None, None
   for opt, val in opts:
     if opt in ['-u', '--url']:
       base_url = val
@@ -728,6 +733,8 @@ def main():
       http_proxy_password = val
     elif opt in ['--exclusive-wc-locks']:
       exclusive_wc_locks = 1
+    elif opt in ['--memcached-server']:
+      memcached_server = val
     else:
       raise getopt.GetoptError
 
@@ -747,7 +754,8 @@ def main():
                    http_proxy=http_proxy,
                    http_proxy_username=http_proxy_username,
                    http_proxy_password=http_proxy_password,
-                   exclusive_wc_locks=exclusive_wc_locks)
+                   exclusive_wc_locks=exclusive_wc_locks,
+                   memcached_server=memcached_server)
 
   failed = th.run(args[2:])
   if failed:

Modified: subversion/trunk/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/main.py?rev=1579376&r1=1579375&r2=1579376&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/main.py Wed Mar 19 20:06:33 2014
@@ -944,7 +944,14 @@ def create_repos(path, minor_version = N
     # fsfs.conf file
     if options.config_file is not None and \
        (not minor_version or minor_version >= 6):
-      shutil.copy(options.config_file, get_fsfs_conf_file_path(path))
+      config_file = open(options.config_file, 'r')
+      fsfsconf = open(get_fsfs_conf_file_path(path), 'w')
+      for line in config_file.readlines():
+        fsfsconf.write(line)
+        if options.memcached_server and line == '[memcached-servers]\n':
+            fsfsconf.write('key = %s\n' % options.memcached_server)
+      config_file.close()
+      fsfsconf.close()
 
     # format file
     if options.fsfs_sharding is not None:
@@ -1472,6 +1479,8 @@ class TestSpawningThread(threading.Threa
       args.append('--http-proxy-password=' + options.http_proxy_password)
     if options.exclusive_wc_locks:
       args.append('--exclusive-wc-locks')
+    if options.memcached_server:
+      args.append('--memcached-server' + options.memcached_server)
 
     result, stdout_lines, stderr_lines = spawn_process(command, 0, False, None,
                                                        *args)
@@ -1825,6 +1834,8 @@ def _create_parser():
                     help='Use the svn tools installed in this path')
   parser.add_option('--exclusive-wc-locks', action='store_true',
                     help='Use sqlite exclusive locking for working copies')
+  parser.add_option('--memcached-server', action='store',
+                    help='Use memcached server at specified URL (FSFS only)')
 
   # most of the defaults are None, but some are other values, set them here
   parser.set_defaults(