All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, pkrempa@redhat.com
Subject: Re: [PATCH v4 3/4] tests: qapi: Test 'features' of commands
Date: Tue, 15 Oct 2019 08:51:56 +0200	[thread overview]
Message-ID: <8736fuzek3.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20191011085027.28606-4-armbru@redhat.com> (Markus Armbruster's message of "Fri, 11 Oct 2019 10:50:26 +0200")

Markus Armbruster <armbru@redhat.com> writes:

> From: Peter Krempa <pkrempa@redhat.com>
>
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> Reviewed-by: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  tests/test-qmp-cmds.c                   | 24 ++++++++++++++++++++++++
>  tests/qapi-schema/qapi-schema-test.json | 22 ++++++++++++++++++++++
>  tests/qapi-schema/qapi-schema-test.out  | 23 +++++++++++++++++++++++
>  tests/qapi-schema/test-qapi.py          | 12 ++++++++----
>  4 files changed, 77 insertions(+), 4 deletions(-)
>
> diff --git a/tests/test-qmp-cmds.c b/tests/test-qmp-cmds.c
> index 36fdf5b115..ba623fda29 100644
> --- a/tests/test-qmp-cmds.c
> +++ b/tests/test-qmp-cmds.c
> @@ -51,6 +51,30 @@ void qmp_test_features(FeatureStruct0 *fs0, FeatureStruct1 *fs1,
>  {
>  }
>  
> +void qmp_test_command_features1(Error **errp)
> +{
> +}
> +
> +void qmp_test_command_features2(Error **errp)
> +{
> +}
> +
> +void qmp_test_command_features3(Error **errp)
> +{
> +}
> +
> +void qmp_test_command_features4(Error **errp)
> +{
> +}
> +
> +void qmp_test_command_features5(Error **errp)
> +{
> +}
> +
> +void qmp_test_command_features6(Error **errp)
> +{
> +}
> +
>  UserDefTwo *qmp_user_def_cmd2(UserDefOne *ud1a,
>                                bool has_udb1, UserDefOne *ud1b,
>                                Error **errp)
> diff --git a/tests/qapi-schema/qapi-schema-test.json b/tests/qapi-schema/qapi-schema-test.json
> index 75c42eb0e3..80811dc8f0 100644
> --- a/tests/qapi-schema/qapi-schema-test.json
> +++ b/tests/qapi-schema/qapi-schema-test.json
> @@ -290,3 +290,25 @@
>              'cfs1': 'CondFeatureStruct1',
>              'cfs2': 'CondFeatureStruct2',
>              'cfs3': 'CondFeatureStruct3' } }
> +
> +# test 'features' for command
> +
> +{ 'command': 'test-command-features1',
> +  'features': [] }
> +
> +{ 'command': 'test-command-features2',
> +  'features': [ 'feature1' ] }
> +
> +{ 'command': 'test-command-features3',
> +  'features': [ 'feature1', 'feature2' ] }
> +
> +{ 'command': 'test-command-features4',
> +  'features': [ { 'name': 'feature1', 'if': 'defined(TEST_IF_FEATURE_1)'} ] }
> +
> +{ 'command': 'test-command-features5',
> +  'features': [ { 'name': 'feature1', 'if': 'defined(TEST_IF_FEATURE_1)'},
> +                { 'name': 'feature2', 'if': 'defined(TEST_IF_FEATURE_2)'} ] }
> +
> +{ 'command': 'test-command-features6',
> +  'features': [ { 'name': 'feature1', 'if': [ 'defined(TEST_IF_COND_1)',
> +                                              'defined(TEST_IF_COND_2)'] } ] }
> diff --git a/tests/qapi-schema/qapi-schema-test.out b/tests/qapi-schema/qapi-schema-test.out
> index aca43186a9..4061152cae 100644
> --- a/tests/qapi-schema/qapi-schema-test.out
> +++ b/tests/qapi-schema/qapi-schema-test.out
> @@ -412,3 +412,26 @@ object q_obj_test-features-arg
>      member cfs3: CondFeatureStruct3 optional=False
>  command test-features q_obj_test-features-arg -> None
>      gen=True success_response=True boxed=False oob=False preconfig=False
> +command test-command-features1 None -> None
> +    gen=True success_response=True boxed=False oob=False preconfig=False
> +command test-command-features2 None -> None
> +    gen=True success_response=True boxed=False oob=False preconfig=False
> +    feature feature1
> +command test-command-features3 None -> None
> +    gen=True success_response=True boxed=False oob=False preconfig=False
> +    feature feature1
> +    feature feature2
> +command test-command-features4 None -> None
> +    gen=True success_response=True boxed=False oob=False preconfig=False
> +    feature feature1
> +        if ['defined(TEST_IF_FEATURE_1)']
> +command test-command-features5 None -> None
> +    gen=True success_response=True boxed=False oob=False preconfig=False
> +    feature feature1
> +        if ['defined(TEST_IF_FEATURE_1)']
> +    feature feature2
> +        if ['defined(TEST_IF_FEATURE_2)']
> +command test-command-features6 None -> None
> +    gen=True success_response=True boxed=False oob=False preconfig=False
> +    feature feature1
> +        if ['defined(TEST_IF_COND_1)', 'defined(TEST_IF_COND_2)']

This might border on OCD...  Your new tests for commands are patterned
after the existing tests for structs.  You omit a few, and that's okay.
I'd like the names of corresponding tests to match; see appended
incremental patch.

[...]


diff --git a/tests/test-qmp-cmds.c b/tests/test-qmp-cmds.c
index ba623fda29..27b0afe55a 100644
--- a/tests/test-qmp-cmds.c
+++ b/tests/test-qmp-cmds.c
@@ -51,27 +51,27 @@ void qmp_test_features(FeatureStruct0 *fs0, FeatureStruct1 *fs1,
 {
 }
 
+void qmp_test_command_features0(Error **errp)
+{
+}
+
 void qmp_test_command_features1(Error **errp)
 {
 }
 
-void qmp_test_command_features2(Error **errp)
-{
-}
-
 void qmp_test_command_features3(Error **errp)
 {
 }
 
-void qmp_test_command_features4(Error **errp)
+void qmp_test_command_cond_features1(Error **errp)
 {
 }
 
-void qmp_test_command_features5(Error **errp)
+void qmp_test_command_cond_features2(Error **errp)
 {
 }
 
-void qmp_test_command_features6(Error **errp)
+void qmp_test_command_cond_features3(Error **errp)
 {
 }
 
diff --git a/tests/qapi-schema/qapi-schema-test.json b/tests/qapi-schema/qapi-schema-test.json
index 80811dc8f0..9abf175fe0 100644
--- a/tests/qapi-schema/qapi-schema-test.json
+++ b/tests/qapi-schema/qapi-schema-test.json
@@ -293,22 +293,18 @@
 
 # test 'features' for command
 
+{ 'command': 'test-command-features0',
+  'features': [] }
 { 'command': 'test-command-features1',
-  'features': [] }
-
-{ 'command': 'test-command-features2',
   'features': [ 'feature1' ] }
-
 { 'command': 'test-command-features3',
   'features': [ 'feature1', 'feature2' ] }
 
-{ 'command': 'test-command-features4',
+{ 'command': 'test-command-cond-features1',
   'features': [ { 'name': 'feature1', 'if': 'defined(TEST_IF_FEATURE_1)'} ] }
-
-{ 'command': 'test-command-features5',
+{ 'command': 'test-command-cond-features2',
   'features': [ { 'name': 'feature1', 'if': 'defined(TEST_IF_FEATURE_1)'},
                 { 'name': 'feature2', 'if': 'defined(TEST_IF_FEATURE_2)'} ] }
-
-{ 'command': 'test-command-features6',
+{ 'command': 'test-command-cond-features3',
   'features': [ { 'name': 'feature1', 'if': [ 'defined(TEST_IF_COND_1)',
                                               'defined(TEST_IF_COND_2)'] } ] }
diff --git a/tests/qapi-schema/qapi-schema-test.out b/tests/qapi-schema/qapi-schema-test.out
index 4061152cae..3660e75a48 100644
--- a/tests/qapi-schema/qapi-schema-test.out
+++ b/tests/qapi-schema/qapi-schema-test.out
@@ -412,26 +412,26 @@ object q_obj_test-features-arg
     member cfs3: CondFeatureStruct3 optional=False
 command test-features q_obj_test-features-arg -> None
     gen=True success_response=True boxed=False oob=False preconfig=False
+command test-command-features0 None -> None
+    gen=True success_response=True boxed=False oob=False preconfig=False
 command test-command-features1 None -> None
     gen=True success_response=True boxed=False oob=False preconfig=False
-command test-command-features2 None -> None
-    gen=True success_response=True boxed=False oob=False preconfig=False
     feature feature1
 command test-command-features3 None -> None
     gen=True success_response=True boxed=False oob=False preconfig=False
     feature feature1
     feature feature2
-command test-command-features4 None -> None
+command test-command-cond-features1 None -> None
     gen=True success_response=True boxed=False oob=False preconfig=False
     feature feature1
         if ['defined(TEST_IF_FEATURE_1)']
-command test-command-features5 None -> None
+command test-command-cond-features2 None -> None
     gen=True success_response=True boxed=False oob=False preconfig=False
     feature feature1
         if ['defined(TEST_IF_FEATURE_1)']
     feature feature2
         if ['defined(TEST_IF_FEATURE_2)']
-command test-command-features6 None -> None
+command test-command-cond-features3 None -> None
     gen=True success_response=True boxed=False oob=False preconfig=False
     feature feature1
         if ['defined(TEST_IF_COND_1)', 'defined(TEST_IF_COND_2)']


  reply	other threads:[~2019-10-15  6:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-11  8:50 [PATCH v4 0/4] qapi: Add detection for the 'savevm' fix for blockdev Markus Armbruster
2019-10-11  8:50 ` [PATCH v4 1/4] tests/qapi-schema: Tidy up test output indentation Markus Armbruster
2019-10-11  9:07   ` Peter Krempa
2019-10-11  8:50 ` [PATCH v4 2/4] qapi: Add feature flags to commands in qapi Markus Armbruster
2019-10-14 12:23   ` Markus Armbruster
2019-10-11  8:50 ` [PATCH v4 3/4] tests: qapi: Test 'features' of commands Markus Armbruster
2019-10-15  6:51   ` Markus Armbruster [this message]
2019-10-11  8:50 ` [PATCH v4 4/4] qapi: Allow introspecting fix for savevm's cooperation with blockdev Markus Armbruster
2019-10-14 10:06   ` Kevin Wolf
2019-10-14 12:16     ` Markus Armbruster
2019-10-11  9:10 ` [PATCH v4 0/4] qapi: Add detection for the 'savevm' fix for blockdev Peter Krempa

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=8736fuzek3.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pkrempa@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.