summaryrefslogtreecommitdiffstats
path: root/qemu/tests/check-qom-interface.c
diff options
context:
space:
mode:
authorRajithaY <rajithax.yerrumsetty@intel.com>2017-04-25 03:31:15 -0700
committerRajitha Yerrumchetty <rajithax.yerrumsetty@intel.com>2017-05-22 06:48:08 +0000
commitbb756eebdac6fd24e8919e2c43f7d2c8c4091f59 (patch)
treeca11e03542edf2d8f631efeca5e1626d211107e3 /qemu/tests/check-qom-interface.c
parenta14b48d18a9ed03ec191cf16b162206998a895ce (diff)
Adding qemu as a submodule of KVMFORNFV
This Patch includes the changes to add qemu as a submodule to kvmfornfv repo and make use of the updated latest qemu for the execution of all testcase Change-Id: I1280af507a857675c7f81d30c95255635667bdd7 Signed-off-by:RajithaY<rajithax.yerrumsetty@intel.com>
Diffstat (limited to 'qemu/tests/check-qom-interface.c')
-rw-r--r--qemu/tests/check-qom-interface.c106
1 files changed, 0 insertions, 106 deletions
diff --git a/qemu/tests/check-qom-interface.c b/qemu/tests/check-qom-interface.c
deleted file mode 100644
index 09354deb7..000000000
--- a/qemu/tests/check-qom-interface.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * QOM interface test.
- *
- * Copyright (C) 2013 Red Hat Inc.
- *
- * Authors:
- * Igor Mammedov <imammedo@redhat.com>
- *
- * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
- * See the COPYING.LIB file in the top-level directory.
- */
-#include "qemu/osdep.h"
-#include <glib.h>
-
-#include "qom/object.h"
-#include "qemu/module.h"
-
-
-#define TYPE_TEST_IF "test-interface"
-#define TEST_IF_CLASS(klass) \
- OBJECT_CLASS_CHECK(TestIfClass, (klass), TYPE_TEST_IF)
-#define TEST_IF_GET_CLASS(obj) \
- OBJECT_GET_CLASS(TestIfClass, (obj), TYPE_TEST_IF)
-#define TEST_IF(obj) \
- INTERFACE_CHECK(TestIf, (obj), TYPE_TEST_IF)
-
-typedef struct TestIf {
- Object parent_obj;
-} TestIf;
-
-typedef struct TestIfClass {
- InterfaceClass parent_class;
-
- uint32_t test;
-} TestIfClass;
-
-static const TypeInfo test_if_info = {
- .name = TYPE_TEST_IF,
- .parent = TYPE_INTERFACE,
- .class_size = sizeof(TestIfClass),
-};
-
-#define PATTERN 0xFAFBFCFD
-
-static void test_class_init(ObjectClass *oc, void *data)
-{
- TestIfClass *tc = TEST_IF_CLASS(oc);
-
- g_assert(tc);
- tc->test = PATTERN;
-}
-
-#define TYPE_DIRECT_IMPL "direct-impl"
-
-static const TypeInfo direct_impl_info = {
- .name = TYPE_DIRECT_IMPL,
- .parent = TYPE_OBJECT,
- .class_init = test_class_init,
- .interfaces = (InterfaceInfo[]) {
- { TYPE_TEST_IF },
- { }
- }
-};
-
-#define TYPE_INTERMEDIATE_IMPL "intermediate-impl"
-
-static const TypeInfo intermediate_impl_info = {
- .name = TYPE_INTERMEDIATE_IMPL,
- .parent = TYPE_DIRECT_IMPL,
-};
-
-static void test_interface_impl(const char *type)
-{
- Object *obj = object_new(type);
- TestIf *iobj = TEST_IF(obj);
- TestIfClass *ioc = TEST_IF_GET_CLASS(iobj);
-
- g_assert(iobj);
- g_assert(ioc->test == PATTERN);
-}
-
-static void interface_direct_test(void)
-{
- test_interface_impl(TYPE_DIRECT_IMPL);
-}
-
-static void interface_intermediate_test(void)
-{
- test_interface_impl(TYPE_INTERMEDIATE_IMPL);
-}
-
-int main(int argc, char **argv)
-{
- g_test_init(&argc, &argv, NULL);
-
- module_call_init(MODULE_INIT_QOM);
- type_register_static(&test_if_info);
- type_register_static(&direct_impl_info);
- type_register_static(&intermediate_impl_info);
-
- g_test_add_func("/qom/interface/direct_impl", interface_direct_test);
- g_test_add_func("/qom/interface/intermediate_impl",
- interface_intermediate_test);
-
- return g_test_run();
-}