subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1662866 - in /subversion/trunk/subversion/tests/cmdline: merge_reintegrate_tests.py merge_tests.py resolve_tests.py special_tests.py svntest/actions.py svntest/deeptrees.py
Date Sat, 28 Feb 2015 00:42:58 GMT
Author: rhuijben
Date: Sat Feb 28 00:42:57 2015
New Revision: 1662866

URL: http://svn.apache.org/r1662866
Log:
Following up on the recent run_and_verify() changes in the python tests,
make the merge tests use the standard stderr verify code. This patch
also enables other verifications of other output in case of an error,
which appears to have been disabled before.

* subversion/tests/cmdline/merge_reintegrate_tests.py
  (run_and_verify_reintegrate): Rename argument.
  (*): Update calls.

* subversion/tests/cmdline/merge_tests.py
  (cherry_pick_text_conflict): Fix expected output.

* subversion/tests/cmdline/resolve_tests.py
  (resolved_on_deleted_item): Update caller.

* subversion/tests/cmdline/special_tests.py
  (replace_symlink_with_dir): Fix test setup.

* subversion/tests/cmdline/svntest/actions.py
  (run_and_verify_merge): Use standard error handling.

* subversion/tests/cmdline/svntest/deeptrees.py
  (deep_trees_run_tests_scheme_for_merge): Pass proper expected_stderr.

Modified:
    subversion/trunk/subversion/tests/cmdline/merge_reintegrate_tests.py
    subversion/trunk/subversion/tests/cmdline/merge_tests.py
    subversion/trunk/subversion/tests/cmdline/resolve_tests.py
    subversion/trunk/subversion/tests/cmdline/special_tests.py
    subversion/trunk/subversion/tests/cmdline/svntest/actions.py
    subversion/trunk/subversion/tests/cmdline/svntest/deeptrees.py

Modified: subversion/trunk/subversion/tests/cmdline/merge_reintegrate_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/merge_reintegrate_tests.py?rev=1662866&r1=1662865&r2=1662866&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/merge_reintegrate_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/merge_reintegrate_tests.py Sat Feb 28 00:42:57
2015
@@ -86,7 +86,7 @@ def run_and_verify_reintegrate(tgt_dir,
                                mergeinfo_output_tree,
                                elision_output_tree,
                                disk_tree, status_tree, skip_tree,
-                               error_re_string = None,
+                               expected_stderr = [],
                                check_props = True,
                                dry_run = True):
   """Run 'svn merge --reintegrate SRC_URL TGT_DIR'. Raise an error if
@@ -98,7 +98,7 @@ def run_and_verify_reintegrate(tgt_dir,
                     tgt_dir, None, None, src_url, None,
                     output_tree, mergeinfo_output_tree, elision_output_tree,
                     disk_tree, status_tree, skip_tree,
-                    error_re_string, check_props, dry_run,
+                    expected_stderr, check_props, dry_run,
                     '--reintegrate', tgt_dir)
 
 
@@ -266,7 +266,7 @@ def basic_reintegrate(sbox):
                                        k_expected_disk,
                                        k_expected_status,
                                        expected_skip,
-                                       None, True, True)
+                                       [], True, True)
 
   # Test issue #3640:
   #
@@ -323,7 +323,7 @@ def basic_reintegrate(sbox):
                                        k_expected_disk,
                                        expected_status,
                                        expected_skip,
-                                       None, True, True)
+                                       [], True, True)
 
 #----------------------------------------------------------------------
 @SkipUnless(server_has_mergeinfo)
@@ -550,7 +550,7 @@ def reintegrate_with_rename(sbox):
                                        k_expected_disk,
                                        k_expected_status,
                                        expected_skip,
-                                       None, True, True)
+                                       [], True, True)
 
   # Finally, commit the result of the merge (r10).
   expected_output = wc.State(wc_dir, {
@@ -682,7 +682,7 @@ def reintegrate_branch_never_merged_to(s
                                        k_expected_disk,
                                        k_expected_status,
                                        expected_skip,
-                                       None, True, True)
+                                       [], True, True)
 
   # Finally, commit the result of the merge (r9).
   expected_output = wc.State(wc_dir, {
@@ -714,10 +714,11 @@ def reintegrate_fail_on_modified_wc(sbox
   sbox.simple_commit()
 
   svntest.main.file_write(mu_path, "Changed on 'trunk' (the merge target).")
+  expected_skip =  wc.State(wc_dir, {})
   sbox.simple_update() # avoid mixed-revision error
   run_and_verify_reintegrate(
     A_path, sbox.repo_url + '/A_COPY', None, None, None,
-    None, None, None,
+    None, None, expected_skip,
     ".*Cannot merge into a working copy that has local modifications.*",
     True, False)
 
@@ -738,10 +739,11 @@ def reintegrate_fail_on_mixed_rev_wc(sbo
   expected_status.tweak('A/mu', wc_rev=7)
   svntest.actions.run_and_verify_commit(wc_dir, expected_output,
                                         expected_status)
+  expected_skip = wc.State(wc_dir, {})
   # Try merging into that same wc, expecting failure.
   run_and_verify_reintegrate(
     A_path, sbox.repo_url + '/A_COPY', None, None, None,
-    None, None, None,
+    None, None, expected_skip,
     ".*Cannot merge into mixed-revision working copy.*",
     True, False)
 
@@ -806,9 +808,10 @@ def reintegrate_fail_on_switched_wc(sbox
                                         [],
                                         False, '--ignore-ancestry')
   sbox.simple_update() # avoid mixed-revision error
+  expected_skip = wc.State(wc_dir, {})
   run_and_verify_reintegrate(
     A_path, sbox.repo_url + '/A_COPY', None, None, None,
-    None, None, None,
+    None, None, expected_skip,
     ".*Cannot merge into a working copy with a switched subtree.*",
     True, False)
 
@@ -889,7 +892,7 @@ def reintegrate_on_shallow_wc(sbox):
                                        expected_A_disk,
                                        expected_A_status,
                                        expected_A_skip,
-                                       None, 1, 1)
+                                       [], 1, 1)
 
   # Now revert the reintegrate and make a second change on the
   # branch in r4, but this time change a subtree that corresponds
@@ -926,7 +929,7 @@ def reintegrate_on_shallow_wc(sbox):
                                        expected_A_disk,
                                        expected_A_status,
                                        expected_A_skip,
-                                       None, 1, 1)
+                                       [], 1, 1)
 
 #----------------------------------------------------------------------
 @SkipUnless(server_has_mergeinfo)
@@ -1257,7 +1260,7 @@ def reintegrate_with_subtree_mergeinfo(s
                                        expected_A_disk,
                                        expected_A_status,
                                        expected_A_skip,
-                                       None, 1, 1)
+                                       [], 1, 1)
 
   # Make some more changes to A_COPY so that the same revisions have *not*
   # been uniformly applied from A to A_COPY.  In this case the reintegrate
@@ -1526,7 +1529,7 @@ def reintegrate_with_subtree_mergeinfo(s
                                        expected_A_disk,
                                        expected_A_status,
                                        expected_A_skip,
-                                       None, 1, 1)
+                                       [], 1, 1)
 
 #----------------------------------------------------------------------
 @SkipUnless(server_has_mergeinfo)
@@ -1683,7 +1686,7 @@ def multiple_reintegrates_from_the_same_
                                        expected_disk,
                                        expected_status,
                                        expected_skip,
-                                       None, 1, 1)
+                                       [], 1, 1)
   svntest.actions.run_and_verify_svn(None, [], 'ci', '-m',
                                      "2nd Reintegrate feature branch back to 'A'",
                                      wc_dir)
@@ -1839,7 +1842,7 @@ def reintegrate_with_self_referential_me
                                        expected_disk,
                                        expected_status,
                                        expected_skip,
-                                       None, 1, 0)
+                                       [], 1, 0)
 
 #----------------------------------------------------------------------
 # Test for issue #3577 '1.7 subtree mergeinfo recording breaks reintegrate'
@@ -1974,7 +1977,7 @@ def reintegrate_with_subtree_merges(sbox
                              expected_A_disk,
                              expected_A_status,
                              expected_A_skip,
-                             None, 1, 1)
+                             [], 1, 1)
 
   # Test issue #4329.  Revert previous merge and commit a new edit to
   # A/D/H/psi. Attempt the same merge without the --reintegrate option.
@@ -2189,7 +2192,7 @@ def added_subtrees_with_mergeinfo_break_
                                        expected_disk,
                                        expected_status,
                                        expected_skip,
-                                       None, 1, 1)
+                                       [], 1, 1)
 
 #----------------------------------------------------------------------
 # Test for issue #3648 '2-URL merges incorrectly reverse-merge mergeinfo
@@ -2434,7 +2437,7 @@ def reintegrate_creates_bogus_mergeinfo(
                                        expected_mergeinfo_output,
                                        expected_elision_output,
                                        expected_disk, None, expected_skip,
-                                       None,
+                                       [],
                                        1, 1)
 
 
@@ -2560,7 +2563,7 @@ def no_source_subtree_mergeinfo(sbox):
                                        expected_output, expected_mergeinfo,
                                        expected_elision, expected_disk,
                                        None, expected_skip,
-                                       None,
+                                       [],
                                        1, 1)
 
 #----------------------------------------------------------------------

Modified: subversion/trunk/subversion/tests/cmdline/merge_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/merge_tests.py?rev=1662866&r1=1662865&r2=1662866&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/merge_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/merge_tests.py Sat Feb 28 00:42:57 2015
@@ -2904,12 +2904,15 @@ def cherry_pick_text_conflict(sbox):
   expected_output = wc.State(A_path, {
     'mu'       : Item(status='C '),
     })
-  expected_mergeinfo_output = wc.State(A_path, {})
+  expected_mergeinfo_output = wc.State(A_path, {
+    ''          : Item(status=' G')
+    })
   expected_elision_output = wc.State(A_path, {
     })
   expected_disk = wc.State('', {
     'mu'        : Item("This is the file 'mu'.\n"
-                       + make_conflict_marker_text("r3\n" * 3, "r4\n" * 3, 3, 4)),
+                       + make_conflict_marker_text('', "r3\n" * 3 + "r4\n" * 3, 3, 4,
+                                                   old_text='r3\n' * 3)),
     'B'         : Item(),
     'B/lambda'  : Item("This is the file 'lambda'.\n"),
     'B/E'       : Item(),
@@ -2951,7 +2954,7 @@ def cherry_pick_text_conflict(sbox):
     })
   expected_status.tweak(wc_rev=2)
   expected_skip = wc.State('', { })
-  expected_error = "conflicts were produced while merging r3:4"
+  expected_error = ".*conflicts were produced while merging r3:4.*"
   svntest.actions.run_and_verify_merge(A_path, '3', '6', branch_A_url, None,
                                        expected_output,
                                        expected_mergeinfo_output,

Modified: subversion/trunk/subversion/tests/cmdline/resolve_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/resolve_tests.py?rev=1662866&r1=1662865&r2=1662866&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/resolve_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/resolve_tests.py Sat Feb 28 00:42:57 2015
@@ -539,7 +539,7 @@ def resolved_on_deleted_item(sbox):
                                        expected_mergeinfo_output,
                                        expected_elision_output,
                                        expected_disk, None, expected_skip,
-                                       None, dry_run = False)
+                                       [], dry_run = False)
   svntest.actions.run_and_verify_unquiet_status(A2, expected_status)
 
   # Now resolve by recursing on the working copy root.

Modified: subversion/trunk/subversion/tests/cmdline/special_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/special_tests.py?rev=1662866&r1=1662865&r2=1662866&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/special_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/special_tests.py Sat Feb 28 00:42:57 2015
@@ -577,8 +577,7 @@ def replace_symlink_with_dir(sbox):
 
   svntest.actions.load_repo(sbox, os.path.join(os.path.dirname(sys.argv[0]),
                                                'special_tests_data',
-                                               'symlink.dump'),
-                            create_wc=False)
+                                               'symlink.dump'))
 
   wc_dir = sbox.wc_dir
   from_path = os.path.join(wc_dir, 'from')

Modified: subversion/trunk/subversion/tests/cmdline/svntest/actions.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/actions.py?rev=1662866&r1=1662865&r2=1662866&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/actions.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/actions.py Sat Feb 28 00:42:57 2015
@@ -998,7 +998,7 @@ def run_and_verify_merge(dir, rev1, rev2
                          mergeinfo_output_tree,
                          elision_output_tree,
                          disk_tree, status_tree, skip_tree,
-                         error_re_string = None,
+                         expected_stderr = [],
                          check_props = False,
                          dry_run = True,
                          *args, **kw):
@@ -1008,11 +1008,6 @@ def run_and_verify_merge(dir, rev1, rev2
   If URL2 is None, run 'svn merge -rREV1:REV2 URL1 DIR'.  If both REV1
   and REV2 are None, leave off the '-r' argument.
 
-  If ERROR_RE_STRING, the merge must exit with error, and the error
-  message must match regular expression ERROR_RE_STRING.
-
-  Else if ERROR_RE_STRING is None, then:
-
   The subcommand output will be verified against OUTPUT_TREE.  Output
   related to mergeinfo notifications will be verified against
   MERGEINFO_OUTPUT_TREE if that is not None.  Output related to mergeinfo
@@ -1052,8 +1047,8 @@ def run_and_verify_merge(dir, rev1, rev2
     pre_disk = tree.build_tree_from_wc(dir)
     dry_run_command = merge_command + ('--dry-run',)
     dry_run_command = dry_run_command + args
-    exit_code, out_dry, err_dry = main.run_svn(error_re_string,
-                                               *dry_run_command)
+    exit_code, out_dry, err_dry = run_and_verify_svn(None, expected_stderr,
+                                                     *dry_run_command)
     post_disk = tree.build_tree_from_wc(dir)
     try:
       tree.compare_trees("disk", post_disk, pre_disk)
@@ -1066,16 +1061,7 @@ def run_and_verify_merge(dir, rev1, rev2
 
   # Update and make a tree of the output.
   merge_command = merge_command + args
-  exit_code, out, err = main.run_svn(error_re_string, *merge_command)
-
-  if error_re_string:
-    if not error_re_string.startswith(".*"):
-      error_re_string = ".*(" + error_re_string + ")"
-    expected_err = verify.RegexOutput(error_re_string, match_all=False)
-    verify.verify_outputs(None, None, err, None, expected_err)
-    return
-  elif err:
-    raise verify.SVNUnexpectedStderr(err)
+  exit_code, out, err = run_and_verify_svn(None, expected_stderr, *merge_command)
 
   # Split the output into that related to application of the actual diff
   # and that related to the recording of mergeinfo describing the merge.
@@ -2109,13 +2095,15 @@ def inject_conflict_into_expected_state(
   if expected_status:
     expected_status.tweak(state_path, status='C ')
 
-def make_conflict_marker_text(wc_text, merged_text, prev_rev, merged_rev):
+def make_conflict_marker_text(wc_text, merged_text, prev_rev, merged_rev,
+                              old_text=''):
   """Return the conflict marker text described by WC_TEXT (the current
   text in the working copy, MERGED_TEXT (the conflicting text merged
   in), and MERGED_REV (the revision from whence the conflicting text
   came)."""
   return "<<<<<<< .working\n" + wc_text + \
-         "||||||| .merge-left.r" + str(prev_rev) +  "\n=======\n" + \
+         "||||||| .merge-left.r" + str(prev_rev) + '\n' + \
+         old_text + "=======\n" + \
          merged_text + ">>>>>>> .merge-right.r" + str(merged_rev) +
"\n"
 
 

Modified: subversion/trunk/subversion/tests/cmdline/svntest/deeptrees.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/deeptrees.py?rev=1662866&r1=1662865&r2=1662866&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/deeptrees.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/deeptrees.py Sat Feb 28 00:42:57 2015
@@ -972,9 +972,14 @@ def deep_trees_run_tests_scheme_for_merg
       if ignore_ancestry:
         varargs = varargs + ('--ignore-ancestry',)
 
+      if test_case.error_re_string == None:
+        expected_stderr = []
+      else:
+        expected_stderr = test_case.error_re_string
+
       run_and_verify_merge(local, '0', 'HEAD', incoming, None,
                            x_out, None, None, x_disk, None, x_skip,
-                           test_case.error_re_string,
+                           expected_stderr,
                            False, False, *varargs)
       run_and_verify_unquiet_status(local, x_status)
     except:



Mime
View raw message