backup: Wire up qemu full pull backup commands over QMP
[libvirt/ericb.git] / tests / storagepoolxml2xmltest.c
blob96dd04faec0149161b4aa7c8fe6d368ebcd207c0
1 #include <config.h>
3 #include <unistd.h>
5 #include <sys/types.h>
6 #include <fcntl.h>
8 #include "internal.h"
9 #include "testutils.h"
10 #include "storage_conf.h"
11 #include "testutilsqemu.h"
12 #include "virstring.h"
14 #include "storage/storage_util.h"
16 #define VIR_FROM_THIS VIR_FROM_NONE
18 static int
19 testCompareXMLToXMLFiles(const char *inxml, const char *outxml)
21 VIR_AUTOFREE(char *) actual = NULL;
22 VIR_AUTOPTR(virStoragePoolDef) dev = NULL;
24 if (!(dev = virStoragePoolDefParseFile(inxml)))
25 return -1;
27 if (!(actual = virStoragePoolDefFormat(dev)))
28 return -1;
30 if (virTestCompareToFile(actual, outxml) < 0)
31 return -1;
33 return 0;
36 static int
37 testCompareXMLToXMLHelper(const void *data)
39 VIR_AUTOFREE(char *) inxml = NULL;
40 VIR_AUTOFREE(char *) outxml = NULL;
42 if (virAsprintf(&inxml, "%s/storagepoolxml2xmlin/%s.xml",
43 abs_srcdir, (const char*)data) < 0 ||
44 virAsprintf(&outxml, "%s/storagepoolxml2xmlout/%s.xml",
45 abs_srcdir, (const char*)data) < 0)
46 return -1;
48 return testCompareXMLToXMLFiles(inxml, outxml);
51 static int
52 mymain(void)
54 int ret = 0;
56 #define DO_TEST(name) \
57 if (virTestRun("Storage Pool XML-2-XML " name, \
58 testCompareXMLToXMLHelper, (name)) < 0) \
59 ret = -1
61 if (storageRegisterAll() < 0)
62 return EXIT_FAILURE;
64 DO_TEST("pool-dir");
65 DO_TEST("pool-dir-naming");
66 DO_TEST("pool-fs");
67 DO_TEST("pool-logical");
68 DO_TEST("pool-logical-nopath");
69 DO_TEST("pool-logical-create");
70 DO_TEST("pool-logical-noname");
71 DO_TEST("pool-disk");
72 DO_TEST("pool-disk-device-nopartsep");
73 DO_TEST("pool-iscsi");
74 DO_TEST("pool-iscsi-auth");
75 DO_TEST("pool-netfs");
76 DO_TEST("pool-netfs-slash");
77 DO_TEST("pool-netfs-auto");
78 DO_TEST("pool-netfs-protocol-ver");
79 DO_TEST("pool-netfs-gluster");
80 DO_TEST("pool-netfs-cifs");
81 #ifdef WITH_STORAGE_FS
82 DO_TEST("pool-netfs-ns-mountopts");
83 #endif
84 DO_TEST("pool-scsi");
85 DO_TEST("pool-scsi-type-scsi-host");
86 DO_TEST("pool-scsi-type-fc-host");
87 DO_TEST("pool-scsi-type-fc-host-managed");
88 DO_TEST("pool-mpath");
89 DO_TEST("pool-iscsi-multiiqn");
90 DO_TEST("pool-iscsi-vendor-product");
91 DO_TEST("pool-sheepdog");
92 DO_TEST("pool-gluster");
93 DO_TEST("pool-gluster-sub");
94 DO_TEST("pool-scsi-type-scsi-host-stable");
95 DO_TEST("pool-zfs");
96 DO_TEST("pool-zfs-sourcedev");
97 DO_TEST("pool-rbd");
98 #ifdef WITH_STORAGE_RBD
99 DO_TEST("pool-rbd-ipv6");
100 DO_TEST("pool-rbd-refresh-volume-allocation");
101 DO_TEST("pool-rbd-ns-configopts");
102 #endif
103 DO_TEST("pool-vstorage");
104 DO_TEST("pool-iscsi-direct-auth");
105 DO_TEST("pool-iscsi-direct");
107 return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
110 VIR_TEST_MAIN(mymain)