From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jim Fehlig Subject: Re: [PATCH V3 1/5] util: Introduce virJSONStringCompare for JSON doc comparisons Date: Thu, 11 Sep 2014 15:57:18 -0600 Message-ID: <54121ABE.20002__47189.8678727031$1410472775$gmane$org@suse.com> References: <1409800059-16884-1-git-send-email-jfehlig@suse.com> <1409800059-16884-2-git-send-email-jfehlig@suse.com> <20140911104519.GA7035@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20140911104519.GA7035@redhat.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: "Daniel P. Berrange" Cc: libvir-list@redhat.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org Daniel P. Berrange wrote: > On Wed, Sep 03, 2014 at 09:07:35PM -0600, Jim Fehlig wrote: > >> From: "Daniel P. Berrange" >> >> 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 >> Signed-off-by: Jim Fehlig >> --- >> 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