qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Xu <peterx@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Michael Roth <mdroth@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PULL 09/14] tests: add oob-test for qapi-schema
Date: Tue, 27 Mar 2018 09:30:09 -0500	[thread overview]
Message-ID: <20180327143014.1767669-10-eblake@redhat.com> (raw)
In-Reply-To: <20180327143014.1767669-1-eblake@redhat.com>

From: Peter Xu <peterx@redhat.com>

It simply tests the new OOB capability, and make sure the QAPISchema can
parse it correctly.

Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20180326063901.27425-7-peterx@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
---
 tests/test-qmp-cmds.c                   | 4 ++++
 tests/Makefile.include                  | 1 +
 tests/qapi-schema/oob-test.err          | 1 +
 tests/qapi-schema/oob-test.exit         | 1 +
 tests/qapi-schema/oob-test.json         | 2 ++
 tests/qapi-schema/oob-test.out          | 0
 tests/qapi-schema/qapi-schema-test.json | 3 +++
 tests/qapi-schema/qapi-schema-test.out  | 2 ++
 8 files changed, 14 insertions(+)
 create mode 100644 tests/qapi-schema/oob-test.err
 create mode 100644 tests/qapi-schema/oob-test.exit
 create mode 100644 tests/qapi-schema/oob-test.json
 create mode 100644 tests/qapi-schema/oob-test.out

diff --git a/tests/test-qmp-cmds.c b/tests/test-qmp-cmds.c
index 93fbbb1b733..db690cc5ae2 100644
--- a/tests/test-qmp-cmds.c
+++ b/tests/test-qmp-cmds.c
@@ -16,6 +16,10 @@ void qmp_user_def_cmd(Error **errp)
 {
 }

+void qmp_an_oob_command(Error **errp)
+{
+}
+
 Empty2 *qmp_user_def_cmd0(Error **errp)
 {
     return g_new0(Empty2, 1);
diff --git a/tests/Makefile.include b/tests/Makefile.include
index eb218a9539d..3b9a5e31a2c 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -523,6 +523,7 @@ qapi-schema += missing-comma-object.json
 qapi-schema += missing-type.json
 qapi-schema += nested-struct-data.json
 qapi-schema += non-objects.json
+qapi-schema += oob-test.json
 qapi-schema += pragma-doc-required-crap.json
 qapi-schema += pragma-extra-junk.json
 qapi-schema += pragma-name-case-whitelist-crap.json
diff --git a/tests/qapi-schema/oob-test.err b/tests/qapi-schema/oob-test.err
new file mode 100644
index 00000000000..35b60f74800
--- /dev/null
+++ b/tests/qapi-schema/oob-test.err
@@ -0,0 +1 @@
+tests/qapi-schema/oob-test.json:2: 'allow-oob' of command 'oob-command-1' should only use true value
diff --git a/tests/qapi-schema/oob-test.exit b/tests/qapi-schema/oob-test.exit
new file mode 100644
index 00000000000..d00491fd7e5
--- /dev/null
+++ b/tests/qapi-schema/oob-test.exit
@@ -0,0 +1 @@
+1
diff --git a/tests/qapi-schema/oob-test.json b/tests/qapi-schema/oob-test.json
new file mode 100644
index 00000000000..da9635920fb
--- /dev/null
+++ b/tests/qapi-schema/oob-test.json
@@ -0,0 +1,2 @@
+# Check against oob illegal value
+{ 'command': 'oob-command-1', 'allow-oob': 'some-string' }
diff --git a/tests/qapi-schema/oob-test.out b/tests/qapi-schema/oob-test.out
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/qapi-schema/qapi-schema-test.json b/tests/qapi-schema/qapi-schema-test.json
index c72dbd80509..06e30f452ea 100644
--- a/tests/qapi-schema/qapi-schema-test.json
+++ b/tests/qapi-schema/qapi-schema-test.json
@@ -139,6 +139,9 @@
 { 'command': 'boxed-struct', 'boxed': true, 'data': 'UserDefZero' }
 { 'command': 'boxed-union', 'data': 'UserDefNativeListUnion', 'boxed': true }

+# Smoke test on Out-Of-Band
+{ 'command': 'an-oob-command', 'allow-oob': true }
+
 # For testing integer range flattening in opts-visitor. The following schema
 # corresponds to the option format:
 #
diff --git a/tests/qapi-schema/qapi-schema-test.out b/tests/qapi-schema/qapi-schema-test.out
index 4f43370017c..467577d770b 100644
--- a/tests/qapi-schema/qapi-schema-test.out
+++ b/tests/qapi-schema/qapi-schema-test.out
@@ -166,6 +166,8 @@ command boxed-struct UserDefZero -> None
    gen=True success_response=True boxed=True oob=False
 command boxed-union UserDefNativeListUnion -> None
    gen=True success_response=True boxed=True oob=False
+command an-oob-command None -> None
+   gen=True success_response=True boxed=False oob=True
 object UserDefOptions
     member i64: intList optional=True
     member u64: uint64List optional=True
-- 
2.14.3

  parent reply	other threads:[~2018-03-27 14:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-27 14:30 [Qemu-devel] [PULL 00/14] QAPI changes for 2018-03-27, 2.12-rc1 Eric Blake
2018-03-27 14:30 ` [Qemu-devel] [PULL 01/14] qmp-test: fix response leak Eric Blake
2018-03-27 14:30 ` [Qemu-devel] [PULL 02/14] tests: Silence false positive warning on generated test name Eric Blake
2018-03-27 14:30 ` [Qemu-devel] [PULL 03/14] error: Strip trailing '\n' from error string arguments (again again) Eric Blake
2018-03-27 14:30 ` [Qemu-devel] [PULL 04/14] error: Remove NULL checks on error_propagate() calls Eric Blake
2018-03-27 14:30 ` [Qemu-devel] [PULL 05/14] qdict: remove useless cast Eric Blake
2018-03-27 14:30 ` [Qemu-devel] [PULL 06/14] qmp: fix qmp_capabilities error regression Eric Blake
2018-03-27 15:01   ` Marc-André Lureau
2018-03-27 15:16     ` Eric Blake
2018-03-27 15:31       ` Marc-André Lureau
2018-03-27 14:30 ` [Qemu-devel] [PULL 07/14] qapi: restrict allow-oob value to be "true" Eric Blake
2018-03-27 14:30 ` [Qemu-devel] [PULL 08/14] tests: let qapi-schema tests detect oob Eric Blake
2018-03-27 14:30 ` Eric Blake [this message]
2018-03-27 14:30 ` [Qemu-devel] [PULL 10/14] qmp: cleanup qmp queues properly Eric Blake
2018-03-27 14:30 ` [Qemu-devel] [PULL 11/14] monitor: new parameter "x-oob" Eric Blake
2018-03-27 14:30 ` [Qemu-devel] [PULL 12/14] tests: Add parameter to qtest_init_without_qmp_handshake Eric Blake
2018-03-27 14:30 ` [Qemu-devel] [PULL 13/14] tests: qmp-test: add test for new "x-oob" Eric Blake
2018-03-27 14:30 ` [Qemu-devel] [PULL 14/14] hmp.c: Revert hmp_info_cpus output format change Eric Blake
2018-03-27 15:23 ` [Qemu-devel] [PULL 00/14] QAPI changes for 2018-03-27, 2.12-rc1 Eric Blake

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=20180327143014.1767669-10-eblake@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=peterx@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).