qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Auger Eric <eric.auger@redhat.com>
To: eric.auger.pro@gmail.com, qemu-devel@nongnu.org,
	pbonzini@redhat.com, berrange@redhat.com, ehabkost@redhat.com,
	armbru@redhat.com
Subject: Re: [PATCH v2 2/2] tests/qmp-cmd-test: Add qmp/object-add-duplicate-id
Date: Wed, 24 Jun 2020 18:13:34 +0200	[thread overview]
Message-ID: <ff675de1-b338-2e2c-5b8a-94687df8f000@redhat.com> (raw)
In-Reply-To: <20200624124301.7112-3-eric.auger@redhat.com>

Hi Thomas,

On 6/24/20 2:43 PM, Eric Auger wrote:
> 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>
> ---
>  tests/qtest/qmp-cmd-test.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/tests/qtest/qmp-cmd-test.c b/tests/qtest/qmp-cmd-test.c
> index 9f5228cd99..9510051c35 100644
> --- a/tests/qtest/qmp-cmd-test.c
> +++ b/tests/qtest/qmp-cmd-test.c
> @@ -213,6 +213,22 @@ 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 } } }");
in v3 I will add here:
    g_assert_nonnull(resp);

Thanks
Eric
> +    qmp_assert_error_class(resp, "GenericError");
> +    qtest_quit(qts);
> +}
> +
>  int main(int argc, char *argv[])
>  {
>      QmpSchema schema;
> @@ -225,6 +241,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();
> 



  parent reply	other threads:[~2020-06-24 16:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-24 12:42 [PATCH v2 0/2] Avoid abort on QMP attempt to add an object with duplicate id Eric Auger
2020-06-24 12:43 ` [PATCH v2 1/2] qom: Introduce object_property_try_add_child() Eric Auger
2020-06-24 14:12   ` Paolo Bonzini
2020-06-24 14:17     ` Auger Eric
2020-06-24 16:02       ` Auger Eric
2020-06-24 16:16         ` Paolo Bonzini
2020-06-24 17:03           ` Auger Eric
2020-06-24 12:43 ` [PATCH v2 2/2] tests/qmp-cmd-test: Add qmp/object-add-duplicate-id Eric Auger
2020-06-24 13:01   ` Thomas Huth
2020-06-24 16:13   ` Auger Eric [this message]
2020-06-24 13:35 ` [PATCH v2 0/2] Avoid abort on QMP attempt to add an object with duplicate id no-reply
2020-06-24 14:05   ` Auger Eric

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=ff675de1-b338-2e2c-5b8a-94687df8f000@redhat.com \
    --to=eric.auger@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=eric.auger.pro@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).