Commit 442b09b8 authored by Marc-André Lureau's avatar Marc-André Lureau Committed by Thomas Huth
Browse files

tests: add qmp/object-add-without-props test



test_object_add_without_props() tests a bug in qmp_object_add() we
fixed in commit e64c75a9.  Sadly, we don't have systematic
object-add tests.  This lone test can go into qmp-cmd-test for want of
a better home.

Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: default avatarThomas Huth <thuth@redhat.com>
Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
parent ebb4d82d
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -197,6 +197,19 @@ static void add_query_tests(QmpSchema *schema)
    }
}

static void test_object_add_without_props(void)
{
    QTestState *qts;
    QDict *resp;

    qts = qtest_init(common_args);
    resp = qtest_qmp(qts, "{'execute': 'object-add', 'arguments':"
                    " {'qom-type': 'memory-backend-ram', 'id': 'ram1' } }");
    g_assert_nonnull(resp);
    qmp_assert_error_class(resp, "GenericError");
    qtest_quit(qts);
}

int main(int argc, char *argv[])
{
    QmpSchema schema;
@@ -206,6 +219,11 @@ int main(int argc, char *argv[])

    qmp_schema_init(&schema);
    add_query_tests(&schema);

    qtest_add_func("qmp/object-add-without-props",
                   test_object_add_without_props);
    /* TODO: add coverage of generic object-add failure modes */

    ret = g_test_run();

    qmp_schema_cleanup(&schema);