subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1743183 - in /subversion/trunk/subversion/tests/cmdline: svnrdump_tests.py svntest/actions.py svntest/main.py svntest/sandbox.py svntest/verify.py svntest/wc.py
Date Tue, 10 May 2016 13:52:59 GMT
Author: stefan2
Date: Tue May 10 13:52:59 2016
New Revision: 1743183

URL: http://svn.apache.org/viewvc?rev=1743183&view=rev
Log:
The biggest group of test failures under Python 3 are the svnrdump tests.
Make them pass.  Virtually all of this is bytes <-> str related.

* subversion/tests/cmdline/svnrdump_tests.py
  (run_load_test): The verfication routine expects the UUID as a str.

* subversion/tests/cmdline/svntest/actions.py
  (run_and_verify_dump): If we accept any output, "None" is the better
                         option as it works with both Python versions.

* subversion/tests/cmdline/svntest/main.py
  (_repos_diskpath*): Make these global definitions for efficiency.
  (run_command_stdin): Use the above instead of dynamically constructing
                       them.  Accept byte strings and ordinary str alike.

* subversion/tests/cmdline/svntest/sandbox.py
  (Sandbox.simple_append): Use the main.file_write to do the heavy
                           lifting of string type check & conversion.

* subversion/tests/cmdline/svntest/verify.py
  (compare_and_display_lines): Work for binary data and strings alike. 

* subversion/tests/cmdline/svntest/wc.py
  (State.remove_subtree,
   State.rename): Make sure we have an independent list object before
                  manipulating the original.  Py3 would otherwise give
                  us a mere iterator.

Modified:
    subversion/trunk/subversion/tests/cmdline/svnrdump_tests.py
    subversion/trunk/subversion/tests/cmdline/svntest/actions.py
    subversion/trunk/subversion/tests/cmdline/svntest/main.py
    subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py
    subversion/trunk/subversion/tests/cmdline/svntest/verify.py
    subversion/trunk/subversion/tests/cmdline/svntest/wc.py

Modified: subversion/trunk/subversion/tests/cmdline/svnrdump_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svnrdump_tests.py?rev=1743183&r1=1743182&r2=1743183&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svnrdump_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svnrdump_tests.py Tue May 10 13:52:59 2016
@@ -165,7 +165,7 @@ def run_load_test(sbox, dumpfile_name, e
 
   # Set the UUID of the sbox repository to the UUID specified in the
   # dumpfile ### RA layer doesn't have a set_uuid functionality
-  uuid = original_dumpfile[2].split(b' ')[1][:-1]
+  uuid = original_dumpfile[2].split(b' ')[1][:-1].decode()
   svntest.actions.run_and_verify_svnadmin2(None, None, 0,
                                            'setuuid', sbox.repo_dir,
                                            uuid)

Modified: subversion/trunk/subversion/tests/cmdline/svntest/actions.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/actions.py?rev=1743183&r1=1743182&r2=1743183&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/actions.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/actions.py Tue May 10 13:52:59 2016
@@ -374,7 +374,7 @@ def run_and_verify_dump(repo_dir, deltas
   if deltas:
     args += ('--deltas',)
   exit_code, output, errput = run_and_verify_svnadmin(
-                                verify.AnyOutput, [],
+                                None, [],
                                 'dump', '--quiet', repo_dir, *args)
   return output
 

Modified: subversion/trunk/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/main.py?rev=1743183&r1=1743182&r2=1743183&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/main.py Tue May 10 13:52:59 2016
@@ -405,6 +405,17 @@ def run_command(command, error_expected,
   return run_command_stdin(command, error_expected, 0, binary_mode,
                            None, *varargs)
 
+# Frequently used constants:
+# If any of these relative path strings show up in a server response,
+# then we can assume that the on-disk repository path was leaked to the
+# client.  Having these here as constants means we don't need to construct
+# them over and over again.
+_repos_diskpath1 = os.path.join('cmdline', 'svn-test-work', 'repositories')
+_repos_diskpath2 = os.path.join('cmdline', 'svn-test-work', 'local_tmp',
+                                'repos')
+_repos_diskpath1_bytes = _repos_diskpath1.encode()
+_repos_diskpath2_bytes = _repos_diskpath2.encode()
+
 # A regular expression that matches arguments that are trivially safe
 # to pass on a command line without quoting on any supported operating
 # system:
@@ -574,9 +585,10 @@ def run_command_stdin(command, error_exp
     # ### or the diskpath isn't realpath()'d somewhere on the way from
     # ### the server's configuration and the client's stderr.  We could
     # ### check for both the symlinked path and the realpath.
-    return \
-         os.path.join('cmdline', 'svn-test-work', 'repositories') in line \
-      or os.path.join('cmdline', 'svn-test-work', 'local_tmp', 'repos') in line
+    if isinstance(line, str):
+      return _repos_diskpath1 in line or _repos_diskpath2 in line
+    else:
+      return _repos_diskpath1_bytes in line or _repos_diskpath2_bytes in line
 
   for lines, name in [[stdout_lines, "stdout"], [stderr_lines, "stderr"]]:
     if is_ra_type_file() or 'svnadmin' in command or 'svnlook' in command:

Modified: subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py?rev=1743183&r1=1743182&r2=1743183&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py Tue May 10 13:52:59 2016
@@ -434,7 +434,8 @@ class Sandbox:
   def simple_append(self, dest, contents, truncate=False):
     """Append CONTENTS to file DEST, optionally truncating it first.
        DEST is a relpath relative to the WC."""
-    open(self.ospath(dest), truncate and 'wb' or 'ab').write(contents)
+    svntest.main.file_write(self.ospath(dest), contents,
+                            truncate and 'wb' or 'ab')
 
   def simple_lock(self, *targets):
     """Lock TARGETS in the WC.

Modified: subversion/trunk/subversion/tests/cmdline/svntest/verify.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/verify.py?rev=1743183&r1=1743182&r2=1743183&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/verify.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/verify.py Tue May 10 13:52:59 2016
@@ -416,9 +416,10 @@ def compare_and_display_lines(message, l
   if not isinstance(expected, ExpectedOutput):
     expected = ExpectedOutput(expected)
 
-  if isinstance(actual, str):
-    actual = [actual]
-  actual = svntest.main.filter_dbg(actual)
+  actual = svntest.main.ensure_list(actual)
+  if len(actual) > 0:
+    is_binary = not isinstance(actual[0], str)
+    actual = svntest.main.filter_dbg(actual, is_binary)
 
   if not expected.matches(actual):
     expected.display_differences(message, label, actual)

Modified: subversion/trunk/subversion/tests/cmdline/svntest/wc.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/wc.py?rev=1743183&r1=1743182&r2=1743183&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/wc.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/wc.py Tue May 10 13:52:59 2016
@@ -173,7 +173,7 @@ class State:
     "Remove PATHS recursively from the state (the paths must exist)."
     for subtree_path in paths:
       subtree_path = to_relpath(subtree_path)
-      for path, item in self.desc.items():
+      for path, item in svntest.main.ensure_list(self.desc.items()):
         if path == subtree_path or path[:len(subtree_path) + 1] == subtree_path + '/':
           del self.desc[path]
 
@@ -228,7 +228,7 @@ class State:
     temp = {}
     for src, dst in sorted(moves.items(), key=lambda pair: pair[0])[::-1]:
       temp[src] = {}
-      for path, item in self.desc.items():
+      for path, item in svntest.main.ensure_list(self.desc.items()):
         if path == src or path[:len(src) + 1] == src + '/':
           temp[src][path] = item;
           del self.desc[path]



Mime
View raw message