From: Markus Armbruster <armbru@redhat.com>
To: Eric Auger <eric.auger@redhat.com>
Cc: pbonzini@redhat.com, berrange@redhat.com, qemu-devel@nongnu.org,
ehabkost@redhat.com, eric.auger.pro@gmail.com
Subject: Re: [PATCH v3 2/2] tests/qmp-cmd-test: Add qmp/object-add-duplicate-id
Date: Thu, 25 Jun 2020 12:58:44 +0200 [thread overview]
Message-ID: <87sgej4djv.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20200624194809.26600-3-eric.auger@redhat.com> (Eric Auger's message of "Wed, 24 Jun 2020 21:48:09 +0200")
Eric Auger <eric.auger@redhat.com> writes:
> This new test checks that attempting to create an object
> with an existing ID gracefully fails.
>
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
> Acked-by: Thomas Huth <thuth@redhat.com>
> ---
> tests/qtest/qmp-cmd-test.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/tests/qtest/qmp-cmd-test.c b/tests/qtest/qmp-cmd-test.c
> index 9f5228cd99..ceb3296691 100644
> --- a/tests/qtest/qmp-cmd-test.c
> +++ b/tests/qtest/qmp-cmd-test.c
> @@ -213,6 +213,23 @@ static void test_object_add_without_props(void)
> qtest_quit(qts);
> }
>
> +static void test_object_add_with_duplicate_id(void)
> +{
> + QTestState *qts;
> + QDict *resp;
> +
> + qts = qtest_init(common_args);
> + resp = qtest_qmp(qts, "{'execute': 'object-add', 'arguments':"
> + " {'qom-type': 'memory-backend-ram', 'id': 'ram1', 'props': {'size': 4294967296 } } }");
> + g_assert_nonnull(resp);
> + g_assert(qdict_haskey(resp, "return"));
> + resp = qtest_qmp(qts, "{'execute': 'object-add', 'arguments':"
> + " {'qom-type': 'memory-backend-ram', 'id': 'ram1', 'props': {'size': 4294967296 } } }");
> + g_assert_nonnull(resp);
> + qmp_assert_error_class(resp, "GenericError");
> + qtest_quit(qts);
> +}
> +
> int main(int argc, char *argv[])
> {
> QmpSchema schema;
> @@ -225,6 +242,8 @@ int main(int argc, char *argv[])
>
> qtest_add_func("qmp/object-add-without-props",
> test_object_add_without_props);
> + qtest_add_func("qmp/object-add-duplicate-id",
> + test_object_add_with_duplicate_id);
> /* TODO: add coverage of generic object-add failure modes */
>
> ret = g_test_run();
One test case per error gets tedious real quick. I'd add a test case
for generic failures (resolving the TODO), test duplicate ID there, and
add a TODO for the remaining generic failures.
No reason to withhold my
Reviewed-by: Markus Armbruster <armbru@redhat.com>
next prev parent reply other threads:[~2020-06-25 10:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-24 19:48 [PATCH v3 0/2] Avoid abort on QMP attempt to add an object with duplicate id Eric Auger
2020-06-24 19:48 ` [PATCH v3 1/2] qom: Introduce object_property_try_add_child() Eric Auger
2020-06-25 9:24 ` Markus Armbruster
2020-06-29 8:31 ` Auger Eric
2020-06-24 19:48 ` [PATCH v3 2/2] tests/qmp-cmd-test: Add qmp/object-add-duplicate-id Eric Auger
2020-06-25 9:47 ` Paolo Bonzini
2020-06-25 10:58 ` Markus Armbruster [this message]
2020-06-24 20:24 ` [PATCH v3 0/2] Avoid abort on QMP attempt to add an object with duplicate id 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=87sgej4djv.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=ehabkost@redhat.com \
--cc=eric.auger.pro@gmail.com \
--cc=eric.auger@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@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.