[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH V3 1/5] util: Introduce virJSONStringCompare for JSON doc comparisons



Daniel P. Berrange wrote:
> On Wed, Sep 03, 2014 at 09:07:35PM -0600, Jim Fehlig wrote:
>   
>> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
>>
>> Comparing JSON docs using strcmp is simple, but is not flexible
>> as it is sensitive to whitespace used in the doc generation.
>> When comparing objects it may also be desirable to treat the
>> existance of keys in the actual object but not expected object
>> as non-fatal. Introduce a virJSONStringCompare function which
>> takes two strings representing expected and actual JSON docs
>> and then does a DOM comparison.  Comparison is controled with
>> the ignore_contexts and flags parameters.  No comparison is
>> done on context paths specified in ignore_contexts.  The
>> VIR_JSON_COMPARE_IGNORE_EXPECTED_NULL flag can be used to
>> ignore actual values that have changed from an expected value
>> of null.
>>
>> Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
>> Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxx>
>> ---
>>  src/libvirt_private.syms |   1 +
>>  src/util/virjson.c       | 242 
>> +++++++++++++++++++++++++++++++++++++++++++++++
>>  src/util/virjson.h       |  16 ++++
>>  3 files changed, 259 insertions(+)
>>     
>
> Looks good, but perhaps we should also add to tests/virjsontest.c
> to verify the ignore context support is working as intended
>   

Yes, good idea.  I'll include that in V4.

Regards,
Jim


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.