backup: Wire up qemu full pull backup commands over QMP
[libvirt/ericb.git] / tests / virdbustest.c
blobec380e8fc2191118bc7a53a4ce0e46904be52b55
1 /*
2 * Copyright (C) 2013, 2014 Red Hat, Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see
16 * <http://www.gnu.org/licenses/>.
19 #include <config.h>
21 #define LIBVIRT_VIRDBUSPRIV_H_ALLOW
22 #include "virdbuspriv.h"
23 #include "virlog.h"
24 #include "testutils.h"
26 VIR_LOG_INIT("tests.dbustest");
28 #define VERIFY(typname, valorig, valnew, fmt) \
29 do { \
30 VIR_DEBUG("Compare " typname " '" fmt "' to '" \
31 fmt "'", valorig, valnew); \
32 if (valorig != valnew) { \
33 fprintf(stderr, "Failed to round-trip " typname " '" \
34 fmt "' to '" fmt "'\n", valorig, valnew); \
35 goto cleanup; \
36 } \
37 } while (0)
39 #define VERIFY_STR(typname, valorig, valnew, fmt) \
40 do { \
41 VIR_DEBUG("Compare " typname " '" fmt "' to '" \
42 fmt "'", valorig, valnew); \
43 if (STRNEQ(valorig, valnew)) { \
44 fprintf(stderr, "Failed to round-trip " typname " '" \
45 fmt "' to '" fmt "'\n", valorig, valnew); \
46 goto cleanup; \
47 } \
48 } while (0)
50 static int testMessageSimple(const void *args ATTRIBUTE_UNUSED)
52 DBusMessage *msg = NULL;
53 int ret = -1;
54 unsigned char in_byte = 200, out_byte = 0;
55 bool in_bool = true, out_bool = false;
56 short in_int16 = 0xfefe, out_int16 = 0;
57 unsigned short in_uint16 = 32000, out_uint16 = 0;
58 int in_int32 = 100000000, out_int32 = 0;
59 unsigned int in_uint32 = 200000000, out_uint32 = 0;
60 long long in_int64 = 1000000000000LL, out_int64 = 0;
61 unsigned long long in_uint64 = 2000000000000LL, out_uint64 = 0;
62 double in_double = 3.14159265359, out_double = 0;
63 const char *in_string = "Hello World";
64 char *out_string = NULL;
65 const char *in_objectpath = "/org/libvirt/test";
66 char *out_objectpath = NULL;
67 const char *in_signature = "ybnqiuxtdsog";
68 char *out_signature = NULL;
70 if (!(msg = dbus_message_new_method_call("org.libvirt.test",
71 "/org/libvirt/test",
72 "org.libvirt.test.astrochicken",
73 "cluck"))) {
74 VIR_DEBUG("Failed to allocate method call");
75 goto cleanup;
78 if (virDBusMessageEncode(msg,
79 "ybnqiuxtdsog",
80 in_byte, in_bool,
81 in_int16, in_uint16,
82 in_int32, in_uint32,
83 in_int64, in_uint64,
84 in_double, in_string,
85 in_objectpath, in_signature) < 0) {
86 VIR_DEBUG("Failed to encode arguments");
87 goto cleanup;
90 if (virDBusMessageDecode(msg,
91 "ybnqiuxtdsog",
92 &out_byte, &out_bool,
93 &out_int16, &out_uint16,
94 &out_int32, &out_uint32,
95 &out_int64, &out_uint64,
96 &out_double, &out_string,
97 &out_objectpath, &out_signature) < 0) {
98 VIR_DEBUG("Failed to decode arguments");
99 goto cleanup;
102 VERIFY("byte", in_byte, out_byte, "%d");
103 VERIFY("bool", in_bool, out_bool, "%d");
104 VERIFY("int16", in_int16, out_int16, "%d");
105 VERIFY("uint16", in_int16, out_int16, "%d");
106 VERIFY("int32", in_int32, out_int32, "%d");
107 VERIFY("uint32", in_int32, out_int32, "%d");
108 VERIFY("int64", in_int64, out_int64, "%lld");
109 VERIFY("uint64", in_int64, out_int64, "%lld");
110 VERIFY("double", in_double, out_double, "%lf");
111 VERIFY_STR("string", in_string, out_string, "%s");
112 VERIFY_STR("objectpath", in_objectpath, out_objectpath, "%s");
113 VERIFY_STR("signature", in_signature, out_signature, "%s");
115 ret = 0;
117 cleanup:
118 VIR_FREE(out_string);
119 VIR_FREE(out_signature);
120 VIR_FREE(out_objectpath);
121 virDBusMessageUnref(msg);
122 return ret;
126 static int testMessageVariant(const void *args ATTRIBUTE_UNUSED)
128 DBusMessage *msg = NULL;
129 int ret = -1;
130 const char *in_str1 = "Hello";
131 int in_int32 = 100000000, out_int32 = 0;
132 const char *in_str2 = "World";
133 char *out_str1 = NULL, *out_str2 = NULL;
135 if (!(msg = dbus_message_new_method_call("org.libvirt.test",
136 "/org/libvirt/test",
137 "org.libvirt.test.astrochicken",
138 "cluck"))) {
139 VIR_DEBUG("Failed to allocate method call");
140 goto cleanup;
143 if (virDBusMessageEncode(msg,
144 "svs",
145 in_str1,
146 "i", in_int32,
147 in_str2) < 0) {
148 VIR_DEBUG("Failed to encode arguments");
149 goto cleanup;
152 if (virDBusMessageDecode(msg,
153 "svs",
154 &out_str1,
155 "i", &out_int32,
156 &out_str2) < 0) {
157 VIR_DEBUG("Failed to decode arguments");
158 goto cleanup;
162 VERIFY_STR("str1", in_str1, out_str1, "%s");
163 VERIFY("int32", in_int32, out_int32, "%d");
164 VERIFY_STR("str2", in_str2, out_str2, "%s");
166 ret = 0;
168 cleanup:
169 VIR_FREE(out_str1);
170 VIR_FREE(out_str2);
171 virDBusMessageUnref(msg);
172 return ret;
175 static int testMessageArray(const void *args ATTRIBUTE_UNUSED)
177 DBusMessage *msg = NULL;
178 int ret = -1;
179 const char *in_str1 = "Hello";
180 int in_int32a = 1000000000, out_int32a = 0;
181 int in_int32b = 2000000000, out_int32b = 0;
182 int in_int32c = -2000000000, out_int32c = 0;
183 bool in_bool[] = { true, false, true }, out_bool[] = { false, true, false};
184 const char *in_str2 = "World";
185 char *out_str1 = NULL, *out_str2 = NULL;
187 if (!(msg = dbus_message_new_method_call("org.libvirt.test",
188 "/org/libvirt/test",
189 "org.libvirt.test.astrochicken",
190 "cluck"))) {
191 VIR_DEBUG("Failed to allocate method call");
192 goto cleanup;
195 if (virDBusMessageEncode(msg,
196 "saiabs",
197 in_str1,
198 3, in_int32a, in_int32b, in_int32c,
199 3, in_bool[0], in_bool[1], in_bool[2],
200 in_str2) < 0) {
201 VIR_DEBUG("Failed to encode arguments");
202 goto cleanup;
205 if (virDBusMessageDecode(msg,
206 "saiabs",
207 &out_str1,
208 3, &out_int32a, &out_int32b, &out_int32c,
209 3, &out_bool[0], &out_bool[1], &out_bool[2],
210 &out_str2) < 0) {
211 VIR_DEBUG("Failed to decode arguments");
212 goto cleanup;
216 VERIFY_STR("str1", in_str1, out_str1, "%s");
217 VERIFY("int32a", in_int32a, out_int32a, "%d");
218 VERIFY("int32b", in_int32b, out_int32b, "%d");
219 VERIFY("int32c", in_int32c, out_int32c, "%d");
220 VERIFY("bool[0]", in_bool[0], out_bool[0], "%d");
221 VERIFY("bool[1]", in_bool[1], out_bool[1], "%d");
222 VERIFY("bool[2]", in_bool[2], out_bool[2], "%d");
223 VERIFY_STR("str2", in_str2, out_str2, "%s");
225 ret = 0;
227 cleanup:
228 VIR_FREE(out_str1);
229 VIR_FREE(out_str2);
230 virDBusMessageUnref(msg);
231 return ret;
234 static int testMessageEmptyArrayRef(const void *args ATTRIBUTE_UNUSED)
236 DBusMessage *msg = NULL;
237 int ret = -1;
238 const char *in_strv1[] = {};
239 size_t out_nstrv1;
240 char **out_strv1 = NULL;
242 if (!(msg = dbus_message_new_method_call("org.libvirt.test",
243 "/org/libvirt/test",
244 "org.libvirt.test.astrochicken",
245 "cluck"))) {
246 VIR_DEBUG("Failed to allocate method call");
247 goto cleanup;
250 if (virDBusMessageEncode(msg,
251 "a&s",
252 0, in_strv1) < 0) {
253 VIR_DEBUG("Failed to encode arguments");
254 goto cleanup;
257 if (virDBusMessageDecode(msg,
258 "a&s",
259 &out_nstrv1, &out_strv1) < 0) {
260 VIR_DEBUG("Failed to decode arguments");
261 goto cleanup;
265 if (out_nstrv1 != 0) {
266 fprintf(stderr, "Expected 0 string, but got %zu\n",
267 out_nstrv1);
268 goto cleanup;
271 ret = 0;
273 cleanup:
274 virDBusMessageUnref(msg);
275 return ret;
278 static int testMessageSingleArrayRef(const void *args ATTRIBUTE_UNUSED)
280 DBusMessage *msg = NULL;
281 int ret = -1;
282 const char *in_strv1[] = {
283 "Fishfood",
285 char **out_strv1 = NULL;
286 size_t out_nstrv1 = 0;
288 if (!(msg = dbus_message_new_method_call("org.libvirt.test",
289 "/org/libvirt/test",
290 "org.libvirt.test.astrochicken",
291 "cluck"))) {
292 VIR_DEBUG("Failed to allocate method call");
293 goto cleanup;
296 if (virDBusMessageEncode(msg,
297 "a&s",
298 1, in_strv1) < 0) {
299 VIR_DEBUG("Failed to encode arguments");
300 goto cleanup;
303 if (virDBusMessageDecode(msg,
304 "a&s",
305 &out_nstrv1, &out_strv1) < 0) {
306 VIR_DEBUG("Failed to decode arguments");
307 goto cleanup;
311 if (out_nstrv1 != 1) {
312 fprintf(stderr, "Expected 1 string, but got %zu\n",
313 out_nstrv1);
314 goto cleanup;
316 VERIFY_STR("strv1[0]", in_strv1[0], out_strv1[0], "%s");
318 ret = 0;
320 cleanup:
321 if (out_strv1)
322 VIR_FREE(out_strv1[0]);
323 VIR_FREE(out_strv1);
324 virDBusMessageUnref(msg);
325 return ret;
328 static int testMessageArrayRef(const void *args ATTRIBUTE_UNUSED)
330 DBusMessage *msg = NULL;
331 int ret = -1;
332 const char *in_str1 = "Hello";
333 int in_int32[] = {
334 100000000, 2000000000, -2000000000
336 bool in_bool[] = { true, false, true };
337 const char *in_strv1[] = {
338 "Fishfood",
340 const char *in_strv2[] = {
341 "Hello", "World",
343 int *out_int32 = NULL;
344 size_t out_nint32 = 0;
345 bool *out_bool = NULL;
346 size_t out_nbool = 0;
347 char **out_strv1 = NULL;
348 char **out_strv2 = NULL;
349 size_t out_nstrv1 = 0;
350 size_t out_nstrv2 = 0;
351 const char *in_str2 = "World";
352 char *out_str1 = NULL, *out_str2 = NULL;
353 size_t i;
355 if (!(msg = dbus_message_new_method_call("org.libvirt.test",
356 "/org/libvirt/test",
357 "org.libvirt.test.astrochicken",
358 "cluck"))) {
359 VIR_DEBUG("Failed to allocate method call");
360 goto cleanup;
363 if (virDBusMessageEncode(msg,
364 "sa&sa&ia&ba&ss",
365 in_str1,
366 1, in_strv1,
367 3, in_int32,
368 3, in_bool,
369 2, in_strv2,
370 in_str2) < 0) {
371 VIR_DEBUG("Failed to encode arguments");
372 goto cleanup;
375 if (virDBusMessageDecode(msg,
376 "sa&sa&ia&ba&ss",
377 &out_str1,
378 &out_nstrv1, &out_strv1,
379 &out_nint32, &out_int32,
380 &out_nbool, &out_bool,
381 &out_nstrv2, &out_strv2,
382 &out_str2) < 0) {
383 VIR_DEBUG("Failed to decode arguments");
384 goto cleanup;
388 VERIFY_STR("str1", in_str1, out_str1, "%s");
389 if (out_nstrv1 != 1) {
390 fprintf(stderr, "Expected 1 string, but got %zu\n",
391 out_nstrv1);
392 goto cleanup;
394 VERIFY_STR("strv1[0]", in_strv1[0], out_strv1[0], "%s");
396 if (out_nint32 != 3) {
397 fprintf(stderr, "Expected 3 integers, but got %zu\n",
398 out_nint32);
399 goto cleanup;
401 VERIFY("int32a", in_int32[0], out_int32[0], "%d");
402 VERIFY("int32b", in_int32[1], out_int32[1], "%d");
403 VERIFY("int32c", in_int32[2], out_int32[2], "%d");
405 if (out_nbool != 3) {
406 fprintf(stderr, "Expected 3 bools, but got %zu\n",
407 out_nbool);
408 goto cleanup;
410 VERIFY("bool[0]", in_bool[0], out_bool[0], "%d");
411 VERIFY("bool[1]", in_bool[1], out_bool[1], "%d");
412 VERIFY("bool[2]", in_bool[2], out_bool[2], "%d");
414 if (out_nstrv2 != 2) {
415 fprintf(stderr, "Expected 2 strings, but got %zu\n",
416 out_nstrv2);
417 goto cleanup;
419 VERIFY_STR("strv2[0]", in_strv2[0], out_strv2[0], "%s");
420 VERIFY_STR("strv2[1]", in_strv2[1], out_strv2[1], "%s");
422 VERIFY_STR("str2", in_str2, out_str2, "%s");
424 ret = 0;
426 cleanup:
427 VIR_FREE(out_int32);
428 VIR_FREE(out_bool);
429 VIR_FREE(out_str1);
430 VIR_FREE(out_str2);
431 for (i = 0; i < out_nstrv1; i++)
432 VIR_FREE(out_strv1[i]);
433 VIR_FREE(out_strv1);
434 for (i = 0; i < out_nstrv2; i++)
435 VIR_FREE(out_strv2[i]);
436 VIR_FREE(out_strv2);
437 virDBusMessageUnref(msg);
438 return ret;
441 static int testMessageStruct(const void *args ATTRIBUTE_UNUSED)
443 DBusMessage *msg = NULL;
444 int ret = -1;
445 unsigned char in_byte = 200, out_byte = 0;
446 bool in_bool = true, out_bool = false;
447 short in_int16 = 12000, out_int16 = 0;
448 unsigned short in_uint16 = 32000, out_uint16 = 0;
449 int in_int32 = 100000000, out_int32 = 0;
450 unsigned int in_uint32 = 200000000, out_uint32 = 0;
451 long long in_int64 = -1000000000000LL, out_int64 = 0;
452 unsigned long long in_uint64 = 2000000000000LL, out_uint64 = 0;
453 double in_double = 3.14159265359, out_double = 0;
454 const char *in_string = "Hello World";
455 char *out_string = NULL;
456 const char *in_objectpath = "/org/libvirt/test";
457 char *out_objectpath = NULL;
458 const char *in_signature = "ybnqiuxtdsog";
459 char *out_signature = NULL;
461 if (!(msg = dbus_message_new_method_call("org.libvirt.test",
462 "/org/libvirt/test",
463 "org.libvirt.test.astrochicken",
464 "cluck"))) {
465 VIR_DEBUG("Failed to allocate method call");
466 goto cleanup;
469 if (virDBusMessageEncode(msg,
470 "ybn(qiuxtds)og",
471 in_byte, in_bool,
472 in_int16, in_uint16,
473 in_int32, in_uint32,
474 in_int64, in_uint64,
475 in_double, in_string,
476 in_objectpath, in_signature) < 0) {
477 VIR_DEBUG("Failed to encode arguments");
478 goto cleanup;
481 if (virDBusMessageDecode(msg,
482 "ybn(qiuxtds)og",
483 &out_byte, &out_bool,
484 &out_int16, &out_uint16,
485 &out_int32, &out_uint32,
486 &out_int64, &out_uint64,
487 &out_double, &out_string,
488 &out_objectpath, &out_signature) < 0) {
489 VIR_DEBUG("Failed to decode arguments");
490 goto cleanup;
493 VERIFY("byte", in_byte, out_byte, "%d");
494 VERIFY("bool", in_bool, out_bool, "%d");
495 VERIFY("int16", in_int16, out_int16, "%d");
496 VERIFY("uint16", in_int16, out_int16, "%d");
497 VERIFY("int32", in_int32, out_int32, "%d");
498 VERIFY("uint32", in_int32, out_int32, "%d");
499 VERIFY("int64", in_int64, out_int64, "%lld");
500 VERIFY("uint64", in_int64, out_int64, "%lld");
501 VERIFY("double", in_double, out_double, "%lf");
502 VERIFY_STR("string", in_string, out_string, "%s");
503 VERIFY_STR("objectpath", in_objectpath, out_objectpath, "%s");
504 VERIFY_STR("signature", in_signature, out_signature, "%s");
506 ret = 0;
508 cleanup:
509 VIR_FREE(out_string);
510 VIR_FREE(out_signature);
511 VIR_FREE(out_objectpath);
512 virDBusMessageUnref(msg);
513 return ret;
517 static int testMessageDict(const void *args ATTRIBUTE_UNUSED)
519 DBusMessage *msg = NULL;
520 int ret = -1;
521 const char *in_str1 = "Hello";
522 int in_int32a = 100000000, out_int32a = 0;
523 const char *in_key1 = "turnover";
524 int in_int32b = 200000000, out_int32b = 0;
525 const char *in_key2 = "revenue";
526 int in_int32c = 300000000, out_int32c = 0;
527 const char *in_key3 = "debt";
528 const char *in_str2 = "World";
529 char *out_str1 = NULL, *out_str2 = NULL;
530 char *out_key1 = NULL, *out_key2 = NULL, *out_key3 = NULL;
532 if (!(msg = dbus_message_new_method_call("org.libvirt.test",
533 "/org/libvirt/test",
534 "org.libvirt.test.astrochicken",
535 "cluck"))) {
536 VIR_DEBUG("Failed to allocate method call");
537 goto cleanup;
540 if (virDBusMessageEncode(msg,
541 "(sa{si}s)",
542 in_str1,
544 in_key1, in_int32a,
545 in_key2, in_int32b,
546 in_key3, in_int32c,
547 in_str2) < 0) {
548 VIR_DEBUG("Failed to encode arguments");
549 goto cleanup;
552 if (virDBusMessageDecode(msg,
553 "(sa{si}s)",
554 &out_str1,
556 &out_key1, &out_int32a,
557 &out_key2, &out_int32b,
558 &out_key3, &out_int32c,
559 &out_str2) < 0) {
560 VIR_DEBUG("Failed to decode arguments");
561 goto cleanup;
565 VERIFY_STR("str1", in_str1, out_str1, "%s");
566 VERIFY("int32a", in_int32a, out_int32a, "%d");
567 VERIFY("int32b", in_int32b, out_int32b, "%d");
568 VERIFY("int32c", in_int32c, out_int32c, "%d");
569 VERIFY_STR("key1", in_key1, out_key1, "%s");
570 VERIFY_STR("key1", in_key2, out_key2, "%s");
571 VERIFY_STR("key1", in_key3, out_key3, "%s");
572 VERIFY_STR("str2", in_str2, out_str2, "%s");
574 ret = 0;
576 cleanup:
577 VIR_FREE(out_str1);
578 VIR_FREE(out_str2);
579 VIR_FREE(out_key1);
580 VIR_FREE(out_key2);
581 VIR_FREE(out_key3);
582 virDBusMessageUnref(msg);
583 return ret;
586 static int testMessageDictRef(const void *args ATTRIBUTE_UNUSED)
588 DBusMessage *msg = NULL;
589 int ret = -1;
590 const char *in_str1 = "Hello";
591 const char *in_strv1[] = {
592 "Fruit1", "Apple",
593 "Fruit2", "Orange",
594 "Fruit3", "Kiwi",
596 const char *in_str2 = "World";
597 char *out_str1 = NULL;
598 size_t out_nint32 = 0;
599 char **out_strv1 = NULL;
600 char *out_str2 = NULL;
602 if (!(msg = dbus_message_new_method_call("org.libvirt.test",
603 "/org/libvirt/test",
604 "org.libvirt.test.astrochicken",
605 "cluck"))) {
606 VIR_DEBUG("Failed to allocate method call");
607 goto cleanup;
610 if (virDBusMessageEncode(msg,
611 "(sa&{ss}s)",
612 in_str1,
613 3, in_strv1,
614 in_str2) < 0) {
615 VIR_DEBUG("Failed to encode arguments");
616 goto cleanup;
619 if (virDBusMessageDecode(msg,
620 "(sa&{ss}s)",
621 &out_str1,
622 &out_nint32,
623 &out_strv1,
624 &out_str2) < 0) {
625 VIR_DEBUG("Failed to decode arguments: '%s'", virGetLastErrorMessage());
626 goto cleanup;
630 VERIFY_STR("str1", in_str1, out_str1, "%s");
631 VERIFY_STR("strv1[0]", in_strv1[0], out_strv1[0], "%s");
632 VERIFY_STR("strv1[1]", in_strv1[1], out_strv1[1], "%s");
633 VERIFY_STR("strv1[2]", in_strv1[2], out_strv1[2], "%s");
634 VERIFY_STR("strv1[3]", in_strv1[3], out_strv1[3], "%s");
635 VERIFY_STR("strv1[4]", in_strv1[4], out_strv1[4], "%s");
636 VERIFY_STR("strv1[5]", in_strv1[5], out_strv1[5], "%s");
637 VERIFY_STR("str2", in_str2, out_str2, "%s");
639 ret = 0;
641 cleanup:
642 VIR_FREE(out_str1);
643 VIR_FREE(out_str2);
644 if (out_strv1) {
645 VIR_FREE(out_strv1[0]);
646 VIR_FREE(out_strv1[1]);
647 VIR_FREE(out_strv1[2]);
648 VIR_FREE(out_strv1[3]);
649 VIR_FREE(out_strv1[4]);
650 VIR_FREE(out_strv1[5]);
652 VIR_FREE(out_strv1);
653 virDBusMessageUnref(msg);
654 return ret;
657 static int testMessageEmptyDictRef(const void *args ATTRIBUTE_UNUSED)
659 DBusMessage *msg = NULL;
660 int ret = -1;
661 const char *in_strv1[] = {};
662 size_t out_nint32 = 0;
663 char **out_strv1 = NULL;
665 if (!(msg = dbus_message_new_method_call("org.libvirt.test",
666 "/org/libvirt/test",
667 "org.libvirt.test.astrochicken",
668 "cluck"))) {
669 VIR_DEBUG("Failed to allocate method call");
670 goto cleanup;
673 if (virDBusMessageEncode(msg,
674 "a&{ss}",
675 0, in_strv1) < 0) {
676 VIR_DEBUG("Failed to encode arguments");
677 goto cleanup;
680 if (virDBusMessageDecode(msg,
681 "a&{ss}",
682 &out_nint32,
683 &out_strv1) < 0) {
684 VIR_DEBUG("Failed to decode arguments: '%s'", virGetLastErrorMessage());
685 goto cleanup;
688 if (out_nint32 != 0) {
689 fprintf(stderr, "Unexpected dict entries\n");
690 goto cleanup;
693 ret = 0;
695 cleanup:
696 virDBusMessageUnref(msg);
697 return ret;
700 static int
701 mymain(void)
703 int ret = 0;
705 if (virTestRun("Test message simple ", testMessageSimple, NULL) < 0)
706 ret = -1;
707 if (virTestRun("Test message variant ", testMessageVariant, NULL) < 0)
708 ret = -1;
709 if (virTestRun("Test message array ", testMessageArray, NULL) < 0)
710 ret = -1;
711 if (virTestRun("Test message array empty ref ", testMessageEmptyArrayRef, NULL) < 0)
712 ret = -1;
713 if (virTestRun("Test message array single ref ", testMessageSingleArrayRef, NULL) < 0)
714 ret = -1;
715 if (virTestRun("Test message array ref ", testMessageArrayRef, NULL) < 0)
716 ret = -1;
717 if (virTestRun("Test message struct ", testMessageStruct, NULL) < 0)
718 ret = -1;
719 if (virTestRun("Test message dict ", testMessageDict, NULL) < 0)
720 ret = -1;
721 if (virTestRun("Test message dict empty ref ", testMessageEmptyDictRef, NULL) < 0)
722 ret = -1;
723 if (virTestRun("Test message dict ref ", testMessageDictRef, NULL) < 0)
724 ret = -1;
725 return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
728 VIR_TEST_MAIN(mymain)