All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Lluís Vilanova" <vilanova@ac.upc.edu>, qemu-devel@nongnu.org
Cc: "Benoît Canet" <benoit.canet@irqsave.net>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Luiz Capitulino" <lcapitulino@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v6 4/4] qapi: Add tests for the "include" directive
Date: Mon, 31 Mar 2014 14:17:29 -0600	[thread overview]
Message-ID: <5339CD59.8030808@redhat.com> (raw)
In-Reply-To: <20140331191654.21034.33044.stgit@fimbulvetr.bsc.es>

[-- Attachment #1: Type: text/plain, Size: 1906 bytes --]

On 03/31/2014 01:16 PM, Lluís Vilanova wrote:
> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
> ---
>  tests/Makefile                            |    4 +++-
>  tests/qapi-schema/include-cycle-b.json    |    1 +
...
>  tests/qapi-schema/include-simple.out      |    3 +++

Hmm, no tests of cross-directory inclusion.  In Benoît's series, there
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 ‘choke’
 choke me
 ^
foo.c:1:0: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ 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.

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

      reply	other threads:[~2014-03-31 20:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-31 19:16 [Qemu-devel] [PATCH v6 0/4] qapi: Allow modularization of QAPI schema files Lluís Vilanova
2014-03-31 19:16 ` [Qemu-devel] [PATCH v6 1/4] qapi: [trivial] Break long command lines Lluís Vilanova
2014-03-31 19:32   ` Eric Blake
2014-03-31 19:16 ` [Qemu-devel] [PATCH v6 2/4] qapi: Use an explicit input file Lluís Vilanova
2014-03-31 19:42   ` Eric Blake
2014-04-01 14:05     ` Lluís Vilanova
2014-03-31 19:16 ` [Qemu-devel] [PATCH v6 3/4] qapi: Add a primitive to include other files from a QAPI schema file Lluís Vilanova
2014-03-31 20:00   ` Eric Blake
2014-04-01 13:46     ` Lluís Vilanova
2014-04-01 14:47       ` Eric Blake
2014-04-01 16:05         ` Lluís Vilanova
2014-03-31 19:16 ` [Qemu-devel] [PATCH v6 4/4] qapi: Add tests for the "include" directive Lluís Vilanova
2014-03-31 20:17   ` Eric Blake [this message]

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=5339CD59.8030808@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=benoit.canet@irqsave.net \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=vilanova@ac.upc.edu \
    /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.