From: Peter Krempa <pkrempa@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH v3 2/3] tests: qapi: Test 'features' of commands
Date: Fri, 11 Oct 2019 09:46:11 +0200 [thread overview]
Message-ID: <20191011074611.GA1979@andariel.pipo.sk> (raw)
In-Reply-To: <87pnj4ogf9.fsf@dusky.pond.sub.org>
[-- Attachment #1: Type: text/plain, Size: 6577 bytes --]
On Thu, Oct 10, 2019 at 15:53:30 +0200, Markus Armbruster wrote:
> Peter Krempa <pkrempa@redhat.com> writes:
>
> > Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> > ---
> > tests/qapi-schema/qapi-schema-test.json | 26 ++++++++++++++++++++++
> > tests/qapi-schema/qapi-schema-test.out | 29 +++++++++++++++++++++++++
> > tests/qapi-schema/test-qapi.py | 4 ++++
> > tests/test-qmp-cmds.c | 28 ++++++++++++++++++++++++
> > 4 files changed, 87 insertions(+)
>
> More thorough than I asked for. I'm not complaining :)
>
> >
> > diff --git a/tests/qapi-schema/qapi-schema-test.json b/tests/qapi-schema/qapi-schema-test.json
> > index 75c42eb0e3..220859d4c9 100644
> > --- a/tests/qapi-schema/qapi-schema-test.json
> > +++ b/tests/qapi-schema/qapi-schema-test.json
> > @@ -290,3 +290,29 @@
> > '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_FEATURE_1)'},
> > + { 'name': 'feature2', 'if': 'defined(TEST_IF_FEATURE_2)'} ] }
>
> Do you need both test-command-features5 and 6? They look the same to me...
No. It can be dropped. Looks like I mistakenly appropriated
'CondFeatureStruct2' test twice :/
> > +{ 'command': 'test-command-features7',
> > + '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 98031da96f..a38e348d54 100644
> > --- a/tests/qapi-schema/qapi-schema-test.out
> > +++ b/tests/qapi-schema/qapi-schema-test.out
> > @@ -412,3 +412,32 @@ 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_FEATURE_1)']
> > + feature feature2
> > + if ['defined(TEST_IF_FEATURE_2)']
> > +command test-command-features7 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)']
> > diff --git a/tests/qapi-schema/test-qapi.py b/tests/qapi-schema/test-qapi.py
> > index e13c2e8671..62e65b6a7d 100755
> > --- a/tests/qapi-schema/test-qapi.py
> > +++ b/tests/qapi-schema/test-qapi.py
> > @@ -80,6 +80,10 @@ class QAPISchemaTestVisitor(QAPISchemaVisitor):
> > print(' gen=%s success_response=%s boxed=%s oob=%s preconfig=%s'
> > % (gen, success_response, boxed, allow_oob, allow_preconfig))
> > self._print_if(ifcond)
> > + if features:
> > + for f in features:
> > + print(' feature %s' % f.name)
> > + self._print_if(f.ifcond, 8)
>
> Copied from visit_object_type(). Let's factor it into a @staticmethod
> _print_features().
I'm not sure if that's intentional but the 'struct' and 'command'
feature printers differ in indentation level by one space. I went for
aligning it with the 'gen' line above. I thought it's for visual
separation with other possible lines.
> > def visit_event(self, name, info, ifcond, arg_type, boxed):
> > print('event %s %s' % (name, arg_type and arg_type.name))
> > diff --git a/tests/test-qmp-cmds.c b/tests/test-qmp-cmds.c
> > index 36fdf5b115..19f6e06ba7 100644
> > --- a/tests/test-qmp-cmds.c
> > +++ b/tests/test-qmp-cmds.c
> > @@ -51,6 +51,34 @@ 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)
> > +{
> > +}
> > +
> > +void qmp_test_command_features7(Error **errp)
> > +{
> > +}
> > +
> > UserDefTwo *qmp_user_def_cmd2(UserDefOne *ud1a,
> > bool has_udb1, UserDefOne *ud1b,
> > Error **errp)
>
> Any particular reason why we shouldn't squash this into PATCH 1?
Not really. I tend to prefer tests added separately and it was also done
so in case of features for 'structs' so I went with that approach. Said
that I'm perfectly fine with squashing them.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2019-10-11 7:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-10 11:05 [PATCH v3 0/3] qapi: Add detection for the 'savevm' fix for blockdev Peter Krempa
2019-10-10 11:05 ` [PATCH v3 1/3] qapi: Add feature flags to commands in qapi Peter Krempa
2019-10-10 13:54 ` Markus Armbruster
2019-10-10 11:05 ` [PATCH v3 2/3] tests: qapi: Test 'features' of commands Peter Krempa
2019-10-10 13:53 ` Markus Armbruster
2019-10-11 7:46 ` Peter Krempa [this message]
2019-10-11 8:06 ` Markus Armbruster
2019-10-10 11:05 ` [PATCH v3 3/3] qapi: Allow introspecting fix for savevm's cooperation with blockdev Peter Krempa
2019-10-10 13:52 ` Markus Armbruster
2019-10-10 18:11 ` Eric Blake
2019-10-10 14:01 ` [PATCH v3 0/3] qapi: Add detection for the 'savevm' fix for blockdev Markus Armbruster
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=20191011074611.GA1979@andariel.pipo.sk \
--to=pkrempa@redhat.com \
--cc=armbru@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).