Author: danielsh
Date: Fri Feb 27 17:29:07 2015
New Revision: 1662756

URL: http://svn.apache.org/r1662756
Log:
backport.pl conflicts mode: Add an XFail regression test.

Found by: rhuijben

* tools/dist/backport_tests.py
  (make_entry, serialize_entry): Add 'depends' parameter.
  (backport_conflicts_detection): Extend test.
  (backport_double_conflict): New XFail test.

Modified:
    subversion/trunk/tools/dist/backport_tests.py

Modified: subversion/trunk/tools/dist/backport_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/tools/dist/backport_tests.py?rev=1662756&r1=1662755&r2=1662756&view=diff
==============================================================================
--- subversion/trunk/tools/dist/backport_tests.py (original)
+++ subversion/trunk/tools/dist/backport_tests.py Fri Feb 27 17:29:07 2015
@@ -110,7 +110,8 @@ class BackportTest(object):
       verify_backport(sbox, expected_dump_file, self.uuid)
     return wrapped_test_func
 
-def make_entry(revisions=None, logsummary=None, notes=None, branch=None, 
votes=None):
+def make_entry(revisions=None, logsummary=None, notes=None, branch=None,
+               depends=None, votes=None):
   assert revisions
   if logsummary is None:
     logsummary = "default logsummary"
@@ -122,6 +123,7 @@ def make_entry(revisions=None, logsummar
     'logsummary': logsummary,
     'notes': notes,
     'branch': branch,
+    'depends': depends,
     'votes': votes,
   }
 
@@ -143,6 +145,9 @@ def serialize_entry(entry):
     # branch
     '   Branch: %s\n' % (entry['branch'],) if entry['branch'] else '',
 
+    # depends
+    '   Depends: %s\n' % (entry['depends'],) if entry['depends'] else '',
+
     # votes
     '   Votes:\n',
     ''.join('     '
@@ -382,7 +387,11 @@ def backport_conflicts_detection(sbox):
                                            # Choose conflicts mode:
                                            ["MAY_COMMIT=0"])
 
-  # Verify
+  # Verify the conflict is detected.
+  expected_output = svntest.verify.RegexOutput(
+    'Index: iota',
+    match_all=False,
+  )
   expected_errput = (
     r'(?ms)' # re.MULTILINE | re.DOTALL
     r'.*Warning summary.*'
@@ -396,9 +405,25 @@ def backport_conflicts_detection(sbox):
                       ],
                       match_all=False)
   svntest.verify.verify_outputs(None, output, errput,
-                                svntest.verify.AnyOutput, expected_errput)
+                                expected_output, expected_errput)
   svntest.verify.verify_exit_code(None, exit_code, 1)
 
+  ## Now, let's test the "Depends:" annotation silences the error.
+
+  # Re-nominate.
+  approved_entries = [
+    make_entry([4], depends="World peace."),
+  ]
+  sbox.simple_append(STATUS, serialize_STATUS(approved_entries), truncate=True)
+  sbox.simple_commit(message='Re-nominate r4')
+
+  # Detect conflicts.
+  exit_code, output, errput = run_backport(sbox, extra_env=["MAY_COMMIT=0"])
+
+  # Verify stdout.  (exit_code and errput were verified by run_backport().)
+  svntest.verify.verify_outputs(None, output, errput,
+                                "Conflicts found.*, as expected.", [])
+
 
 #----------------------------------------------------------------------
 @BackportTest(None) # would be 000000000007
@@ -455,6 +480,60 @@ def backport_branch_contains(sbox):
 
 
 #----------------------------------------------------------------------
+@XFail()
+@BackportTest(None) # would be 000000000008
+def backport_double_conflict(sbox):
+  "two-revisioned entry with two conflicts"
+
+  # r6: conflicting change on branch
+  sbox.simple_append('branch/iota', 'Conflicts with first change')
+  sbox.simple_commit(message="Conflicting change on iota")
+
+  # r7: further conflicting change to same file
+  sbox.simple_update()
+  sbox.simple_append('subversion/trunk/iota', 'Third line\n')
+  sbox.simple_commit(message="iota's third line")
+
+  # r8: nominate
+  approved_entries = [
+    make_entry([4,7], depends="World peace.")
+  ]
+  sbox.simple_append(STATUS, serialize_STATUS(approved_entries))
+  sbox.simple_commit(message='Nominate the r4 group')
+
+  # Run it, in conflicts mode.
+  exit_code, output, errput = run_backport(sbox, True, ["MAY_COMMIT=0"])
+
+  # Verify the failure mode: "merge conflict" error on stderr, but backport.pl
+  # itself exits with code 0, since conflicts were confined to Depends:-ed
+  # entries.
+  #
+  # The error only happens with multi-pass merges where the first pass
+  # conflicts and the second pass touches the conflict victim.
+  #
+  # The error would be:
+  #    subversion/libsvn_client/merge.c:5499: 
(apr_err=SVN_ERR_WC_FOUND_CONFLICT)
+  #    svn: E155015: One or more conflicts were produced while merging r3:4
+  #    into '/tmp/stw/working_copies/backport_tests-8/branch' -- resolve all
+  #    conflicts and rerun the merge to apply the remaining unmerged revisions
+  #    ...
+  #    Warning summary
+  #    ===============
+  #    
+  #    r4 (default logsummary): subshell exited with code 256
+  # And backport.pl would exit with exit code 1.
+
+  expected_output = 'Conflicts found.*, as expected.'
+  expected_errput = svntest.verify.RegexOutput(
+      ".*svn: E155015:.*", # SVN_ERR_WC_FOUND_CONFLICT
+      match_all=False,
+  )
+  svntest.verify.verify_outputs(None, output, errput,
+                                expected_output, expected_errput)
+  svntest.verify.verify_exit_code(None, exit_code, 0)
+
+
+#----------------------------------------------------------------------
 
 ########################################################################
 # Run the tests
@@ -468,6 +547,7 @@ test_list = [ None,
               backport_multirevisions,
               backport_conflicts_detection,
               backport_branch_contains,
+              backport_double_conflict,
               # When adding a new test, include the test number in the last
               # 6 bytes of the UUID.
              ]


Reply via email to