backup: Wire up qemu full pull backup commands over QMP
[libvirt/ericb.git] / tests / qemucapsprobe.c
blob14c0ecad979cd831b8172974f1851b03a58a18bb
1 /*
2 * Copyright (C) 2016 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 #include "testutils.h"
22 #include "internal.h"
23 #include "virarch.h"
24 #include "virthread.h"
25 #include "qemu/qemu_capabilities.h"
26 #define LIBVIRT_QEMU_CAPSPRIV_H_ALLOW
27 #include "qemu/qemu_capspriv.h"
29 #define VIR_FROM_THIS VIR_FROM_NONE
32 static void
33 eventLoop(void *opaque ATTRIBUTE_UNUSED)
35 while (1) {
36 if (virEventRunDefaultImpl() < 0) {
37 fprintf(stderr, "Failed to run event loop: %s\n",
38 virGetLastErrorMessage());
44 int
45 main(int argc, char **argv)
47 virThread thread;
48 virQEMUCapsPtr caps;
50 VIR_TEST_PRELOAD(abs_builddir "/.libs/qemucapsprobemock.so");
52 if (argc != 2) {
53 fprintf(stderr, "%s QEMU_binary\n", argv[0]);
54 return EXIT_FAILURE;
57 if (virThreadInitialize() < 0 ||
58 virInitialize() < 0) {
59 fprintf(stderr, "Failed to initialize libvirt");
60 return EXIT_FAILURE;
63 if (virEventRegisterDefaultImpl() < 0) {
64 fprintf(stderr, "Failed to register event implementation: %s\n",
65 virGetLastErrorMessage());
66 return EXIT_FAILURE;
69 if (virThreadCreate(&thread, false, eventLoop, NULL) < 0)
70 return EXIT_FAILURE;
72 if (!(caps = virQEMUCapsNewForBinaryInternal(VIR_ARCH_NONE, argv[1], "/tmp",
73 -1, -1, 0, NULL)))
74 return EXIT_FAILURE;
76 virObjectUnref(caps);
78 return EXIT_SUCCESS;