diff mbox series

[10/32] tests/test-qga: Demonstrate the guest-agent ignores "control"

Message ID 20180702162218.13678-11-armbru@redhat.com
State New
Headers show
Series qmp: Fixes and cleanups around OOB commands | expand

Commit Message

Markus Armbruster July 2, 2018, 4:21 p.m. UTC
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 tests/test-qga.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Eric Blake July 3, 2018, 1:47 a.m. UTC | #1
On 07/02/2018 11:21 AM, Markus Armbruster wrote:
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>   tests/test-qga.c | 17 +++++++++++++++++
>   1 file changed, 17 insertions(+)

Well, if we get rid of 'control' in favor of 'exec-oob', this test would 
still have to test that QGA doesn't support oob.

Reviewed-by: Eric Blake <eblake@redhat.com>
Markus Armbruster July 3, 2018, 6:29 a.m. UTC | #2
Eric Blake <eblake@redhat.com> writes:

> On 07/02/2018 11:21 AM, Markus Armbruster wrote:
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>>   tests/test-qga.c | 17 +++++++++++++++++
>>   1 file changed, 17 insertions(+)
>
> Well, if we get rid of 'control' in favor of 'exec-oob', this test
> would still have to test that QGA doesn't support oob.
>
> Reviewed-by: Eric Blake <eblake@redhat.com>

PATCH 12 gets rid of it, but the test still serves to cover "random crap
gets rejected" then.
diff mbox series

Patch

diff --git a/tests/test-qga.c b/tests/test-qga.c
index 564a4594b5..2e9e0f73bb 100644
--- a/tests/test-qga.c
+++ b/tests/test-qga.c
@@ -243,6 +243,22 @@  static void test_qga_invalid_id(gconstpointer fix)
     qobject_unref(ret);
 }
 
+static void test_qga_invalid_oob(gconstpointer fix)
+{
+    /* FIXME "control" is ignored; it should be rejected */
+    const TestFixture *fixture = fix;
+    QDict *ret;
+
+    ret = qmp_fd(fixture->fd, "{'execute': 'guest-ping',"
+                 " 'control': {'run-oob': true}}");
+    g_assert_nonnull(ret);
+    qmp_assert_no_error(ret);
+
+    qdict_get_qdict(ret, "return");
+
+    qobject_unref(ret);
+}
+
 static void test_qga_invalid_args(gconstpointer fix)
 {
     const TestFixture *fixture = fix;
@@ -951,6 +967,7 @@  int main(int argc, char **argv)
     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,