All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, armbru@redhat.com, mreitz@redhat.com
Subject: Re: [Qemu-devel] [PATCH] tests/check-qdict: Fix missing brackets
Date: Thu, 6 Apr 2017 16:52:53 +0100	[thread overview]
Message-ID: <20170406155253.GB18315@work-vm> (raw)
In-Reply-To: <48d5bb0d-25a9-365c-04fa-e3dad7ecf6e8@redhat.com>

* Eric Blake (eblake@redhat.com) wrote:
> On 04/06/2017 10:41 AM, Dr. David Alan Gilbert (git) wrote:
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> > 
> > Gcc 7 (on Fedora 26) spotted odd use of integers instead of a
> > boolean; it's got a point.
> > 
> > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > ---
> >  tests/check-qdict.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tests/check-qdict.c b/tests/check-qdict.c
> > index 81162ee572..6f3fbcf9c1 100644
> > --- a/tests/check-qdict.c
> > +++ b/tests/check-qdict.c
> > @@ -559,7 +559,7 @@ static void qdict_join_test(void)
> >          g_assert(qdict_size(dict1) == 2);
> >          g_assert(qdict_size(dict2) == !overwrite);
> >  
> > -        g_assert(qdict_get_int(dict1, "foo") == overwrite ? 84 : 42);
> > +        g_assert(qdict_get_int(dict1, "foo") == (overwrite ? 84 : 42));
> 
> How is the test passing pre-patch, and why does it not change the test
> post-patch?  Does that mean that overwrite is not doing what we expected?

Pre-patch it passes because either 84 or 42  are valid 'true' values into g_assert.
Post patch it ends up as either:
    qdict_get_int(dict1, "foo") == 42
or
    qdict_get_int(dict1, "foo") == 84

which is what's intended.

Dave

> -- 
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
> 



--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2017-04-06 15:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-06 15:41 [Qemu-devel] [PATCH] tests/check-qdict: Fix missing brackets Dr. David Alan Gilbert (git)
2017-04-06 15:49 ` Eric Blake
2017-04-06 15:52   ` Dr. David Alan Gilbert [this message]
2017-04-06 15:55   ` [Qemu-devel] [PATCH for-2.9?] " Eric Blake
2017-04-07 21:27     ` Philippe Mathieu-Daudé
2017-04-12  9:04 ` [Qemu-devel] [PATCH] " Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170406155253.GB18315@work-vm \
    --to=dgilbert@redhat.com \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.