All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: Luiz Capitulino <lcapitulino@redhat.com>,
	Fam Zheng <famz@redhat.com>,
	qemu-devel@nongnu.org, wenchaoqemu@gmail.com
Subject: Re: [Qemu-devel] [PATCH v3 03/14] qapi: add some enum tests
Date: Thu, 14 Aug 2014 11:23:27 +0200	[thread overview]
Message-ID: <87vbpvjugg.fsf@blackfin.pond.sub.org> (raw)
In-Reply-To: <1407287673-20308-4-git-send-email-eblake@redhat.com> (Eric Blake's message of "Tue, 5 Aug 2014 19:14:22 -0600")

Eric Blake <eblake@redhat.com> writes:

> Demonstrate that the qapi generator doesn't deal well with enums
> that aren't up to par. Later patches will update the expected
> results as the generator is made stricter.
>
> * tests/qapi-schema/enum-empty.*: New files.
> * tests/qapi-schema/enum-missing-data.*: Likewise.
> * tests/qapi-schema/enum-wrong-data.*: Likewise.
> * tests/Makefile (check-qapi-schema-y): Run them.
>
> Signed-off-by: Eric Blake <eblake@redhat.com>
[...]
> diff --git a/tests/qapi-schema/enum-missing-data.err b/tests/qapi-schema/enum-missing-data.err
> new file mode 100644
> index 0000000..1fec213
> --- /dev/null
> +++ b/tests/qapi-schema/enum-missing-data.err
> @@ -0,0 +1,6 @@
> +Traceback (most recent call last):
> +  File "tests/qapi-schema/test-qapi.py", line 19, in <module>
> +    exprs = parse_schema(sys.argv[1])
> +  File "scripts/qapi.py", line 339, in parse_schema
> +    add_enum(expr['enum'], expr['data'])
> +KeyError: 'data'
> diff --git a/tests/qapi-schema/enum-missing-data.exit b/tests/qapi-schema/enum-missing-data.exit
> new file mode 100644
> index 0000000..d00491f
> --- /dev/null
> +++ b/tests/qapi-schema/enum-missing-data.exit
> @@ -0,0 +1 @@
> +1
> diff --git a/tests/qapi-schema/enum-missing-data.json b/tests/qapi-schema/enum-missing-data.json
> new file mode 100644
> index 0000000..6e2acd8
> --- /dev/null
> +++ b/tests/qapi-schema/enum-missing-data.json
> @@ -0,0 +1 @@
> +{ 'enum': 'MyEnum' }
> diff --git a/tests/qapi-schema/enum-missing-data.out b/tests/qapi-schema/enum-missing-data.out
> new file mode 100644
> index 0000000..e69de29
> diff --git a/tests/qapi-schema/enum-wrong-data.err b/tests/qapi-schema/enum-wrong-data.err
> new file mode 100644
> index 0000000..e69de29
> diff --git a/tests/qapi-schema/enum-wrong-data.exit b/tests/qapi-schema/enum-wrong-data.exit
> new file mode 100644
> index 0000000..573541a
> --- /dev/null
> +++ b/tests/qapi-schema/enum-wrong-data.exit
> @@ -0,0 +1 @@
> +0
> diff --git a/tests/qapi-schema/enum-wrong-data.json b/tests/qapi-schema/enum-wrong-data.json
> new file mode 100644
> index 0000000..4b7e90c
> --- /dev/null
> +++ b/tests/qapi-schema/enum-wrong-data.json
> @@ -0,0 +1 @@
> +{ 'enum': 'MyEnum', 'data': { 'value': 'str' } }
> diff --git a/tests/qapi-schema/enum-wrong-data.out b/tests/qapi-schema/enum-wrong-data.out
> new file mode 100644
> index 0000000..28d2211
> --- /dev/null
> +++ b/tests/qapi-schema/enum-wrong-data.out
> @@ -0,0 +1,3 @@
> +[OrderedDict([('enum', 'MyEnum'), ('data', OrderedDict([('value', 'str')]))])]
> +[{'enum_name': 'MyEnum', 'enum_values': OrderedDict([('value', 'str')])}]
> +[]

For tests demonstrating incorrect behavior, a comment describing the
expected behavior is always welcome.

  reply	other threads:[~2014-08-14  9:23 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-06  1:14 [Qemu-devel] [PATCH v3 00/14] drop qapi nested structs Eric Blake
2014-08-06  1:14 ` [Qemu-devel] [PATCH v3 01/14] qapi: consistent whitespace in tests/Makefile Eric Blake
2014-08-06  1:14 ` [Qemu-devel] [PATCH v3 02/14] qapi: ignore files created during make check Eric Blake
2014-08-06  1:14 ` [Qemu-devel] [PATCH v3 03/14] qapi: add some enum tests Eric Blake
2014-08-14  9:23   ` Markus Armbruster [this message]
2014-08-14 12:21     ` Eric Blake
2014-08-06  1:14 ` [Qemu-devel] [PATCH v3 04/14] qapi: better error message for bad enum Eric Blake
2014-08-06  1:14 ` [Qemu-devel] [PATCH v3 05/14] qapi: add some expr tests Eric Blake
2014-08-06  1:14 ` [Qemu-devel] [PATCH v3 06/14] qapi: require valid expressions Eric Blake
2014-08-14  9:38   ` Markus Armbruster
2014-08-14 12:26     ` Eric Blake
2014-08-06  1:14 ` [Qemu-devel] [PATCH v3 07/14] qapi: add some type check tests Eric Blake
2014-08-14  9:47   ` Markus Armbruster
2014-08-14 12:26     ` Eric Blake
2014-08-06  1:14 ` [Qemu-devel] [PATCH v3 08/14] qapi: add expr_name() helper Eric Blake
2014-08-14  9:49   ` Markus Armbruster
2014-08-06  1:14 ` [Qemu-devel] [PATCH v3 09/14] qapi: add check_type helper function Eric Blake
2014-08-14 10:10   ` Markus Armbruster
2014-08-14 12:42     ` Eric Blake
2014-08-14 16:10       ` Markus Armbruster
2014-08-06  1:14 ` [Qemu-devel] [PATCH v3 10/14] qapi: merge UserDefTwo and UserDefNested in tests Eric Blake
2014-08-06  1:14 ` [Qemu-devel] [PATCH v3 11/14] qapi: drop tests for inline subtypes Eric Blake
2014-08-06  1:14 ` [Qemu-devel] [PATCH v3 12/14] qapi: drop inline subtype in query-version Eric Blake
2014-08-14 11:45   ` Markus Armbruster
2014-08-06  1:14 ` [Qemu-devel] [PATCH v3 13/14] qapi: drop inline subtype in query-pci Eric Blake
2014-08-06  1:14 ` [Qemu-devel] [PATCH v3 14/14] qapi: drop support for inline subtypes Eric Blake
2014-08-12 12:47 ` [Qemu-devel] [PATCH v3 00/14] drop qapi nested structs Eric Blake
2014-08-14 12:00 ` Markus Armbruster
2014-08-15 18:12 ` Luiz Capitulino

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=87vbpvjugg.fsf@blackfin.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=famz@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wenchaoqemu@gmail.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 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.