aboutsummaryrefslogtreecommitdiff
path: root/tests/test-qga.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-07-05 11:25:14 +0100
committerPeter Maydell <peter.maydell@linaro.org>2018-07-05 11:25:14 +0100
commit4fd1cbaf146d4ab35f465bba0fe23115c33cd5a7 (patch)
treed93d0fa4d40d7b5a76d22b9469da56012d4a18e3 /tests/test-qga.c
parent5dafaf4fbceeb4c5d204039045b50b2f37443ff4 (diff)
parent153d73f320f422ecb5807ac3a93547b9f819599b (diff)
downloadqemu-4fd1cbaf146d4ab35f465bba0fe23115c33cd5a7.zip
qemu-4fd1cbaf146d4ab35f465bba0fe23115c33cd5a7.tar.gz
qemu-4fd1cbaf146d4ab35f465bba0fe23115c33cd5a7.tar.bz2
Merge remote-tracking branch 'remotes/armbru/tags/pull-monitor-2018-07-03-v2' into staging
Monitor patches for 2018-07-03 # gpg: Signature made Tue 03 Jul 2018 22:20:13 BST # gpg: using RSA key 3870B400EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-monitor-2018-07-03-v2: (32 commits) qapi: Polish command flags documentation in qapi-code-gen.txt monitor: Improve some comments qmp: Clean up capability negotiation after commit 02130314d8c qobject: Let qobject_from_jsonf() fail instead of abort qmp: Switch timestamp_put() to qdict_from_jsonf_nofail() qmp: Add some comments around null responses qmp: Simplify monitor_qmp_respond() qmp: Replace get_qmp_greeting() by qmp_greeting() qmp: Replace monitor_json_emitter{,raw}() by qmp_{queue,send}_response() qmp: Use QDict * instead of QObject * for response objects qmp: De-duplicate error response building qobject: New qdict_from_jsonf_nofail() monitor: Peel off @mon_global wrapper monitor: Rename use_io_thr to use_io_thread qmp: Don't let JSON errors jump the queue qmp: Don't let malformed in-band commands jump the queue tests/qmp-test: Demonstrate QMP errors jumping the queue qmp: Simplify code around monitor_qmp_dispatch_one() qmp: Always free QMPRequest with qmp_request_free() qmp: Revert change to handle_qmp_command tracepoint ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests/test-qga.c')
-rw-r--r--tests/test-qga.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/test-qga.c b/tests/test-qga.c
index 350f278..d638b15 100644
--- a/tests/test-qga.c
+++ b/tests/test-qga.c
@@ -227,6 +227,38 @@ static void test_qga_ping(gconstpointer fix)
qobject_unref(ret);
}
+static void test_qga_invalid_id(gconstpointer fix)
+{
+ const TestFixture *fixture = fix;
+ QDict *ret, *error;
+ const char *class;
+
+ ret = qmp_fd(fixture->fd, "{'execute': 'guest-ping', 'id': 1}");
+ g_assert_nonnull(ret);
+
+ error = qdict_get_qdict(ret, "error");
+ class = qdict_get_try_str(error, "class");
+ g_assert_cmpstr(class, ==, "GenericError");
+
+ qobject_unref(ret);
+}
+
+static void test_qga_invalid_oob(gconstpointer fix)
+{
+ const TestFixture *fixture = fix;
+ QDict *ret, *error;
+ const char *class;
+
+ ret = qmp_fd(fixture->fd, "{'exec-oob': 'guest-ping'}");
+ g_assert_nonnull(ret);
+
+ error = qdict_get_qdict(ret, "error");
+ class = qdict_get_try_str(error, "class");
+ g_assert_cmpstr(class, ==, "GenericError");
+
+ qobject_unref(ret);
+}
+
static void test_qga_invalid_args(gconstpointer fix)
{
const TestFixture *fixture = fix;
@@ -982,6 +1014,8 @@ int main(int argc, char **argv)
g_test_add_data_func("/qga/file-ops", &fix, test_qga_file_ops);
g_test_add_data_func("/qga/file-write-read", &fix, test_qga_file_write_read);
g_test_add_data_func("/qga/get-time", &fix, test_qga_get_time);
+ g_test_add_data_func("/qga/invalid-id", &fix, test_qga_invalid_id);
+ g_test_add_data_func("/qga/invalid-oob", &fix, test_qga_invalid_oob);
g_test_add_data_func("/qga/invalid-cmd", &fix, test_qga_invalid_cmd);
g_test_add_data_func("/qga/invalid-args", &fix, test_qga_invalid_args);
g_test_add_data_func("/qga/fsfreeze-status", &fix,