From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39442) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUieL-00029c-BR for qemu-devel@nongnu.org; Mon, 31 Mar 2014 16:17:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WUieG-00067x-V9 for qemu-devel@nongnu.org; Mon, 31 Mar 2014 16:17:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59233) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUieG-00067r-MY for qemu-devel@nongnu.org; Mon, 31 Mar 2014 16:17:36 -0400 Message-ID: <5339CD59.8030808@redhat.com> Date: Mon, 31 Mar 2014 14:17:29 -0600 From: Eric Blake MIME-Version: 1.0 References: <20140331191631.21034.25433.stgit@fimbulvetr.bsc.es> <20140331191654.21034.33044.stgit@fimbulvetr.bsc.es> In-Reply-To: <20140331191654.21034.33044.stgit@fimbulvetr.bsc.es> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hwlC06chvxRa8raARr9dKgwKlBfMeifLc" Subject: Re: [Qemu-devel] [PATCH v6 4/4] qapi: Add tests for the "include" directive List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?TGx1w61zIFZpbGFub3Zh?= , qemu-devel@nongnu.org Cc: =?UTF-8?B?QmVub8OudCBDYW5ldA==?= , Markus Armbruster , Luiz Capitulino This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --hwlC06chvxRa8raARr9dKgwKlBfMeifLc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 03/31/2014 01:16 PM, Llu=C3=ADs Vilanova wrote: > Signed-off-by: Llu=C3=ADs Vilanova > --- > tests/Makefile | 4 +++- > tests/qapi-schema/include-cycle-b.json | 1 + =2E.. > tests/qapi-schema/include-simple.out | 3 +++ Hmm, no tests of cross-directory inclusion. In Beno=C3=AEt's series, the= re was a test that "a" includes "dir/b" includes "../c" finds the correct file "c" (well, the filenames were spelled differently, but the idea is to make sure that we are fully exercising the "relative to the file that has the include statement"). > +++ b/tests/qapi-schema/include-nested-err.err > @@ -0,0 +1 @@ > +tests/qapi-schema/missing-colon.json:1:10: Expected ":" > +++ b/tests/qapi-schema/include-nested-err.json > @@ -0,0 +1 @@ > +{ 'include': 'missing-colon.json' } Nice - it proves the error reporting got the right line number in the nested file. Not so nice - it doesn't tell how we got there. I like gcc's notion of telling you what files were included along the way to an error, as in: $ echo '#include "foo.h"' > foo.c $ echo 'choke me' > foo.h $ gcc -c -o /dev/null -Wall foo.c In file included from foo.c:1:0: foo.h:1:1: error: unknown type name =E2=80=98choke=E2=80=99 choke me ^ foo.c:1:0: error: expected =E2=80=98=3D=E2=80=99, =E2=80=98,=E2=80=99, =E2= =80=98;=E2=80=99, =E2=80=98asm=E2=80=99 or =E2=80=98__attribute__=E2=80=99= at end of input #include "foo.h" ^ Note how it mentions "In file included from foo.c:1:0:" before proceeding to tell me about the bug in "foo.h". Also might be worth a test that an error after an include directive correctly has the right context back in the source file, as in: { 'include': 'good-sub.json' } { 'command' 'missing-colon' } having the correct line number information about the missing colon. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --hwlC06chvxRa8raARr9dKgwKlBfMeifLc Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTOc1ZAAoJEKeha0olJ0Nql88H/ijvFihCjbRcruBVO5wIqt2S abh4W3aAhi75Rc6VAd091btpEQwdnGcF3NfPxVdx55e0CIVzAKy9a1iLbpAy9x8b R0L/7122Mpro3MLRxjIHwzyw5DazexPtuU/6SrVHaS4YePZM4h8LwQMLWNtc5ZUv ePlC/GRmcPVcrtfkEWcYl6m/N18LKMs5FK651ZOEf8aME3wV3s1I/3ZiMKRji/VW jUv6qHYHLjOArhGrhK+p9CiprLlt39EQKTDGtcuvfqqX3x03yqOz3rA5mjxLfSvO 4E6ebFTi3equo68ApLn9j0rYM+7mSWkjBOoYpfkeH8TY8JnCnjmMPBdcAJsnyB4= =f/i7 -----END PGP SIGNATURE----- --hwlC06chvxRa8raARr9dKgwKlBfMeifLc--