Bug 158423 - CppunitTest_unoxml_domtest failing with libxml-2.12
Summary: CppunitTest_unoxml_domtest failing with libxml-2.12
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
7.6.3.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Dev-related
  Show dependency treegraph
 
Reported: 2023-11-28 19:02 UTC by Gwyn Ciesla
Modified: 2024-01-05 20:37 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gwyn Ciesla 2023-11-28 19:02:29 UTC
Description:
Following fixes to build with libxml 2.12, this test fails.  Log:

[_RUN_____] (anonymous namespace)::SerializerTest::serializerTest
/builddir/build/BUILD/libreoffice-7.6.3.2/unoxml/qa/unit/domtest.cxx:334:(anonymous namespace)::SerializerTest::serializerTest
assertion failed
- Expression: false
- Valid input file did not result in XDocument (exception thrown)
(anonymous namespace)::SerializerTest::serializerTest finished in: 0ms
domtest.cxx:224:Assertion
Test name: (anonymous namespace)::BasicTest::validInputTest
assertion failed
- Expression: false
- Valid input file did not result in XDocument (exception thrown)
domtest.cxx:238:Assertion
Test name: (anonymous namespace)::BasicTest::warningInputTest
assertion failed
- Expression: false
- Valid input file did not result in XDocument #2 (exception thrown)
domtest.cxx:334:Assertion
Test name: (anonymous namespace)::SerializerTest::serializerTest
assertion failed
- Expression: false
- Valid input file did not result in XDocument (exception thrown)
Failures !!!
Run: 4   Failure total: 3   Failures: 3   Errors: 0

Actual Results:
[_RUN_____] (anonymous namespace)::SerializerTest::serializerTest
/builddir/build/BUILD/libreoffice-7.6.3.2/unoxml/qa/unit/domtest.cxx:334:(anonymous namespace)::SerializerTest::serializerTest
assertion failed
- Expression: false
- Valid input file did not result in XDocument (exception thrown)
(anonymous namespace)::SerializerTest::serializerTest finished in: 0ms
domtest.cxx:224:Assertion
Test name: (anonymous namespace)::BasicTest::validInputTest
assertion failed
- Expression: false
- Valid input file did not result in XDocument (exception thrown)
domtest.cxx:238:Assertion
Test name: (anonymous namespace)::BasicTest::warningInputTest
assertion failed
- Expression: false
- Valid input file did not result in XDocument #2 (exception thrown)
domtest.cxx:334:Assertion
Test name: (anonymous namespace)::SerializerTest::serializerTest
assertion failed
- Expression: false
- Valid input file did not result in XDocument (exception thrown)
Failures !!!
Run: 4   Failure total: 3   Failures: 3   Errors: 0

Expected Results:
Test passes


Reproducible: Always


User Profile Reset: No

Additional Info:
Complete log: https://kojipkgs.fedoraproject.org//work/tasks/2557/109622557/build.log
Comment 1 Gwyn Ciesla 2023-12-07 16:37:57 UTC
Still occurs on 7.6.4.1.
Comment 2 Buovjaga 2023-12-23 14:36:52 UTC
(In reply to Gwyn Ciesla from comment #0)
> Complete log:
> https://kojipkgs.fedoraproject.org//work/tasks/2557/109622557/build.log

The link is 404.

I noticed there is a patch:
https://gerrit.libreoffice.org/c/libvisio/+/160542
tests: Fix build with libxml 2.12
libxml 2.12.0 reorganized the headers, which removed `xmlParseMemory` function from the scope.

Gwyn: can you try, if the fix for unoxml/qa/unit/domtest.cxx would be likewise simple?
Comment 3 Buovjaga 2023-12-23 18:00:28 UTC
Ah, now Jan gave more info in the patch (which I merged):

Yes, the header clean-ups broke too many projects (see https://github.com/NixOS/nixpkgs/pull/269060#issuecomment-1837213807 for a partial list of projects needing similar patches), so 2.12.3 reintroduced the cyclic reference between headers.

The patch is therefore not strictly necessary any more. But it is probably still a good idea to include proper header for each symbol rather than relying on transitive includes.
Comment 4 Rene Engelhard 2023-12-25 21:47:36 UTC
how should a simple include help with *running the test*?

I mean, the *build* already was fixed with https://cgit.freedesktop.org/libreoffice/core/commit/?id=c8f7408db73d2f2ccacb25a2b4fef8dfebdfc6cb out of https://bugs.documentfoundation.org/show_bug.cgi?id=158302

But one can try, I don't have much hope there, though.

Confirming btw. (Also in 24.2)
Comment 5 Rene Engelhard 2023-12-25 22:09:33 UTC
(In reply to Buovjaga from comment #2)
> (In reply to Gwyn Ciesla from comment #0)
> > Complete log:
> > https://kojipkgs.fedoraproject.org//work/tasks/2557/109622557/build.log
> 
> The link is 404.
> 
> I noticed there is a patch:
> https://gerrit.libreoffice.org/c/libvisio/+/160542
> tests: Fix build with libxml 2.12
> libxml 2.12.0 reorganized the headers, which removed `xmlParseMemory`
> function from the scope.
> 
> Gwyn: can you try, if the fix for unoxml/qa/unit/domtest.cxx would be
> likewise simple?

btw, except this warning

importtest.cpp: In function 'librevenge::RVNGString {anonymous}::getXPathContent(xmlDocPtr, const librevenge::RVNGString&)':
importtest.cpp:149:3: warning: case value '5' not in enumerated type 'xmlXPathObjectType' [-Wswitch]
  149 |   case XPATH_POINT:
      |   ^~~~
importtest.cpp:150:3: warning: case value '6' not in enumerated type 'xmlXPathObjectType' [-Wswitch]
  150 |   case XPATH_RANGE:
      |   ^~~~
importtest.cpp:151:3: warning: case value '7' not in enumerated type 'xmlXPathObjectType' [-Wswitch]
  151 |   case XPATH_LOCATIONSET:
      |   ^~~~

libvisio actually builds and the tests *do* run with libxml2 2.12. Just  tried here. Th e commit you mentioned btw doesn't actually change the warning.
Comment 6 Rene Engelhard 2023-12-25 22:34:35 UTC
Ah, nevermind, that is because our libxml2 is 2.12.3..
Comment 7 Rene Engelhard 2023-12-25 22:35:34 UTC
which means, because my tests ARE with 2.12.3, is that adding a simple header won't have an effect to *running the test* anyways.
Comment 8 Rene Engelhard 2023-12-26 11:35:11 UTC
ene@frodo:~/LibreOffice/git/libreoffice-24-2/unoxml$ git diff .
diff --git a/unoxml/CppunitTest_unoxml_domtest.mk b/unoxml/CppunitTest_unoxml_domtest.mk
index e6a6b2959d67..8f5a3573f5a8 100644
--- a/unoxml/CppunitTest_unoxml_domtest.mk
+++ b/unoxml/CppunitTest_unoxml_domtest.mk
@@ -27,6 +27,7 @@ $(eval $(call gb_CppunitTest_use_components,unoxml_domtest,\
 
 $(eval $(call gb_CppunitTest_use_externals,unoxml_domtest, \
     boost_headers \
+    libxml2 \
 ))
 
 $(eval $(call gb_CppunitTest_use_libraries,unoxml_domtest, \
diff --git a/unoxml/qa/unit/domtest.cxx b/unoxml/qa/unit/domtest.cxx
index 479ff3fea697..4f715fd342cb 100644
--- a/unoxml/qa/unit/domtest.cxx
+++ b/unoxml/qa/unit/domtest.cxx
@@ -32,6 +32,8 @@
 #include <com/sun/star/xml/sax/XFastSAXSerializable.hpp>
 #include <com/sun/star/xml/sax/SAXParseException.hpp>
 
+#include <libxml/parser.h>
+
 using namespace ::comphelper;
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;

expectedly DOES NOT fix it. (First one is needed because somehow nothing in unoxml uses libxml directly so the include doesn't get found.)

Since libxml2 is not used here anyway - this means the problem actually is outside of unoxml? sax, maybe?
Comment 9 Caolán McNamara 2024-01-05 11:38:11 UTC
The SerializerTest unoxml domtest failure should be fixed now with:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=cbb17a548b5cc6a99b6ed7735479bb4f2bc40f26
Comment 10 Caolán McNamara 2024-01-05 11:42:14 UTC
Seeing as I was now able to upgrade the internal libxml2 to latest 2.12 I think this is now fixed. Backport of the test failure fixed to 7-6 at:
https://gerrit.libreoffice.org/c/core/+/161643

https://gerrit.libreoffice.org/c/core/+/161598 was the internal update effort FWIW
Comment 11 Gwyn Ciesla 2024-01-05 20:37:37 UTC
Thank you!