From: "Daniel P. Berrange" <berrange@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: qemu-devel@nongnu.org, paolo.bonzini@gmail.com,
qemu-stable@nongnu.org, eblake@redhat.com, armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 3/3] tests: start generic qemu-qmp tests
Date: Thu, 22 Sep 2016 14:34:00 +0100 [thread overview]
Message-ID: <20160922133400.GP352@redhat.com> (raw)
In-Reply-To: <20160922130905.4720-4-marcandre.lureau@redhat.com>
On Thu, Sep 22, 2016 at 05:09:05PM +0400, Marc-André Lureau wrote:
> These 2 tests exhibit two qmp bugs fixed by the previous patches.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> tests/qemu-qmp-test.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++
Nitpick - we're not 100% perfect, but the most common convention
in tests/ is to use 'test-' as the name prefix for files that
contain test suites eg test-qemu-qmp.c
> tests/Makefile.include | 1 +
> 2 files changed, 62 insertions(+)
> create mode 100644 tests/qemu-qmp-test.c
>
> diff --git a/tests/qemu-qmp-test.c b/tests/qemu-qmp-test.c
> new file mode 100644
> index 0000000..3cdee59
> --- /dev/null
> +++ b/tests/qemu-qmp-test.c
> @@ -0,0 +1,61 @@
> +#include "qemu/osdep.h"
> +#include "libqtest.h"
> +
> +
> +static void test_object_add_without_props(void)
> +{
> + QDict *ret, *error;
> + const gchar *class, *desc;
> +
> + ret = qmp("{'execute': 'object-add',"
> + " 'arguments': { 'qom-type': 'memory-backend-ram', 'id': 'ram1' } }");
> + g_assert_nonnull(ret);
> +
> + error = qdict_get_qdict(ret, "error");
> + class = qdict_get_try_str(error, "class");
> + desc = qdict_get_try_str(error, "desc");
> +
> + g_assert_cmpstr(class, ==, "GenericError");
> + g_assert_cmpstr(desc, ==, "can't create backend with size 0");
> +
> + QDECREF(ret);
> +}
> +
> +static void test_qom_set_without_value(void)
> +{
> + QDict *ret, *error;
> + const gchar *class, *desc;
> +
> + ret = qmp("{'execute': 'qom-set',"
> + " 'arguments': { 'path': '/machine', 'property': 'rtc-time' } }");
> + g_assert_nonnull(ret);
> +
> + error = qdict_get_qdict(ret, "error");
> + class = qdict_get_try_str(error, "class");
> + desc = qdict_get_try_str(error, "desc");
> +
> + g_assert_cmpstr(class, ==, "GenericError");
> + g_assert_cmpstr(desc, ==, "Parameter 'value' is missing");
> +
> + QDECREF(ret);
> +}
> +
> +int main(int argc, char **argv)
> +{
> + int ret;
> +
> + g_test_init(&argc, &argv, NULL);
> +
> + qtest_start("");
> +
> + qtest_add_func("/qemu-qmp/object-add-without-props",
> + test_object_add_without_props);
> + qtest_add_func("/qemu-qmp/qom-set-without-value",
> + test_qom_set_without_value);
> +
> + ret = g_test_run();
> +
> + qtest_end();
> +
> + return ret;
> +}
> diff --git a/tests/Makefile.include b/tests/Makefile.include
> index 6052a38..ce7edf8 100644
> --- a/tests/Makefile.include
> +++ b/tests/Makefile.include
> @@ -296,6 +296,7 @@ check-qtest-xtensaeb-y = $(check-qtest-xtensa-y)
> check-qtest-s390x-y = tests/boot-serial-test$(EXESUF)
>
> check-qtest-generic-y += tests/qom-test$(EXESUF)
> +check-qtest-generic-y += tests/qemu-qmp-test$(EXESUF)
>
> qapi-schema += alternate-any.json
> qapi-schema += alternate-array.json
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
next prev parent reply other threads:[~2016-09-22 13:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-22 13:09 [Qemu-devel] [PATCH v2 0/3] Fix some qapi assert() Marc-André Lureau
2016-09-22 13:09 ` [Qemu-devel] [PATCH v2 1/3] qmp: fix object-add assert() without props Marc-André Lureau
2016-09-22 13:57 ` Eric Blake
2016-09-22 13:09 ` [Qemu-devel] [PATCH v2 2/3] qapi: fix crash when a parameter is missing Marc-André Lureau
2016-09-22 13:59 ` Eric Blake
2016-09-22 13:09 ` [Qemu-devel] [PATCH v2 3/3] tests: start generic qemu-qmp tests Marc-André Lureau
2016-09-22 13:34 ` Daniel P. Berrange [this message]
2016-09-22 14:49 ` [Qemu-devel] [PATCH v2 0/3] Fix some qapi assert() no-reply
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=20160922133400.GP352@redhat.com \
--to=berrange@redhat.com \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=paolo.bonzini@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
/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.