diff options
Diffstat (limited to 'tests/test-qga.c')
-rw-r--r-- | tests/test-qga.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/test-qga.c b/tests/test-qga.c index 350f27812a..d638b1571a 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, |