You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ar...@apache.org on 2010/08/01 09:58:51 UTC

svn commit: r981170 - in /subversion/trunk/subversion/tests/cmdline: svnrdump_tests.py svntest/actions.py svntest/main.py

Author: artagnon
Date: Sun Aug  1 07:58:51 2010
New Revision: 981170

URL: http://svn.apache.org/viewvc?rev=981170&view=rev
Log:
svnrdump: Fix load test that was broken due to an interactive
authentication prompt

* subversion/tests/cmdline/svntest/main.py
  (run_svnrdump): Add an extra stdin_input argument and call
  run_command_stdin when the argument is present to account for the
  load functionality in svnrdump. Wrap both varargs in _with_auth and
  _with_config_dir.
  
* subversion/tests/cmdline/svntest/actions.py
  (run_and_verify_svnrdump_dump, run_and_verify_svnrdump_load,
  run_and_verify_svnrdump): Merge the specalized versions of the
  functions into a generalized version, since the logic to handle
  input is now in run_svnrdump.

* subversion/tests/cmdline/svnrdump_tests.py
  (run_dump_test, run_load_test): Improve docstrings, and track the
  API change to just call run_and_verify_svnrdump with different
  arguments.

Found by: danielsh

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

Modified: subversion/trunk/subversion/tests/cmdline/svnrdump_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svnrdump_tests.py?rev=981170&r1=981169&r2=981170&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svnrdump_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svnrdump_tests.py Sun Aug  1 07:58:51 2010
@@ -54,8 +54,8 @@ def build_repos(sbox):
   svntest.main.create_repos(sbox.repo_dir)
 
 def run_dump_test(sbox, dumpfile_name):
-  """Load a dumpfile using svnadmin load, dump it with svnrdump and
-  check that the same dumpfile is produced"""
+  """Load a dumpfile using 'svnadmin load', dump it with 'svnrdump
+  dump' and check that the same dumpfile is produced"""
 
   # Create an empty sanbox repository
   build_repos(sbox)
@@ -74,16 +74,17 @@ def run_dump_test(sbox, dumpfile_name):
 
   # Create a dump file using svnrdump
   svnrdump_dumpfile = \
-      svntest.actions.run_and_verify_svnrdump_dump(svntest.verify.AnyOutput,
-                                                   [], 0, '-q', sbox.repo_url)
+      svntest.actions.run_and_verify_svnrdump(None, svntest.verify.AnyOutput,
+                                              [], 0, '-q', 'dump',
+                                              sbox.repo_url)
 
   # Compare the output from stdout
   svntest.verify.compare_and_display_lines(
     "Dump files", "DUMP", svnadmin_dumpfile, svnrdump_dumpfile)
 
 def run_load_test(sbox, dumpfile_name):
-  """Load a dumpfile using svnrdump, dump it with svnadmin dump and
-  check that the same dumpfile is produced"""
+  """Load a dumpfile using 'svnrdump load', dump it with 'svnadmin
+  dump' and check that the same dumpfile is produced"""
 
   # Create an empty sanbox repository
   build_repos(sbox)
@@ -102,15 +103,16 @@ def run_load_test(sbox, dumpfile_name):
                            'rb').readlines()
 
   # Set the UUID of the sbox repository to the UUID specified in the
-  # dumpfile
+  # dumpfile ### RA layer doesn't have a set_uuid functionality
   uuid = svnrdump_dumpfile[2].split(' ')[1][:-1]
   svntest.actions.run_and_verify_svnadmin2("Setting UUID", None, None, 0,
                                            'setuuid', sbox.repo_dir,
                                            uuid)
 
-  svntest.actions.run_and_verify_svnrdump_load(svnrdump_dumpfile,
-                                               svntest.verify.AnyOutput,
-                                               [], 0, '-q', sbox.repo_url)
+  svntest.actions.run_and_verify_svnrdump(svnrdump_dumpfile,
+                                          svntest.verify.AnyOutput,
+                                          [], 0, '-q', 'load',
+                                          sbox.repo_url)
 
   # Create a dump file using svnadmin dump
   svnadmin_dumpfile = svntest.actions.run_and_verify_dump(sbox.repo_dir, True)
@@ -127,8 +129,9 @@ def basic_dump(sbox):
   sbox.build(read_only = True, create_wc = False)
 
   out = \
-      svntest.actions.run_and_verify_svnrdump_dump(svntest.verify.AnyOutput,
-                                                   [], 0, '-q', sbox.repo_url)
+      svntest.actions.run_and_verify_svnrdump(None, svntest.verify.AnyOutput,
+                                              [], 0, '-q', 'dump',
+                                              sbox.repo_url)
 
   if not out[0].startswith('SVN-fs-dump-format-version:'):
     raise svntest.Failure('No valid output')

Modified: subversion/trunk/subversion/tests/cmdline/svntest/actions.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/actions.py?rev=981170&r1=981169&r2=981170&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/actions.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/actions.py Sun Aug  1 07:58:51 2010
@@ -288,28 +288,17 @@ def run_and_verify_dump(repo_dir, deltas
   return output
 
 
-def run_and_verify_svnrdump_dump(expected_stdout, expected_stderr,
-                                 expected_exit, *varargs):
-  """Runs 'svnrdump dump' reporting errors and returning output on
-  stdout."""
+def run_and_verify_svnrdump(dumpfile_content, expected_stdout,
+                            expected_stderr, expected_exit, *varargs):
+  """Runs 'svnrdump dump|load' depending on dumpfile_content and
+  reports any errors."""
+  exit_code, output, err = main.run_svnrdump(dumpfile_content, *varargs)
 
-  exit_code, output, err = main.run_svnrdump('dump', *varargs)
   verify.verify_outputs("Unexpected output", output, err,
                         expected_stdout, expected_stderr)
   verify.verify_exit_code("Unexpected return code", exit_code, expected_exit)
   return output
 
-def run_and_verify_svnrdump_load(dumpfile_content, expected_stdout,
-                                 expected_stderr, expected_exit, *varargs):
-  """Runs 'svnrdump load' and reports any errors."""
-
-  exit_code, output, err = main.run_command_stdin(
-    main.svnrdump_binary, expected_stderr, 0, 1, dumpfile_content,
-    'load', *varargs)
-  verify.verify_outputs("Unexpected output", output, err,
-                        expected_stdout, expected_stderr)
-  verify.verify_exit_code("Unexpected return code", exit_code, expected_exit)
-
 def load_repo(sbox, dumpfile_path = None, dump_str = None):
   "Loads the dumpfile into sbox"
   if not dump_str:

Modified: subversion/trunk/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/main.py?rev=981170&r1=981169&r2=981170&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/main.py Sun Aug  1 07:58:51 2010
@@ -593,11 +593,15 @@ def run_svnlook(*varargs):
   list of lines (including line terminators)."""
   return run_command(svnlook_binary, 1, 0, *varargs)
 
-def run_svnrdump(*varargs):
+def run_svnrdump(stdin_input, *varargs):
   """Run svnrdump with VARARGS, returns exit code as int; stdout, stderr as
   list of lines (including line terminators)."""
-  return run_command(svnrdump_binary, 1, 0,
-                     *(_with_auth(_with_config_dir(varargs))))
+  if stdin_input:
+    return run_command_stdin(svnrdump_binary, 0, 1, 0, stdin_input,
+                             *(_with_auth(_with_config_dir(varargs))))
+  else:
+    return run_command(svnrdump_binary, 1, 0,
+                       *(_with_auth(_with_config_dir(varargs))))
 
 def run_svnsync(*varargs):
   """Run svnsync with VARARGS, returns exit code as int; stdout, stderr as