spapr_pci: Get rid of duplicate code for node name creation
[qemu/ar7.git] / tests / ipoctal232-test.c
blob42d53718b80185a0814c5a87358a1c8cb11e42bd
1 /*
2 * QTest testcase for IndustryPack Octal-RS232
4 * Copyright (c) 2014 SUSE LINUX Products GmbH
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
8 */
10 #include "qemu/osdep.h"
11 #include "libqtest.h"
12 #include "libqos/qgraph.h"
14 typedef struct QIpoctal232 QIpoctal232;
16 struct QIpoctal232 {
17 QOSGraphObject obj;
20 /* Tests only initialization so far. TODO: Replace with functional tests */
21 static void nop(void *obj, void *data, QGuestAllocator *alloc)
25 static void *ipoctal232_create(void *pci_bus, QGuestAllocator *alloc,
26 void *addr)
28 QIpoctal232 *ipoctal232 = g_new0(QIpoctal232, 1);
30 return &ipoctal232->obj;
33 static void ipoctal232_register_nodes(void)
35 qos_node_create_driver("ipoctal232", ipoctal232_create);
36 qos_node_consumes("ipoctal232", "ipack", &(QOSGraphEdgeOptions) {
37 .extra_device_opts = "bus=ipack0.0",
38 });
41 libqos_init(ipoctal232_register_nodes);
43 static void register_ipoctal232_test(void)
45 qos_add_test("nop", "ipoctal232", nop, NULL);
48 libqos_init(register_ipoctal232_test);