tests: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Jonathon Jongsma 2019-06-18 11:13:14 -05:00 committed by Ján Tomko
parent 78b2a03966
commit c35d8a7d5e
12 changed files with 122 additions and 158 deletions

View File

@ -17,14 +17,13 @@
*
*/
#ifndef LIBVIRT_QEMUMONITORTESTUTILS_H
# define LIBVIRT_QEMUMONITORTESTUTILS_H
#pragma once
# include "domain_conf.h"
# include "qemu/qemu_conf.h"
# include "qemu/qemu_monitor.h"
# include "qemu/qemu_agent.h"
# include "virautoclean.h"
#include "domain_conf.h"
#include "qemu/qemu_conf.h"
#include "qemu/qemu_monitor.h"
#include "qemu/qemu_agent.h"
#include "virautoclean.h"
typedef struct _qemuMonitorTest qemuMonitorTest;
typedef qemuMonitorTest *qemuMonitorTestPtr;
@ -74,9 +73,9 @@ int qemuMonitorTestAddItemExpect(qemuMonitorTestPtr test,
bool apostrophe,
const char *response);
# define qemuMonitorTestNewSimple(xmlopt) \
#define qemuMonitorTestNewSimple(xmlopt) \
qemuMonitorTestNew(xmlopt, NULL, NULL, NULL, NULL)
# define qemuMonitorTestNewSchema(xmlopt, schema) \
#define qemuMonitorTestNewSchema(xmlopt, schema) \
qemuMonitorTestNew(xmlopt, NULL, NULL, NULL, schema)
qemuMonitorTestPtr qemuMonitorTestNew(virDomainXMLOptionPtr xmlopt,
@ -103,5 +102,3 @@ qemuAgentPtr qemuMonitorTestGetAgent(qemuMonitorTestPtr test);
virDomainObjPtr qemuMonitorTestGetDomainObj(qemuMonitorTestPtr test);
VIR_DEFINE_AUTOPTR_FUNC(qemuMonitorTest, qemuMonitorTestFree);
#endif /* LIBVIRT_QEMUMONITORTESTUTILS_H */

View File

@ -16,11 +16,8 @@
* <http://www.gnu.org/licenses/>.
*/
#ifndef LIBVIRT_QEMUSECURITYTEST_H
# define LIBVIRT_QEMUSECURITYTEST_H
#pragma once
# define ENVVAR "LIBVIRT_QEMU_SECURITY_TEST"
#define ENVVAR "LIBVIRT_QEMU_SECURITY_TEST"
extern int checkPaths(void);
#endif /* LIBVIRT_QEMUSECURITYTEST_H */

View File

@ -18,31 +18,30 @@
* <http://www.gnu.org/licenses/>.
*/
#ifndef LIBVIRT_TESTUTILS_H
# define LIBVIRT_TESTUTILS_H
#pragma once
# include "viralloc.h"
# include "virfile.h"
# include "virstring.h"
# include "virjson.h"
# include "capabilities.h"
# include "domain_conf.h"
#include "viralloc.h"
#include "virfile.h"
#include "virstring.h"
#include "virjson.h"
#include "capabilities.h"
#include "domain_conf.h"
# define EXIT_AM_SKIP 77 /* tell Automake we're skipping a test */
# define EXIT_AM_HARDFAIL 99 /* tell Automake that the framework is broken */
#define EXIT_AM_SKIP 77 /* tell Automake we're skipping a test */
#define EXIT_AM_HARDFAIL 99 /* tell Automake that the framework is broken */
/* Work around lack of gnulib support for fprintf %z */
# ifndef NO_LIBVIRT
# undef fprintf
# define fprintf virFilePrintf
# endif
#ifndef NO_LIBVIRT
# undef fprintf
# define fprintf virFilePrintf
#endif
extern char *progname;
/* Makefile.am provides these two definitions */
# if !defined(abs_srcdir) || !defined(abs_builddir)
# error Fix Makefile.am
# endif
#if !defined(abs_srcdir) || !defined(abs_builddir)
# error Fix Makefile.am
#endif
bool virTestOOMActive(void);
@ -88,13 +87,13 @@ unsigned int virTestGetVerbose(void);
unsigned int virTestGetExpensive(void);
unsigned int virTestGetRegenerate(void);
# define VIR_TEST_DEBUG(...) \
#define VIR_TEST_DEBUG(...) \
do { \
if (virTestGetDebug()) \
fprintf(stderr, __VA_ARGS__); \
} while (0)
# define VIR_TEST_VERBOSE(...) \
#define VIR_TEST_VERBOSE(...) \
do { \
if (virTestGetVerbose()) \
fprintf(stderr, __VA_ARGS__); \
@ -113,12 +112,12 @@ int virTestMain(int argc,
...);
/* Setup, then call func() */
# define VIR_TEST_MAIN(func) \
#define VIR_TEST_MAIN(func) \
int main(int argc, char **argv) { \
return virTestMain(argc, argv, func, NULL); \
}
# define VIR_TEST_PRELOAD(lib) \
#define VIR_TEST_PRELOAD(lib) \
do { \
const char *preload = getenv("LD_PRELOAD"); \
if (preload == NULL || strstr(preload, lib) == NULL) { \
@ -138,7 +137,7 @@ int virTestMain(int argc,
} \
} while (0)
# define VIR_TEST_MAIN_PRELOAD(func, ...) \
#define VIR_TEST_MAIN_PRELOAD(func, ...) \
int main(int argc, char **argv) { \
return virTestMain(argc, argv, func, __VA_ARGS__, NULL); \
}
@ -163,5 +162,3 @@ int testCompareDomXML2XMLFiles(virCapsPtr caps,
bool live,
unsigned int parseFlags,
testCompareDomXML2XMLResult expectResult);
#endif /* LIBVIRT_TESTUTILS_H */

View File

@ -14,12 +14,11 @@
* <http://www.gnu.org/licenses/>.
*/
#ifndef LIBVIRT_TESTUTILSHOSTCPUS_H
# define LIBVIRT_TESTUTILSHOSTCPUS_H
#pragma once
# include "conf/cpu_conf.h"
# include "internal.h"
# include "util/virarch.h"
#include "conf/cpu_conf.h"
#include "internal.h"
#include "util/virarch.h"
static virCPUFeatureDef cpuDefaultFeatures[] = {
{ (char *) "ds", -1 },
@ -165,5 +164,3 @@ testUtilsHostCpusGetDefForArch(virArch arch)
return NULL;
}
#endif /* LIBVIRT_TESTUTILSHOSTCPUS_H */

View File

@ -14,14 +14,11 @@
* <http://www.gnu.org/licenses/>.
*/
#ifndef LIBVIRT_TESTUTILSLXC_H
# define LIBVIRT_TESTUTILSLXC_H
#pragma once
# include "capabilities.h"
#include "capabilities.h"
# define FAKEDEVDIR0 "/fakedevdir0/bla/fasl"
# define FAKEDEVDIR1 "/fakedevdir1/bla/fasl"
#define FAKEDEVDIR0 "/fakedevdir0/bla/fasl"
#define FAKEDEVDIR1 "/fakedevdir1/bla/fasl"
virCapsPtr testLXCCapsInit(void);
#endif /* LIBVIRT_TESTUTILSLXC_H */

View File

@ -14,18 +14,17 @@
* <http://www.gnu.org/licenses/>.
*/
#ifndef LIBVIRT_TESTUTILSQEMU_H
# define LIBVIRT_TESTUTILSQEMU_H
#pragma once
# ifdef WITH_QEMU
#ifdef WITH_QEMU
# include "capabilities.h"
# include "virfilecache.h"
# include "domain_conf.h"
# include "qemu/qemu_capabilities.h"
# include "qemu/qemu_conf.h"
# include "capabilities.h"
# include "virfilecache.h"
# include "domain_conf.h"
# include "qemu/qemu_capabilities.h"
# include "qemu/qemu_conf.h"
# define TEST_QEMU_CAPS_PATH abs_srcdir "/qemucapabilitiesdata"
# define TEST_QEMU_CAPS_PATH abs_srcdir "/qemucapabilitiesdata"
enum {
GIC_NONE = 0,
@ -107,6 +106,4 @@ int testQemuInfoSetArgs(struct testQemuInfo *info,
virHashTablePtr capslatest, ...);
void testQemuInfoClear(struct testQemuInfo *info);
# endif
#endif /* LIBVIRT_TESTUTILSQEMU_H */
#endif

View File

@ -16,12 +16,11 @@
* <http://www.gnu.org/licenses/>.
*/
#ifndef LIBVIRT_TESTUTILSQEMUSCHEMA_H
# define LIBVIRT_TESTUTILSQEMUSCHEMA_H
#pragma once
# include "virhash.h"
# include "virjson.h"
# include "virbuffer.h"
#include "virhash.h"
#include "virjson.h"
#include "virbuffer.h"
int
testQEMUSchemaValidate(virJSONValuePtr obj,
@ -34,5 +33,3 @@ testQEMUSchemaGetLatest(void);
virHashTablePtr
testQEMUSchemaLoad(void);
#endif /* LIBVIRT_TESTUTILSQEMUSCHEMA_H */

View File

@ -14,14 +14,11 @@
* <http://www.gnu.org/licenses/>.
*/
#ifndef LIBVIRT_TESTUTILSXEN_H
# define LIBVIRT_TESTUTILSXEN_H
#pragma once
# include "capabilities.h"
# ifdef WITH_LIBXL
# include "libxl/libxl_capabilities.h"
# endif
#include "capabilities.h"
#ifdef WITH_LIBXL
# include "libxl/libxl_capabilities.h"
#endif
virCapsPtr testXLInitCaps(void);
#endif /* LIBVIRT_TESTUTILSXEN_H */

View File

@ -16,8 +16,7 @@
* <http://www.gnu.org/licenses/>.
*/
#ifndef LIBVIRT_VIRFILEWRAPPER_H
# define LIBVIRT_VIRFILEWRAPPER_H
#pragma once
void
virFileWrapperAddPrefix(const char *prefix,
@ -28,5 +27,3 @@ virFileWrapperRemovePrefix(const char *prefix);
void
virFileWrapperClearPrefixes(void);
#endif /* LIBVIRT_VIRFILEWRAPPER_H */

View File

@ -14,8 +14,7 @@
* <http://www.gnu.org/licenses/>.
*/
#ifndef LIBVIRT_VIRHASHDATA_H
# define LIBVIRT_VIRHASHDATA_H
#pragma once
const char *uuids[] = {
/* [ 2] */ "a9b02f96-e430-4f7c-a7ff-a647d080447a",
@ -283,5 +282,3 @@ const char *uuids_new[] = {
"5920cc9d-62a3-4772-9e73-eb97f0bc483c",
"53c215dd-bdba-4fdc-887a-86ab6f860df4",
};
#endif /* LIBVIRT_VIRHASHDATA_H */

View File

@ -19,60 +19,59 @@
*
*/
#ifndef LIBVIRT_VIRMOCK_H
# define LIBVIRT_VIRMOCK_H
#pragma once
# if HAVE_DLFCN_H
# include <dlfcn.h>
# endif
#if HAVE_DLFCN_H
# include <dlfcn.h>
#endif
# include "internal.h"
#include "internal.h"
# define VIR_MOCK_COUNT_ARGS(...) VIR_MOCK_ARG21(__VA_ARGS__, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)
# define VIR_MOCK_ARG21(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, ...) _21
# define VIR_MOCK_ARG_PASTE(a, b, ...) a##b(__VA_ARGS__)
#define VIR_MOCK_COUNT_ARGS(...) VIR_MOCK_ARG21(__VA_ARGS__, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)
#define VIR_MOCK_ARG21(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, ...) _21
#define VIR_MOCK_ARG_PASTE(a, b, ...) a##b(__VA_ARGS__)
# define VIR_MOCK_ARGNAME(a, b) b
# define VIR_MOCK_ARGTYPE(a, b) a
# define VIR_MOCK_ARGTYPENAME(a, b) a b
# define VIR_MOCK_ARGTYPENAME_UNUSED(a, b) a b ATTRIBUTE_UNUSED
#define VIR_MOCK_ARGNAME(a, b) b
#define VIR_MOCK_ARGTYPE(a, b) a
#define VIR_MOCK_ARGTYPENAME(a, b) a b
#define VIR_MOCK_ARGTYPENAME_UNUSED(a, b) a b ATTRIBUTE_UNUSED
# define VIR_MOCK_GET_ARG2(z, a, b) z(a, b)
# define VIR_MOCK_GET_ARG3(z, a, b, c) z(a, b)
# define VIR_MOCK_GET_ARG4(z, a, b, c, d) z(a, b), z(c, d)
# define VIR_MOCK_GET_ARG5(z, a, b, c, d, e) z(a, b), z(c, d)
# define VIR_MOCK_GET_ARG6(z, a, b, c, d, e, f) z(a, b), z(c, d), z(e, f)
# define VIR_MOCK_GET_ARG7(z, a, b, c, d, e, f, g) z(a, b), z(c, d), z(e, f)
# define VIR_MOCK_GET_ARG8(z, a, b, c, d, e, f, g, h) z(a, b), z(c, d), z(e, f), z(g, h)
# define VIR_MOCK_GET_ARG9(z, a, b, c, d, e, f, g, h, i) z(a, b), z(c, d), z(e, f), z(g, h)
# define VIR_MOCK_GET_ARG10(z, a, b, c, d, e, f, g, h, i, j) z(a, b), z(c, d), z(e, f), z(g, h), z(i, j)
# define VIR_MOCK_GET_ARG11(z, a, b, c, d, e, f, g, h, i, j, k) z(a, b), z(c, d), z(e, f), z(g, h), z(i, j)
# define VIR_MOCK_GET_ARG12(z, a, b, c, d, e, f, g, h, i, j, k, l) z(a, b), z(c, d), z(e, f), z(g, h), z(i, j), z(k, l)
# define VIR_MOCK_GET_ARG13(z, a, b, c, d, e, f, g, h, i, j, k, l, m) z(a, b), z(c, d), z(e, f), z(g, h), z(i, j), z(k, l)
# define VIR_MOCK_GET_ARG14(z, a, b, c, d, e, f, g, h, i, j, k, l, m, n) z(a, b), z(c, d), z(e, f), z(g, h), z(i, j), z(k, l), z(m, n)
# define VIR_MOCK_GET_ARG15(z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) z(a, b), z(c, d), z(e, f), z(g, h), z(i, j), z(k, l), z(m, n)
# define VIR_MOCK_GET_ARG16(z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) z(a, b), z(c, d), z(e, f), z(g, h), z(i, j), z(k, l), z(m, n), z(o, p)
# define VIR_MOCK_GET_ARG17(z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) z(a, b), z(c, d), z(e, f), z(g, h), z(i, j), z(k, l), z(m, n), z(o, p)
# define VIR_MOCK_GET_ARG18(z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) z(a, b), z(c, d), z(e, f), z(g, h), z(i, j), z(k, l), z(m, n), z(o, p), z(q, r)
# define VIR_MOCK_GET_ARG19(z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) z(a, b), z(c, d), z(e, f), z(g, h), z(i, j), z(k, l), z(m, n), z(o, p), z(q, r)
# define VIR_MOCK_GET_ARG20(z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) z(a, b), z(c, d), z(e, f), z(g, h), z(i, j), z(k, l), z(m, n), z(o, p), z(q, r), z(s, t)
# define VIR_MOCK_GET_ARG21(z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) z(a, b), z(c, d), z(e, f), z(g, h), z(i, j), z(k, l), z(m, n), z(o, p), z(q, r), z(s, t)
#define VIR_MOCK_GET_ARG2(z, a, b) z(a, b)
#define VIR_MOCK_GET_ARG3(z, a, b, c) z(a, b)
#define VIR_MOCK_GET_ARG4(z, a, b, c, d) z(a, b), z(c, d)
#define VIR_MOCK_GET_ARG5(z, a, b, c, d, e) z(a, b), z(c, d)
#define VIR_MOCK_GET_ARG6(z, a, b, c, d, e, f) z(a, b), z(c, d), z(e, f)
#define VIR_MOCK_GET_ARG7(z, a, b, c, d, e, f, g) z(a, b), z(c, d), z(e, f)
#define VIR_MOCK_GET_ARG8(z, a, b, c, d, e, f, g, h) z(a, b), z(c, d), z(e, f), z(g, h)
#define VIR_MOCK_GET_ARG9(z, a, b, c, d, e, f, g, h, i) z(a, b), z(c, d), z(e, f), z(g, h)
#define VIR_MOCK_GET_ARG10(z, a, b, c, d, e, f, g, h, i, j) z(a, b), z(c, d), z(e, f), z(g, h), z(i, j)
#define VIR_MOCK_GET_ARG11(z, a, b, c, d, e, f, g, h, i, j, k) z(a, b), z(c, d), z(e, f), z(g, h), z(i, j)
#define VIR_MOCK_GET_ARG12(z, a, b, c, d, e, f, g, h, i, j, k, l) z(a, b), z(c, d), z(e, f), z(g, h), z(i, j), z(k, l)
#define VIR_MOCK_GET_ARG13(z, a, b, c, d, e, f, g, h, i, j, k, l, m) z(a, b), z(c, d), z(e, f), z(g, h), z(i, j), z(k, l)
#define VIR_MOCK_GET_ARG14(z, a, b, c, d, e, f, g, h, i, j, k, l, m, n) z(a, b), z(c, d), z(e, f), z(g, h), z(i, j), z(k, l), z(m, n)
#define VIR_MOCK_GET_ARG15(z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) z(a, b), z(c, d), z(e, f), z(g, h), z(i, j), z(k, l), z(m, n)
#define VIR_MOCK_GET_ARG16(z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) z(a, b), z(c, d), z(e, f), z(g, h), z(i, j), z(k, l), z(m, n), z(o, p)
#define VIR_MOCK_GET_ARG17(z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) z(a, b), z(c, d), z(e, f), z(g, h), z(i, j), z(k, l), z(m, n), z(o, p)
#define VIR_MOCK_GET_ARG18(z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) z(a, b), z(c, d), z(e, f), z(g, h), z(i, j), z(k, l), z(m, n), z(o, p), z(q, r)
#define VIR_MOCK_GET_ARG19(z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) z(a, b), z(c, d), z(e, f), z(g, h), z(i, j), z(k, l), z(m, n), z(o, p), z(q, r)
#define VIR_MOCK_GET_ARG20(z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) z(a, b), z(c, d), z(e, f), z(g, h), z(i, j), z(k, l), z(m, n), z(o, p), z(q, r), z(s, t)
#define VIR_MOCK_GET_ARG21(z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) z(a, b), z(c, d), z(e, f), z(g, h), z(i, j), z(k, l), z(m, n), z(o, p), z(q, r), z(s, t)
# define VIR_MOCK_ARGNAMES_EXPAND(a, b, ...) VIR_MOCK_ARG_PASTE(a, b, __VA_ARGS__)
# define VIR_MOCK_ARGNAMES(...) \
#define VIR_MOCK_ARGNAMES_EXPAND(a, b, ...) VIR_MOCK_ARG_PASTE(a, b, __VA_ARGS__)
#define VIR_MOCK_ARGNAMES(...) \
VIR_MOCK_ARGNAMES_EXPAND(VIR_MOCK_GET_ARG, VIR_MOCK_COUNT_ARGS(__VA_ARGS__), VIR_MOCK_ARGNAME, __VA_ARGS__)
# define VIR_MOCK_ARGTYPES_EXPAND(a, b, ...) VIR_MOCK_ARG_PASTE(a, b, __VA_ARGS__)
# define VIR_MOCK_ARGTYPES(...) \
#define VIR_MOCK_ARGTYPES_EXPAND(a, b, ...) VIR_MOCK_ARG_PASTE(a, b, __VA_ARGS__)
#define VIR_MOCK_ARGTYPES(...) \
VIR_MOCK_ARGTYPES_EXPAND(VIR_MOCK_GET_ARG, VIR_MOCK_COUNT_ARGS(__VA_ARGS__), VIR_MOCK_ARGTYPE, __VA_ARGS__)
# define VIR_MOCK_ARGTYPENAMES_EXPAND(a, b, ...) VIR_MOCK_ARG_PASTE(a, b, __VA_ARGS__)
# define VIR_MOCK_ARGTYPENAMES(...) \
#define VIR_MOCK_ARGTYPENAMES_EXPAND(a, b, ...) VIR_MOCK_ARG_PASTE(a, b, __VA_ARGS__)
#define VIR_MOCK_ARGTYPENAMES(...) \
VIR_MOCK_ARGTYPENAMES_EXPAND(VIR_MOCK_GET_ARG, VIR_MOCK_COUNT_ARGS(__VA_ARGS__), VIR_MOCK_ARGTYPENAME, __VA_ARGS__)
# define VIR_MOCK_ARGTYPENAMES_UNUSED_EXPAND(a, b, ...) VIR_MOCK_ARG_PASTE(a, b, __VA_ARGS__)
# define VIR_MOCK_ARGTYPENAMES_UNUSED(...) \
#define VIR_MOCK_ARGTYPENAMES_UNUSED_EXPAND(a, b, ...) VIR_MOCK_ARG_PASTE(a, b, __VA_ARGS__)
#define VIR_MOCK_ARGTYPENAMES_UNUSED(...) \
VIR_MOCK_ARGTYPENAMES_UNUSED_EXPAND(VIR_MOCK_GET_ARG, VIR_MOCK_COUNT_ARGS(__VA_ARGS__), VIR_MOCK_ARGTYPENAME_UNUSED, __VA_ARGS__)
@ -98,7 +97,7 @@
* Define a replacement for @name which invokes wrap_@name
* forwarding on all args, and passing back the return value.
*/
# define VIR_MOCK_LINK_RET_ARGS(name, rettype, ...) \
#define VIR_MOCK_LINK_RET_ARGS(name, rettype, ...) \
rettype name(VIR_MOCK_ARGTYPENAMES(__VA_ARGS__)) \
{ \
static rettype (*wrap_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \
@ -120,7 +119,7 @@
* Define a replacement for @name which invokes wrap_@name
* with no arguments, and passing back the return value.
*/
# define VIR_MOCK_LINK_RET_VOID(name, rettype) \
#define VIR_MOCK_LINK_RET_VOID(name, rettype) \
rettype name(void) \
{ \
static rettype (*wrap_##name)(void); \
@ -142,7 +141,7 @@
* Define a replacement for @name which invokes wrap_@name
* forwarding on all args, but with no return value.
*/
# define VIR_MOCK_LINK_VOID_ARGS(name, ...) \
#define VIR_MOCK_LINK_VOID_ARGS(name, ...) \
void name(VIR_MOCK_ARGTYPENAMES(__VA_ARGS__)) \
{ \
static void (*wrap_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \
@ -176,7 +175,7 @@
* Define a replacement for @name which doesn't invoke anything, just
* returns @retval.
*/
# define VIR_MOCK_STUB_RET_ARGS(name, rettype, retval, ...) \
#define VIR_MOCK_STUB_RET_ARGS(name, rettype, retval, ...) \
rettype name(VIR_MOCK_ARGTYPENAMES_UNUSED(__VA_ARGS__)) \
{ \
return retval; \
@ -191,7 +190,7 @@
* Define a replacement for @name which doesn't invoke anything, just
* returns @retval.
*/
# define VIR_MOCK_STUB_RET_VOID(name, rettype, retval) \
#define VIR_MOCK_STUB_RET_VOID(name, rettype, retval) \
rettype name(void) \
{ \
return retval; \
@ -205,7 +204,7 @@
* Define a replacement for @name which doesn't invoke or return
* anything.
*/
# define VIR_MOCK_STUB_VOID_ARGS(name, ...) \
#define VIR_MOCK_STUB_VOID_ARGS(name, ...) \
void name(VIR_MOCK_ARGTYPENAMES_UNUSED(__VA_ARGS__)) \
{ \
}
@ -219,7 +218,7 @@
* Define a replacement for @name which doesn't invoke or return
* anything.
*/
# define VIR_MOCK_STUB_VOID_VOID(name) \
#define VIR_MOCK_STUB_VOID_VOID(name) \
void name(void) \
{ \
}
@ -232,22 +231,22 @@
* as the body of the method.
*/
# define VIR_MOCK_IMPL_RET_ARGS(name, rettype, ...) \
#define VIR_MOCK_IMPL_RET_ARGS(name, rettype, ...) \
rettype name(VIR_MOCK_ARGTYPENAMES(__VA_ARGS__)); \
static rettype (*real_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \
rettype name(VIR_MOCK_ARGTYPENAMES_UNUSED(__VA_ARGS__))
# define VIR_MOCK_IMPL_RET_VOID(name, rettype) \
#define VIR_MOCK_IMPL_RET_VOID(name, rettype) \
rettype name(void); \
static rettype (*real_##name)(void); \
rettype name(void)
# define VIR_MOCK_IMPL_VOID_ARGS(name, ...) \
#define VIR_MOCK_IMPL_VOID_ARGS(name, ...) \
void name(VIR_MOCK_ARGTYPENAMES(__VA_ARGS__)); \
static void (*real_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \
void name(VIR_MOCK_ARGTYPENAMES_UNUSED(__VA_ARGS__))
# define VIR_MOCK_IMPL_VOID_VOID(name) \
#define VIR_MOCK_IMPL_VOID_VOID(name) \
void name(void); \
static void (*real_##name)(void); \
void name(void)
@ -259,28 +258,28 @@
* as the body of the method.
*/
# define VIR_MOCK_WRAP_RET_ARGS(name, rettype, ...) \
#define VIR_MOCK_WRAP_RET_ARGS(name, rettype, ...) \
rettype wrap_##name(VIR_MOCK_ARGTYPENAMES(__VA_ARGS__)); \
static rettype (*real_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \
rettype wrap_##name(VIR_MOCK_ARGTYPENAMES_UNUSED(__VA_ARGS__))
# define VIR_MOCK_WRAP_RET_VOID(name, rettype) \
#define VIR_MOCK_WRAP_RET_VOID(name, rettype) \
rettype wrap_##name(void); \
static rettype (*real_##name)(void); \
rettype wrap_##name(void)
# define VIR_MOCK_WRAP_VOID_ARGS(name, ...) \
#define VIR_MOCK_WRAP_VOID_ARGS(name, ...) \
void wrap_##name(VIR_MOCK_ARGTYPENAMES(__VA_ARGS__)); \
static void (*real_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \
void wrap_##name(VIR_MOCK_ARGTYPENAMES_UNUSED(__VA_ARGS__))
# define VIR_MOCK_WRAP_VOID_VOID(name) \
#define VIR_MOCK_WRAP_VOID_VOID(name) \
void wrap_##name(void); \
static void (*real_##name)(void); \
void wrap_##name(void)
# define VIR_MOCK_REAL_INIT(name) \
#define VIR_MOCK_REAL_INIT(name) \
do { \
if (real_##name == NULL && \
!(real_##name = dlsym(RTLD_NEXT, \
@ -289,5 +288,3 @@
abort(); \
} \
} while (0)
#endif /* LIBVIRT_VIRMOCK_H */

View File

@ -16,17 +16,16 @@
* <http://www.gnu.org/licenses/>.
*/
#ifndef LIBVIRT_VIRNETTLSHELPERS_H
# define LIBVIRT_VIRNETTLSHELPERS_H
#pragma once
# include <gnutls/gnutls.h>
# include <gnutls/x509.h>
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
# if !defined WIN32 && HAVE_LIBTASN1_H && LIBGNUTLS_VERSION_NUMBER >= 0x020600
#if !defined WIN32 && HAVE_LIBTASN1_H && LIBGNUTLS_VERSION_NUMBER >= 0x020600
# include <libtasn1.h>
# include <libtasn1.h>
# include "rpc/virnettlscontext.h"
# include "rpc/virnettlscontext.h"
/*
* This contains parameter about how to generate
@ -77,6 +76,4 @@ void testTLSDiscardCert(struct testTLSCertReq *req);
void testTLSInit(const char *keyfile);
void testTLSCleanup(const char *keyfile);
# endif
#endif /* LIBVIRT_VIRNETTLSHELPERS_H */
#endif