qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Daniel P. Berrange" <berrange@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	Anand Avati <aavati@redhat.com>,
	Vijay Bellur <vbellur@redhat.com>,
	Stefan Hajnoczi <stefanha@gmail.com>,
	Harsh Bora <harsh@linux.vnet.ibm.com>,
	Amar Tumballi <amarts@redhat.com>,
	qemu-devel@nongnu.org, "Richard W.M. Jones" <rjones@redhat.com>,
	Blue Swirl <blauwirbel@gmail.com>, Avi Kivity <avi@redhat.com>,
	Bharata B Rao <bharata@linux.vnet.ibm.com>,
	Daniel Veillard <veillard@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v10 3/5] qemu: URI parsing library
Date: Fri, 28 Sep 2012 11:47:13 +0200	[thread overview]
Message-ID: <50657221.3010408@redhat.com> (raw)
In-Reply-To: <20120928083937.GG6087@redhat.com>

Il 28/09/2012 10:39, Daniel P. Berrange ha scritto:
>>> > > IMHO, you should also be importing the URI code test suite from libvirt
>>> > > to verify that the way you merged/changed the codebases did not break
>>> > > anything.
>> > 
>> > Yes, can be done separately though.
> In this case I disagree.  The URI parsing code here is complex enough that
> I don't think any reviewer can credibly claim to spot flaws that might
> have been introduced when combing the libvirt + libxml2 URI code parts.
> A test suite is the only way to validate this kind of complex code IMHO
> and so should be included in this patch.

The libvirt testsuite has ~10 testcases for URI, one of them for
IPv6-specific behavior that is not part of uri.c, and 13 for parsing
query parameters.  At least for the URI part, this would be false safety.

FWIW, this is what I had "tested" the code with:

void test(const char *x)
{
    URI *uri = uri_parse(x);
    QueryParams *qp;
    char *out;

    if (!uri) {
        printf ("INVALID: %s\n", x);
        return;
    }

    /* Escape the parameters.  */
    qp = query_params_parse(uri->query);
    g_free(uri->query);
    uri->query = query_params_to_string(qp);
    query_params_free(qp);

    out = uri_to_string(uri);
    uri_free(uri);
    printf("VALID: %s\n", out);
    g_free(out);
}

int main()
{
    test("gluster+unix:///b?c=d");
    test("gluster+tcp://user:pwd@foo:80/b?c=d");
    test("gluster+tcp://user:pwd@foo:8b0/b?c=d");
    test("http://a/b?c=d");
    test("http://a/b?c=/d/e");
    test("http://a/b?c=/d/e&f");
    test("http://a/b?c=/d/e&f=&&ggg");
    return 0;
}

Paolo

  reply	other threads:[~2012-09-28  9:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-27 13:55 [Qemu-devel] [PATCH v10 0/5] GlusterFS support in QEMU - v10 Bharata B Rao
2012-09-27 13:56 ` [Qemu-devel] [PATCH v10 1/5] aio: Fix qemu_aio_wait() to maintain correct walking_handlers count Bharata B Rao
2012-09-27 13:57 ` [Qemu-devel] [PATCH v10 2/5] aio: Another fix to the walking_handlers logic Bharata B Rao
2012-09-27 13:58 ` [Qemu-devel] [PATCH v10 3/5] qemu: URI parsing library Bharata B Rao
2012-09-27 14:36   ` Daniel P. Berrange
2012-09-27 15:55     ` Paolo Bonzini
2012-09-28  8:39       ` Daniel P. Berrange
2012-09-28  9:47         ` Paolo Bonzini [this message]
2012-09-27 13:59 ` [Qemu-devel] [PATCH v10 4/5] configure: Add a config option for GlusterFS as block backend Bharata B Rao
2012-09-27 14:00 ` [Qemu-devel] [PATCH v10 5/5] block: Support GlusterFS as a QEMU " Bharata B Rao
2012-09-28 18:23 ` [Qemu-devel] [PATCH v10 0/5] GlusterFS support in QEMU - v10 Kevin Wolf

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=50657221.3010408@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=aavati@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=amarts@redhat.com \
    --cc=avi@redhat.com \
    --cc=berrange@redhat.com \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=blauwirbel@gmail.com \
    --cc=harsh@linux.vnet.ibm.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@redhat.com \
    --cc=stefanha@gmail.com \
    --cc=vbellur@redhat.com \
    --cc=veillard@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).