aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/test-qmp-cmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/test-qmp-cmds.c')
-rw-r--r--tests/unit/test-qmp-cmds.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/unit/test-qmp-cmds.c b/tests/unit/test-qmp-cmds.c
index 1079d35122..cba982154b 100644
--- a/tests/unit/test-qmp-cmds.c
+++ b/tests/unit/test-qmp-cmds.c
@@ -281,6 +281,28 @@ static void test_dispatch_cmd_io(void)
qobject_unref(ret3);
}
+static void test_dispatch_cmd_deprecated(void)
+{
+ const char *cmd = "{ 'execute': 'test-command-features1' }";
+ QDict *ret;
+
+ memset(&compat_policy, 0, sizeof(compat_policy));
+
+ /* accept */
+ ret = qobject_to(QDict, do_qmp_dispatch(false, cmd));
+ assert(ret && qdict_size(ret) == 0);
+ qobject_unref(ret);
+
+ compat_policy.has_deprecated_input = true;
+ compat_policy.deprecated_input = COMPAT_POLICY_INPUT_ACCEPT;
+ ret = qobject_to(QDict, do_qmp_dispatch(false, cmd));
+ assert(ret && qdict_size(ret) == 0);
+ qobject_unref(ret);
+
+ compat_policy.deprecated_input = COMPAT_POLICY_INPUT_REJECT;
+ do_qmp_dispatch_error(false, ERROR_CLASS_COMMAND_NOT_FOUND, cmd);
+}
+
static void test_dispatch_cmd_ret_deprecated(void)
{
const char *cmd = "{ 'execute': 'test-features0' }";
@@ -379,6 +401,8 @@ int main(int argc, char **argv)
g_test_add_func("/qmp/dispatch_cmd_io", test_dispatch_cmd_io);
g_test_add_func("/qmp/dispatch_cmd_success_response",
test_dispatch_cmd_success_response);
+ g_test_add_func("/qmp/dispatch_cmd_deprecated",
+ test_dispatch_cmd_deprecated);
g_test_add_func("/qmp/dispatch_cmd_ret_deprecated",
test_dispatch_cmd_ret_deprecated);
g_test_add_func("/qmp/dealloc_types", test_dealloc_types);