From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:52711) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THXAP-0002Tn-Pz for qemu-devel@nongnu.org; Fri, 28 Sep 2012 05:47:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1THXAK-00052R-0s for qemu-devel@nongnu.org; Fri, 28 Sep 2012 05:47:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20157) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THXAJ-00051W-OM for qemu-devel@nongnu.org; Fri, 28 Sep 2012 05:47:23 -0400 Message-ID: <50657221.3010408@redhat.com> Date: Fri, 28 Sep 2012 11:47:13 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <20120927135553.GD18285@in.ibm.com> <20120927135843.GG18285@in.ibm.com> <20120927143623.GC27933@redhat.com> <506476E3.9030200@redhat.com> <20120928083937.GG6087@redhat.com> In-Reply-To: <20120928083937.GG6087@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v10 3/5] qemu: URI parsing library List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: Kevin Wolf , Anthony Liguori , Anand Avati , Vijay Bellur , Stefan Hajnoczi , Harsh Bora , Amar Tumballi , qemu-devel@nongnu.org, "Richard W.M. Jones" , Blue Swirl , Avi Kivity , Bharata B Rao , Daniel Veillard 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