tests: Use the new DO_TEST_CAPS_*() macros
[libvirt/ericb.git] / tests / testutilslxc.c
blobeed18304c4a4b5668902da39801df3753ac4d0ab
1 #include <config.h>
2 #ifdef WITH_LXC
4 # include "testutilslxc.h"
5 # include "testutils.h"
6 # include "viralloc.h"
7 # include "domain_conf.h"
10 virCapsPtr testLXCCapsInit(void)
12 virCapsPtr caps;
13 virCapsGuestPtr guest;
15 if ((caps = virCapabilitiesNew(VIR_ARCH_X86_64,
16 false, false)) == NULL)
17 return NULL;
19 if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_EXE,
20 VIR_ARCH_I686,
21 "/usr/libexec/libvirt_lxc", NULL,
22 0, NULL)) == NULL)
23 goto error;
25 if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_LXC, NULL, NULL, 0, NULL))
26 goto error;
29 if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_EXE,
30 VIR_ARCH_X86_64,
31 "/usr/libexec/libvirt_lxc", NULL,
32 0, NULL)) == NULL)
33 goto error;
35 if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_LXC, NULL, NULL, 0, NULL))
36 goto error;
39 if (virTestGetDebug()) {
40 char *caps_str;
42 caps_str = virCapabilitiesFormatXML(caps);
43 if (!caps_str)
44 goto error;
46 VIR_TEST_DEBUG("LXC driver capabilities:\n%s", caps_str);
48 VIR_FREE(caps_str);
51 return caps;
53 error:
54 virObjectUnref(caps);
55 return NULL;
57 #endif