After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 788960 - Fix the XML test
Fix the XML test
Status: RESOLVED FIXED
Product: librest
Classification: Platform
Component: other
git master
Other All
: Normal normal
: ---
Assigned To: librest-maint
librest-maint
Depends on:
Blocks:
 
 
Reported: 2017-10-13 17:28 UTC by Debarshi Ray
Modified: 2017-10-16 12:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
xml-node: Remove stray blank space (942 bytes, patch)
2017-10-13 17:32 UTC, Debarshi Ray
committed Details | Review
xml-node: Unbreak the creation of top-level nodes (967 bytes, patch)
2017-10-13 17:33 UTC, Debarshi Ray
committed Details | Review
xml-node: Define the order in which attributes & children are printed (2.52 KB, patch)
2017-10-13 17:33 UTC, Debarshi Ray
committed Details | Review
tests: Re-enable the XML test (800 bytes, patch)
2017-10-13 17:33 UTC, Debarshi Ray
committed Details | Review

Description Debarshi Ray 2017-10-13 17:28:51 UTC
The XML test in tests/xml.c has been known to be broken for a while. There have been some minor aggravations recently, but the fundamental problem is that rest_xml_node_print's output is tied to the GHashTable implementation.

Here's how it fails with librest-0.8.0:
** (process:31623): ERROR **: Generated output for parsed XML does not match:
in:  <node0 a00='v00' a01='v01'><node1 a10='v10'></node1><node1 a10='v10'></node1>Cont0</node0>
out: <node0 a01='v01' a00='v00'><node1 a10='v10'></node1><node1 a10='v10'></node1>Cont0</node0>

It uses GHashTableIter to iterate over the various hash tables and directly prints each key-value pair. The order in which a GHashTable is iterated isn't defined, which makes rest_xml_node_print a bad fit for our test suite. It would be nice if the order in which it traverses a node stays stable for a given librest version, as opposed to changing with the glib version. That'll at least let us use it in our test suite, even if we don't document the behaviour as an API contract.
Comment 1 Debarshi Ray 2017-10-13 17:32:58 UTC
Created attachment 361548 [details] [review]
xml-node: Remove stray blank space
Comment 2 Debarshi Ray 2017-10-13 17:33:11 UTC
Created attachment 361549 [details] [review]
xml-node: Unbreak the creation of top-level nodes
Comment 3 Debarshi Ray 2017-10-13 17:33:25 UTC
Created attachment 361550 [details] [review]
xml-node: Define the order in which attributes & children are printed
Comment 4 Debarshi Ray 2017-10-13 17:33:37 UTC
Created attachment 361551 [details] [review]
tests: Re-enable the XML test
Comment 5 Christophe Fergeau 2017-10-16 10:37:35 UTC
Thanks a lot for tackling this, looks good to me, ack series.
Comment 6 Debarshi Ray 2017-10-16 12:58:23 UTC
Thanks for the reviews, Christophe! Pushed to master.