You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ds...@apache.org on 2022/01/16 19:19:37 UTC

svn commit: r1897133 - /subversion/trunk/subversion/tests/cmdline/log_tests.py

Author: dsahlberg
Date: Sun Jan 16 19:19:36 2022
New Revision: 1897133

URL: http://svn.apache.org/viewvc?rev=1897133&view=rev
Log:
Add a test for issue #4856, "invalid xml file produced by: svn log --xml
--use-merge-history".

Based on reproduction reciept by Daniel Shahaf

* subversion/tests/cmdline/log_tests.py
  (log_xml_with_merge_history): New test.
  (test_list): Run it.

Suggested by: danielsh


Modified:
    subversion/trunk/subversion/tests/cmdline/log_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/log_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/log_tests.py?rev=1897133&r1=1897132&r2=1897133&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/log_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/log_tests.py Sun Jan 16 19:19:36 2022
@@ -2816,6 +2816,59 @@ def log_with_merge_history_and_search(sb
   if count(output, "<logentry") != count(output, "</logentry"):
     raise svntest.Failure("Apparently invalid XML in " + repr(output))
 
+@XFail()
+@Issue(4856)
+def log_xml_with_merge_history(sbox):
+  "log --use-merge-history --xml"
+  
+  sbox.build()
+
+  # r2-r4: create branches
+  sbox.simple_repo_copy('A', 'A2')
+  sbox.simple_repo_copy('A', 'A3')
+  sbox.simple_repo_copy('A', 'A4')
+
+  # r5: mod in trunk
+  sbox.simple_append('A/mu', 'line 2')
+  sbox.simple_commit(message='r5: mod')
+  sbox.simple_update()
+
+  # r6-r7: merge A=>A2, A2=>A3
+  svntest.main.run_svn(None, 'merge', '-c', '5', sbox.repo_url + '/A', sbox.ospath('A2'))
+  sbox.simple_commit(message='r6: merge A=>A2')
+  sbox.simple_update()
+  svntest.main.run_svn(None, 'merge', '-c', '6', sbox.repo_url + '/A2', sbox.ospath('A3'))
+  sbox.simple_commit(message='r7: merge A2=>A3')
+  sbox.simple_update()
+
+  # r8: add file in A3
+  xi_path = os.path.join(sbox.wc_dir, 'A3/xi')
+  svntest.main.file_write(xi_path, "This is the file 'A3/xi'.\n")
+  svntest.main.run_svn(None, 'add', xi_path)
+  sbox.simple_commit(message='r8: add A3/xi')
+  sbox.simple_update()
+
+  # r9: merge A3=>A4
+  svntest.main.run_svn(None, 'merge', '-r', '6:8', sbox.repo_url + '/A3', sbox.ospath('A4'))
+  sbox.simple_commit(message='r9: merge A3=>A4')
+  sbox.simple_update()
+
+  # Helper function
+  def count(haystack, needle):
+    """Return the number of times the string NEEDLE occurs in the string
+    HAYSTACK."""
+    return len(haystack.split(needle)) - 1
+
+  # Check the output is valid
+  # ### Since the test is currently XFail, we only smoke test the output.
+  # ### When fixing this test to PASS, extend this validation.
+  _, output, _ = svntest.main.run_svn(None, 'log', '--xml', '-g', '-r', '8:9',
+                                      sbox.ospath('A4'))
+
+  output = '\n'.join(output)
+  if count(output, "<logentry") != count(output, "</logentry"):
+    raise svntest.Failure("Apparently invalid XML in " + repr(output))
+
 ########################################################################
 # Run the tests
 
@@ -2867,6 +2920,7 @@ test_list = [ None,
               log_revision_move_copy,
               log_on_deleted_deep,
               log_with_merge_history_and_search,
+              log_xml_with_merge_history,
              ]
 
 if __name__ == '__main__':



Re: svn commit: r1897133 - /subversion/trunk/subversion/tests/cmdline/log_tests.py

Posted by Julian Foad <ju...@foad.me.uk>.
Julian Foad wrote:
> I DO confirm
> 
> XPASS: log_tests.py 47: log --use-merge-history --xml
> 
> with RA-svn/serf on trunk.

(That's today's trunk with your 'str/unicode/...' check line removed.)

Re: svn commit: r1897133 - /subversion/trunk/subversion/tests/cmdline/log_tests.py

Posted by Julian Foad <ju...@foad.me.uk>.
Julian Foad wrote:
> I DO confirm
> 
> XPASS: log_tests.py 47: log --use-merge-history --xml
> 
> with RA-svn/serf on trunk.

(That's today's trunk with your 'str/unicode/...' check line removed.)

Re: svn commit: r1897133 - /subversion/trunk/subversion/tests/cmdline/log_tests.py

Posted by Daniel Sahlberg <da...@gmail.com>.
Den tis 25 jan. 2022 kl 15:40 skrev Daniel Shahaf <d....@daniel.shahaf.name>:

> Daniel Sahlberg wrote on Tue, 25 Jan 2022 13:29 +00:00:
> > Oh. That is interesting, I never thought about running the checks on svn
> > and dav. Is there a way to flag the test as "only xfails on local", and
> can
> > someone help me do this? I'm a bit short on time right now.
>
> r1897457.
>

Thanks!

/Daniel

Re: svn commit: r1897133 - /subversion/trunk/subversion/tests/cmdline/log_tests.py

Posted by Daniel Sahlberg <da...@gmail.com>.
Den tis 25 jan. 2022 kl 15:40 skrev Daniel Shahaf <d....@daniel.shahaf.name>:

> Daniel Sahlberg wrote on Tue, 25 Jan 2022 13:29 +00:00:
> > Oh. That is interesting, I never thought about running the checks on svn
> > and dav. Is there a way to flag the test as "only xfails on local", and
> can
> > someone help me do this? I'm a bit short on time right now.
>
> r1897457.
>

Thanks!

/Daniel

Re: svn commit: r1897133 - /subversion/trunk/subversion/tests/cmdline/log_tests.py

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Daniel Sahlberg wrote on Tue, 25 Jan 2022 13:29 +00:00:
> Oh. That is interesting, I never thought about running the checks on svn
> and dav. Is there a way to flag the test as "only xfails on local", and can
> someone help me do this? I'm a bit short on time right now.

r1897457.

Cheers,

Daniel

Re: svn commit: r1897133 - /subversion/trunk/subversion/tests/cmdline/log_tests.py

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Daniel Sahlberg wrote on Tue, 25 Jan 2022 13:29 +00:00:
> Oh. That is interesting, I never thought about running the checks on svn
> and dav. Is there a way to flag the test as "only xfails on local", and can
> someone help me do this? I'm a bit short on time right now.

r1897457.

Cheers,

Daniel

Re: svn commit: r1897133 - /subversion/trunk/subversion/tests/cmdline/log_tests.py

Posted by Daniel Sahlberg <da...@gmail.com>.
Den tis 25 jan. 2022 kl 14:21 skrev Julian Foad <ju...@foad.me.uk>:

>
>
> On Jan 25 2022, at 1:15 pm, Julian Foad <ju...@foad.me.uk> wrote:
>
> > Daniel Shahaf wrote:
> >> dsahlberg@apache.org wrote on Sun, 16 Jan 2022 19:19 +00:00:
> >>> Add a test for issue #4856, "invalid xml file produced by: svn log
> --xml
> >>> --use-merge-history".
> >>
> >> The new test XFails for me over ra_local but XPasses over
> >> svnserveautocheck and davautocheck.
> >
> > On the 'pristines-on-demand' branch I get XFAIL over all three
>
> Oops, no, that was the wrong test ('log --use-merge-history --search
> [#4711]').
>
> I DO confirm
>
> XPASS: log_tests.py 47: log --use-merge-history --xml


> with RA-svn/serf on trunk.
>

Oh. That is interesting, I never thought about running the checks on svn
and dav. Is there a way to flag the test as "only xfails on local", and can
someone help me do this? I'm a bit short on time right now.

Thanks,
Daniel Sahlberg

Re: svn commit: r1897133 - /subversion/trunk/subversion/tests/cmdline/log_tests.py

Posted by Daniel Sahlberg <da...@gmail.com>.
Den tis 25 jan. 2022 kl 14:21 skrev Julian Foad <ju...@foad.me.uk>:

>
>
> On Jan 25 2022, at 1:15 pm, Julian Foad <ju...@foad.me.uk> wrote:
>
> > Daniel Shahaf wrote:
> >> dsahlberg@apache.org wrote on Sun, 16 Jan 2022 19:19 +00:00:
> >>> Add a test for issue #4856, "invalid xml file produced by: svn log
> --xml
> >>> --use-merge-history".
> >>
> >> The new test XFails for me over ra_local but XPasses over
> >> svnserveautocheck and davautocheck.
> >
> > On the 'pristines-on-demand' branch I get XFAIL over all three
>
> Oops, no, that was the wrong test ('log --use-merge-history --search
> [#4711]').
>
> I DO confirm
>
> XPASS: log_tests.py 47: log --use-merge-history --xml


> with RA-svn/serf on trunk.
>

Oh. That is interesting, I never thought about running the checks on svn
and dav. Is there a way to flag the test as "only xfails on local", and can
someone help me do this? I'm a bit short on time right now.

Thanks,
Daniel Sahlberg

Re: svn commit: r1897133 - /subversion/trunk/subversion/tests/cmdline/log_tests.py

Posted by Julian Foad <ju...@foad.me.uk>.

On Jan 25 2022, at 1:15 pm, Julian Foad <ju...@foad.me.uk> wrote:

> Daniel Shahaf wrote:
>> dsahlberg@apache.org wrote on Sun, 16 Jan 2022 19:19 +00:00:
>>> Add a test for issue #4856, "invalid xml file produced by: svn log --xml
>>> --use-merge-history".
>> 
>> The new test XFails for me over ra_local but XPasses over
>> svnserveautocheck and davautocheck.
> 
> On the 'pristines-on-demand' branch I get XFAIL over all three

Oops, no, that was the wrong test ('log --use-merge-history --search [#4711]').

I DO confirm

XPASS: log_tests.py 47: log --use-merge-history --xml

with RA-svn/serf on trunk.

- Julian


Re: svn commit: r1897133 - /subversion/trunk/subversion/tests/cmdline/log_tests.py

Posted by Julian Foad <ju...@foad.me.uk>.

On Jan 25 2022, at 1:15 pm, Julian Foad <ju...@foad.me.uk> wrote:

> Daniel Shahaf wrote:
>> dsahlberg@apache.org wrote on Sun, 16 Jan 2022 19:19 +00:00:
>>> Add a test for issue #4856, "invalid xml file produced by: svn log --xml
>>> --use-merge-history".
>> 
>> The new test XFails for me over ra_local but XPasses over
>> svnserveautocheck and davautocheck.
> 
> On the 'pristines-on-demand' branch I get XFAIL over all three

Oops, no, that was the wrong test ('log --use-merge-history --search [#4711]').

I DO confirm

XPASS: log_tests.py 47: log --use-merge-history --xml

with RA-svn/serf on trunk.

- Julian


Re: svn commit: r1897133 - /subversion/trunk/subversion/tests/cmdline/log_tests.py

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Julian Foad wrote on Tue, 25 Jan 2022 13:15 +00:00:
> On a trunk WC (updated today) I get:
>
>   File "/home/julianfoad/src/subversion-d/subversion/tests/cmdline/svntest/main.py", line 619, in <genexpr>
>     assert all(isinstance(arg, (str, unicode, int)) for arg in varargs)
> NameError: name 'unicode' is not defined
>
> This is on Ubuntu 21.10 with Python 3.9. Is the 'unicode' class name too
> old or too new for this Python?

Yes:

$ python2 -c 'print(type(""), type(b""), type(u""))' 
(<type 'str'>, <type 'str'>, <type 'unicode'>)
$ python3 -c 'print(type(""), type(b""), type(u""))' 
<class 'str'> <class 'bytes'> <class 'str'>

So, I think changing the check to «isinstance(arg, (type(b""),
type(u""), int))» would work on both py2 and py3.  We can't just remove
«unicode» from there because that'd break svnrdump_tests under py2.

Incidentally, Python 2 has separate «int» and «long» types (e.g, 2**63
evaluates to a «long») whereas Python 3 has only «int», but that's easy
to handle one way or another.

Thanks for the confirmation elsethread.

Cheers,

Daniel

Re: svn commit: r1897133 - /subversion/trunk/subversion/tests/cmdline/log_tests.py

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Julian Foad wrote on Tue, 25 Jan 2022 13:15 +00:00:
> On a trunk WC (updated today) I get:
>
>   File "/home/julianfoad/src/subversion-d/subversion/tests/cmdline/svntest/main.py", line 619, in <genexpr>
>     assert all(isinstance(arg, (str, unicode, int)) for arg in varargs)
> NameError: name 'unicode' is not defined
>
> This is on Ubuntu 21.10 with Python 3.9. Is the 'unicode' class name too
> old or too new for this Python?

Yes:

$ python2 -c 'print(type(""), type(b""), type(u""))' 
(<type 'str'>, <type 'str'>, <type 'unicode'>)
$ python3 -c 'print(type(""), type(b""), type(u""))' 
<class 'str'> <class 'bytes'> <class 'str'>

So, I think changing the check to «isinstance(arg, (type(b""),
type(u""), int))» would work on both py2 and py3.  We can't just remove
«unicode» from there because that'd break svnrdump_tests under py2.

Incidentally, Python 2 has separate «int» and «long» types (e.g, 2**63
evaluates to a «long») whereas Python 3 has only «int», but that's easy
to handle one way or another.

Thanks for the confirmation elsethread.

Cheers,

Daniel

Re: svn commit: r1897133 - /subversion/trunk/subversion/tests/cmdline/log_tests.py

Posted by Julian Foad <ju...@foad.me.uk>.
Daniel Shahaf wrote:
> dsahlberg@apache.org wrote on Sun, 16 Jan 2022 19:19 +00:00:
>> Add a test for issue #4856, "invalid xml file produced by: svn log --xml
>> --use-merge-history".
> 
> The new test XFails for me over ra_local but XPasses over
> svnserveautocheck and davautocheck.

On the 'pristines-on-demand' branch I get XFAIL over all three, with
this being the failure message in each case:

EXCEPTION: Failure: Apparently invalid XML in '<?xml version="1.0" encoding="UTF-8"?>\n\n<log>\n\n</logentry>\n\n</log>\n'

On a trunk WC (updated today) I get:

  File
"/home/julianfoad/src/subversion-d/subversion/tests/cmdline/svntest/main.py",
line 619, in <genexpr>
    assert all(isinstance(arg, (str, unicode, int)) for arg in varargs)
NameError: name 'unicode' is not defined

This is on Ubuntu 21.10 with Python 3.9. Is the 'unicode' class name too
old or too new for this Python?

Oh... I see you added that line just today! r1897452.

- Julian


Re: svn commit: r1897133 - /subversion/trunk/subversion/tests/cmdline/log_tests.py

Posted by Julian Foad <ju...@foad.me.uk>.
Daniel Shahaf wrote:
> dsahlberg@apache.org wrote on Sun, 16 Jan 2022 19:19 +00:00:
>> Add a test for issue #4856, "invalid xml file produced by: svn log --xml
>> --use-merge-history".
> 
> The new test XFails for me over ra_local but XPasses over
> svnserveautocheck and davautocheck.

On the 'pristines-on-demand' branch I get XFAIL over all three, with
this being the failure message in each case:

EXCEPTION: Failure: Apparently invalid XML in '<?xml version="1.0" encoding="UTF-8"?>\n\n<log>\n\n</logentry>\n\n</log>\n'

On a trunk WC (updated today) I get:

  File
"/home/julianfoad/src/subversion-d/subversion/tests/cmdline/svntest/main.py",
line 619, in <genexpr>
    assert all(isinstance(arg, (str, unicode, int)) for arg in varargs)
NameError: name 'unicode' is not defined

This is on Ubuntu 21.10 with Python 3.9. Is the 'unicode' class name too
old or too new for this Python?

Oh... I see you added that line just today! r1897452.

- Julian


Re: svn commit: r1897133 - /subversion/trunk/subversion/tests/cmdline/log_tests.py

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
dsahlberg@apache.org wrote on Sun, 16 Jan 2022 19:19 +00:00:
> Add a test for issue #4856, "invalid xml file produced by: svn log --xml
> --use-merge-history".
⋮
> * subversion/tests/cmdline/log_tests.py
>   (log_xml_with_merge_history): New test.
>   (test_list): Run it.

The new test XFails for me over ra_local but XPasses over
svnserveautocheck and davautocheck.

As we have no buildbots[1], could someone confirm?

Cheers,

Daniel


[1] See the "Buildbot migration" thread and INFRA-22761; current bottom
    line: waiting for Infra or someone with an apache.org account to
    edit and enable the buildbot configuration.

Re: svn commit: r1897133 - /subversion/trunk/subversion/tests/cmdline/log_tests.py

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
dsahlberg@apache.org wrote on Sun, 16 Jan 2022 19:19 +00:00:
> Add a test for issue #4856, "invalid xml file produced by: svn log --xml
> --use-merge-history".
⋮
> * subversion/tests/cmdline/log_tests.py
>   (log_xml_with_merge_history): New test.
>   (test_list): Run it.

The new test XFails for me over ra_local but XPasses over
svnserveautocheck and davautocheck.

As we have no buildbots[1], could someone confirm?

Cheers,

Daniel


[1] See the "Buildbot migration" thread and INFRA-22761; current bottom
    line: waiting for Infra or someone with an apache.org account to
    edit and enable the buildbot configuration.