mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
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:
parent
78b2a03966
commit
c35d8a7d5e
@ -17,14 +17,13 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LIBVIRT_QEMUMONITORTESTUTILS_H
|
#pragma once
|
||||||
# define LIBVIRT_QEMUMONITORTESTUTILS_H
|
|
||||||
|
|
||||||
# include "domain_conf.h"
|
#include "domain_conf.h"
|
||||||
# include "qemu/qemu_conf.h"
|
#include "qemu/qemu_conf.h"
|
||||||
# include "qemu/qemu_monitor.h"
|
#include "qemu/qemu_monitor.h"
|
||||||
# include "qemu/qemu_agent.h"
|
#include "qemu/qemu_agent.h"
|
||||||
# include "virautoclean.h"
|
#include "virautoclean.h"
|
||||||
|
|
||||||
typedef struct _qemuMonitorTest qemuMonitorTest;
|
typedef struct _qemuMonitorTest qemuMonitorTest;
|
||||||
typedef qemuMonitorTest *qemuMonitorTestPtr;
|
typedef qemuMonitorTest *qemuMonitorTestPtr;
|
||||||
@ -74,9 +73,9 @@ int qemuMonitorTestAddItemExpect(qemuMonitorTestPtr test,
|
|||||||
bool apostrophe,
|
bool apostrophe,
|
||||||
const char *response);
|
const char *response);
|
||||||
|
|
||||||
# define qemuMonitorTestNewSimple(xmlopt) \
|
#define qemuMonitorTestNewSimple(xmlopt) \
|
||||||
qemuMonitorTestNew(xmlopt, NULL, NULL, NULL, NULL)
|
qemuMonitorTestNew(xmlopt, NULL, NULL, NULL, NULL)
|
||||||
# define qemuMonitorTestNewSchema(xmlopt, schema) \
|
#define qemuMonitorTestNewSchema(xmlopt, schema) \
|
||||||
qemuMonitorTestNew(xmlopt, NULL, NULL, NULL, schema)
|
qemuMonitorTestNew(xmlopt, NULL, NULL, NULL, schema)
|
||||||
|
|
||||||
qemuMonitorTestPtr qemuMonitorTestNew(virDomainXMLOptionPtr xmlopt,
|
qemuMonitorTestPtr qemuMonitorTestNew(virDomainXMLOptionPtr xmlopt,
|
||||||
@ -103,5 +102,3 @@ qemuAgentPtr qemuMonitorTestGetAgent(qemuMonitorTestPtr test);
|
|||||||
virDomainObjPtr qemuMonitorTestGetDomainObj(qemuMonitorTestPtr test);
|
virDomainObjPtr qemuMonitorTestGetDomainObj(qemuMonitorTestPtr test);
|
||||||
|
|
||||||
VIR_DEFINE_AUTOPTR_FUNC(qemuMonitorTest, qemuMonitorTestFree);
|
VIR_DEFINE_AUTOPTR_FUNC(qemuMonitorTest, qemuMonitorTestFree);
|
||||||
|
|
||||||
#endif /* LIBVIRT_QEMUMONITORTESTUTILS_H */
|
|
||||||
|
@ -16,11 +16,8 @@
|
|||||||
* <http://www.gnu.org/licenses/>.
|
* <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LIBVIRT_QEMUSECURITYTEST_H
|
#pragma once
|
||||||
# define LIBVIRT_QEMUSECURITYTEST_H
|
|
||||||
|
|
||||||
# define ENVVAR "LIBVIRT_QEMU_SECURITY_TEST"
|
#define ENVVAR "LIBVIRT_QEMU_SECURITY_TEST"
|
||||||
|
|
||||||
extern int checkPaths(void);
|
extern int checkPaths(void);
|
||||||
|
|
||||||
#endif /* LIBVIRT_QEMUSECURITYTEST_H */
|
|
||||||
|
@ -18,31 +18,30 @@
|
|||||||
* <http://www.gnu.org/licenses/>.
|
* <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LIBVIRT_TESTUTILS_H
|
#pragma once
|
||||||
# define LIBVIRT_TESTUTILS_H
|
|
||||||
|
|
||||||
# include "viralloc.h"
|
#include "viralloc.h"
|
||||||
# include "virfile.h"
|
#include "virfile.h"
|
||||||
# include "virstring.h"
|
#include "virstring.h"
|
||||||
# include "virjson.h"
|
#include "virjson.h"
|
||||||
# include "capabilities.h"
|
#include "capabilities.h"
|
||||||
# include "domain_conf.h"
|
#include "domain_conf.h"
|
||||||
|
|
||||||
# define EXIT_AM_SKIP 77 /* tell Automake we're skipping a test */
|
#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_HARDFAIL 99 /* tell Automake that the framework is broken */
|
||||||
|
|
||||||
/* Work around lack of gnulib support for fprintf %z */
|
/* Work around lack of gnulib support for fprintf %z */
|
||||||
# ifndef NO_LIBVIRT
|
#ifndef NO_LIBVIRT
|
||||||
# undef fprintf
|
# undef fprintf
|
||||||
# define fprintf virFilePrintf
|
# define fprintf virFilePrintf
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
extern char *progname;
|
extern char *progname;
|
||||||
|
|
||||||
/* Makefile.am provides these two definitions */
|
/* Makefile.am provides these two definitions */
|
||||||
# if !defined(abs_srcdir) || !defined(abs_builddir)
|
#if !defined(abs_srcdir) || !defined(abs_builddir)
|
||||||
# error Fix Makefile.am
|
# error Fix Makefile.am
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
bool virTestOOMActive(void);
|
bool virTestOOMActive(void);
|
||||||
|
|
||||||
@ -88,13 +87,13 @@ unsigned int virTestGetVerbose(void);
|
|||||||
unsigned int virTestGetExpensive(void);
|
unsigned int virTestGetExpensive(void);
|
||||||
unsigned int virTestGetRegenerate(void);
|
unsigned int virTestGetRegenerate(void);
|
||||||
|
|
||||||
# define VIR_TEST_DEBUG(...) \
|
#define VIR_TEST_DEBUG(...) \
|
||||||
do { \
|
do { \
|
||||||
if (virTestGetDebug()) \
|
if (virTestGetDebug()) \
|
||||||
fprintf(stderr, __VA_ARGS__); \
|
fprintf(stderr, __VA_ARGS__); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
# define VIR_TEST_VERBOSE(...) \
|
#define VIR_TEST_VERBOSE(...) \
|
||||||
do { \
|
do { \
|
||||||
if (virTestGetVerbose()) \
|
if (virTestGetVerbose()) \
|
||||||
fprintf(stderr, __VA_ARGS__); \
|
fprintf(stderr, __VA_ARGS__); \
|
||||||
@ -113,12 +112,12 @@ int virTestMain(int argc,
|
|||||||
...);
|
...);
|
||||||
|
|
||||||
/* Setup, then call func() */
|
/* Setup, then call func() */
|
||||||
# define VIR_TEST_MAIN(func) \
|
#define VIR_TEST_MAIN(func) \
|
||||||
int main(int argc, char **argv) { \
|
int main(int argc, char **argv) { \
|
||||||
return virTestMain(argc, argv, func, NULL); \
|
return virTestMain(argc, argv, func, NULL); \
|
||||||
}
|
}
|
||||||
|
|
||||||
# define VIR_TEST_PRELOAD(lib) \
|
#define VIR_TEST_PRELOAD(lib) \
|
||||||
do { \
|
do { \
|
||||||
const char *preload = getenv("LD_PRELOAD"); \
|
const char *preload = getenv("LD_PRELOAD"); \
|
||||||
if (preload == NULL || strstr(preload, lib) == NULL) { \
|
if (preload == NULL || strstr(preload, lib) == NULL) { \
|
||||||
@ -138,7 +137,7 @@ int virTestMain(int argc,
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
# define VIR_TEST_MAIN_PRELOAD(func, ...) \
|
#define VIR_TEST_MAIN_PRELOAD(func, ...) \
|
||||||
int main(int argc, char **argv) { \
|
int main(int argc, char **argv) { \
|
||||||
return virTestMain(argc, argv, func, __VA_ARGS__, NULL); \
|
return virTestMain(argc, argv, func, __VA_ARGS__, NULL); \
|
||||||
}
|
}
|
||||||
@ -163,5 +162,3 @@ int testCompareDomXML2XMLFiles(virCapsPtr caps,
|
|||||||
bool live,
|
bool live,
|
||||||
unsigned int parseFlags,
|
unsigned int parseFlags,
|
||||||
testCompareDomXML2XMLResult expectResult);
|
testCompareDomXML2XMLResult expectResult);
|
||||||
|
|
||||||
#endif /* LIBVIRT_TESTUTILS_H */
|
|
||||||
|
@ -14,12 +14,11 @@
|
|||||||
* <http://www.gnu.org/licenses/>.
|
* <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LIBVIRT_TESTUTILSHOSTCPUS_H
|
#pragma once
|
||||||
# define LIBVIRT_TESTUTILSHOSTCPUS_H
|
|
||||||
|
|
||||||
# include "conf/cpu_conf.h"
|
#include "conf/cpu_conf.h"
|
||||||
# include "internal.h"
|
#include "internal.h"
|
||||||
# include "util/virarch.h"
|
#include "util/virarch.h"
|
||||||
|
|
||||||
static virCPUFeatureDef cpuDefaultFeatures[] = {
|
static virCPUFeatureDef cpuDefaultFeatures[] = {
|
||||||
{ (char *) "ds", -1 },
|
{ (char *) "ds", -1 },
|
||||||
@ -165,5 +164,3 @@ testUtilsHostCpusGetDefForArch(virArch arch)
|
|||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* LIBVIRT_TESTUTILSHOSTCPUS_H */
|
|
||||||
|
@ -14,14 +14,11 @@
|
|||||||
* <http://www.gnu.org/licenses/>.
|
* <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LIBVIRT_TESTUTILSLXC_H
|
#pragma once
|
||||||
# define LIBVIRT_TESTUTILSLXC_H
|
|
||||||
|
|
||||||
# include "capabilities.h"
|
#include "capabilities.h"
|
||||||
|
|
||||||
# define FAKEDEVDIR0 "/fakedevdir0/bla/fasl"
|
#define FAKEDEVDIR0 "/fakedevdir0/bla/fasl"
|
||||||
# define FAKEDEVDIR1 "/fakedevdir1/bla/fasl"
|
#define FAKEDEVDIR1 "/fakedevdir1/bla/fasl"
|
||||||
|
|
||||||
virCapsPtr testLXCCapsInit(void);
|
virCapsPtr testLXCCapsInit(void);
|
||||||
|
|
||||||
#endif /* LIBVIRT_TESTUTILSLXC_H */
|
|
||||||
|
@ -14,18 +14,17 @@
|
|||||||
* <http://www.gnu.org/licenses/>.
|
* <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LIBVIRT_TESTUTILSQEMU_H
|
#pragma once
|
||||||
# define LIBVIRT_TESTUTILSQEMU_H
|
|
||||||
|
|
||||||
# ifdef WITH_QEMU
|
#ifdef WITH_QEMU
|
||||||
|
|
||||||
# include "capabilities.h"
|
# include "capabilities.h"
|
||||||
# include "virfilecache.h"
|
# include "virfilecache.h"
|
||||||
# include "domain_conf.h"
|
# include "domain_conf.h"
|
||||||
# include "qemu/qemu_capabilities.h"
|
# include "qemu/qemu_capabilities.h"
|
||||||
# include "qemu/qemu_conf.h"
|
# include "qemu/qemu_conf.h"
|
||||||
|
|
||||||
# define TEST_QEMU_CAPS_PATH abs_srcdir "/qemucapabilitiesdata"
|
# define TEST_QEMU_CAPS_PATH abs_srcdir "/qemucapabilitiesdata"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
GIC_NONE = 0,
|
GIC_NONE = 0,
|
||||||
@ -107,6 +106,4 @@ int testQemuInfoSetArgs(struct testQemuInfo *info,
|
|||||||
virHashTablePtr capslatest, ...);
|
virHashTablePtr capslatest, ...);
|
||||||
void testQemuInfoClear(struct testQemuInfo *info);
|
void testQemuInfoClear(struct testQemuInfo *info);
|
||||||
|
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
#endif /* LIBVIRT_TESTUTILSQEMU_H */
|
|
||||||
|
@ -16,12 +16,11 @@
|
|||||||
* <http://www.gnu.org/licenses/>.
|
* <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LIBVIRT_TESTUTILSQEMUSCHEMA_H
|
#pragma once
|
||||||
# define LIBVIRT_TESTUTILSQEMUSCHEMA_H
|
|
||||||
|
|
||||||
# include "virhash.h"
|
#include "virhash.h"
|
||||||
# include "virjson.h"
|
#include "virjson.h"
|
||||||
# include "virbuffer.h"
|
#include "virbuffer.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
testQEMUSchemaValidate(virJSONValuePtr obj,
|
testQEMUSchemaValidate(virJSONValuePtr obj,
|
||||||
@ -34,5 +33,3 @@ testQEMUSchemaGetLatest(void);
|
|||||||
|
|
||||||
virHashTablePtr
|
virHashTablePtr
|
||||||
testQEMUSchemaLoad(void);
|
testQEMUSchemaLoad(void);
|
||||||
|
|
||||||
#endif /* LIBVIRT_TESTUTILSQEMUSCHEMA_H */
|
|
||||||
|
@ -14,14 +14,11 @@
|
|||||||
* <http://www.gnu.org/licenses/>.
|
* <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LIBVIRT_TESTUTILSXEN_H
|
#pragma once
|
||||||
# define LIBVIRT_TESTUTILSXEN_H
|
|
||||||
|
|
||||||
# include "capabilities.h"
|
#include "capabilities.h"
|
||||||
# ifdef WITH_LIBXL
|
#ifdef WITH_LIBXL
|
||||||
# include "libxl/libxl_capabilities.h"
|
# include "libxl/libxl_capabilities.h"
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
virCapsPtr testXLInitCaps(void);
|
virCapsPtr testXLInitCaps(void);
|
||||||
|
|
||||||
#endif /* LIBVIRT_TESTUTILSXEN_H */
|
|
||||||
|
@ -16,8 +16,7 @@
|
|||||||
* <http://www.gnu.org/licenses/>.
|
* <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LIBVIRT_VIRFILEWRAPPER_H
|
#pragma once
|
||||||
# define LIBVIRT_VIRFILEWRAPPER_H
|
|
||||||
|
|
||||||
void
|
void
|
||||||
virFileWrapperAddPrefix(const char *prefix,
|
virFileWrapperAddPrefix(const char *prefix,
|
||||||
@ -28,5 +27,3 @@ virFileWrapperRemovePrefix(const char *prefix);
|
|||||||
|
|
||||||
void
|
void
|
||||||
virFileWrapperClearPrefixes(void);
|
virFileWrapperClearPrefixes(void);
|
||||||
|
|
||||||
#endif /* LIBVIRT_VIRFILEWRAPPER_H */
|
|
||||||
|
@ -14,8 +14,7 @@
|
|||||||
* <http://www.gnu.org/licenses/>.
|
* <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LIBVIRT_VIRHASHDATA_H
|
#pragma once
|
||||||
# define LIBVIRT_VIRHASHDATA_H
|
|
||||||
|
|
||||||
const char *uuids[] = {
|
const char *uuids[] = {
|
||||||
/* [ 2] */ "a9b02f96-e430-4f7c-a7ff-a647d080447a",
|
/* [ 2] */ "a9b02f96-e430-4f7c-a7ff-a647d080447a",
|
||||||
@ -283,5 +282,3 @@ const char *uuids_new[] = {
|
|||||||
"5920cc9d-62a3-4772-9e73-eb97f0bc483c",
|
"5920cc9d-62a3-4772-9e73-eb97f0bc483c",
|
||||||
"53c215dd-bdba-4fdc-887a-86ab6f860df4",
|
"53c215dd-bdba-4fdc-887a-86ab6f860df4",
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* LIBVIRT_VIRHASHDATA_H */
|
|
||||||
|
115
tests/virmock.h
115
tests/virmock.h
@ -19,60 +19,59 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LIBVIRT_VIRMOCK_H
|
#pragma once
|
||||||
# define LIBVIRT_VIRMOCK_H
|
|
||||||
|
|
||||||
# if HAVE_DLFCN_H
|
#if HAVE_DLFCN_H
|
||||||
# include <dlfcn.h>
|
# include <dlfcn.h>
|
||||||
# endif
|
#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_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_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_ARG_PASTE(a, b, ...) a##b(__VA_ARGS__)
|
||||||
|
|
||||||
# define VIR_MOCK_ARGNAME(a, b) b
|
#define VIR_MOCK_ARGNAME(a, b) b
|
||||||
# define VIR_MOCK_ARGTYPE(a, b) a
|
#define VIR_MOCK_ARGTYPE(a, b) a
|
||||||
# define VIR_MOCK_ARGTYPENAME(a, b) a b
|
#define VIR_MOCK_ARGTYPENAME(a, b) a b
|
||||||
# define VIR_MOCK_ARGTYPENAME_UNUSED(a, b) a b ATTRIBUTE_UNUSED
|
#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_ARG2(z, a, b) z(a, b)
|
||||||
# define VIR_MOCK_GET_ARG3(z, a, b, c) 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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_EXPAND(a, b, ...) VIR_MOCK_ARG_PASTE(a, b, __VA_ARGS__)
|
||||||
# define VIR_MOCK_ARGNAMES(...) \
|
#define VIR_MOCK_ARGNAMES(...) \
|
||||||
VIR_MOCK_ARGNAMES_EXPAND(VIR_MOCK_GET_ARG, VIR_MOCK_COUNT_ARGS(__VA_ARGS__), VIR_MOCK_ARGNAME, __VA_ARGS__)
|
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_EXPAND(a, b, ...) VIR_MOCK_ARG_PASTE(a, b, __VA_ARGS__)
|
||||||
# define VIR_MOCK_ARGTYPES(...) \
|
#define VIR_MOCK_ARGTYPES(...) \
|
||||||
VIR_MOCK_ARGTYPES_EXPAND(VIR_MOCK_GET_ARG, VIR_MOCK_COUNT_ARGS(__VA_ARGS__), VIR_MOCK_ARGTYPE, __VA_ARGS__)
|
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_EXPAND(a, b, ...) VIR_MOCK_ARG_PASTE(a, b, __VA_ARGS__)
|
||||||
# define VIR_MOCK_ARGTYPENAMES(...) \
|
#define VIR_MOCK_ARGTYPENAMES(...) \
|
||||||
VIR_MOCK_ARGTYPENAMES_EXPAND(VIR_MOCK_GET_ARG, VIR_MOCK_COUNT_ARGS(__VA_ARGS__), VIR_MOCK_ARGTYPENAME, __VA_ARGS__)
|
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_EXPAND(a, b, ...) VIR_MOCK_ARG_PASTE(a, b, __VA_ARGS__)
|
||||||
# define VIR_MOCK_ARGTYPENAMES_UNUSED(...) \
|
#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__)
|
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
|
* Define a replacement for @name which invokes wrap_@name
|
||||||
* forwarding on all args, and passing back the return value.
|
* 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__)) \
|
rettype name(VIR_MOCK_ARGTYPENAMES(__VA_ARGS__)) \
|
||||||
{ \
|
{ \
|
||||||
static rettype (*wrap_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \
|
static rettype (*wrap_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \
|
||||||
@ -120,7 +119,7 @@
|
|||||||
* Define a replacement for @name which invokes wrap_@name
|
* Define a replacement for @name which invokes wrap_@name
|
||||||
* with no arguments, and passing back the return value.
|
* 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) \
|
rettype name(void) \
|
||||||
{ \
|
{ \
|
||||||
static rettype (*wrap_##name)(void); \
|
static rettype (*wrap_##name)(void); \
|
||||||
@ -142,7 +141,7 @@
|
|||||||
* Define a replacement for @name which invokes wrap_@name
|
* Define a replacement for @name which invokes wrap_@name
|
||||||
* forwarding on all args, but with no return value.
|
* 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__)) \
|
void name(VIR_MOCK_ARGTYPENAMES(__VA_ARGS__)) \
|
||||||
{ \
|
{ \
|
||||||
static void (*wrap_##name)(VIR_MOCK_ARGTYPES(__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
|
* Define a replacement for @name which doesn't invoke anything, just
|
||||||
* returns @retval.
|
* 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__)) \
|
rettype name(VIR_MOCK_ARGTYPENAMES_UNUSED(__VA_ARGS__)) \
|
||||||
{ \
|
{ \
|
||||||
return retval; \
|
return retval; \
|
||||||
@ -191,7 +190,7 @@
|
|||||||
* Define a replacement for @name which doesn't invoke anything, just
|
* Define a replacement for @name which doesn't invoke anything, just
|
||||||
* returns @retval.
|
* returns @retval.
|
||||||
*/
|
*/
|
||||||
# define VIR_MOCK_STUB_RET_VOID(name, rettype, retval) \
|
#define VIR_MOCK_STUB_RET_VOID(name, rettype, retval) \
|
||||||
rettype name(void) \
|
rettype name(void) \
|
||||||
{ \
|
{ \
|
||||||
return retval; \
|
return retval; \
|
||||||
@ -205,7 +204,7 @@
|
|||||||
* Define a replacement for @name which doesn't invoke or return
|
* Define a replacement for @name which doesn't invoke or return
|
||||||
* anything.
|
* anything.
|
||||||
*/
|
*/
|
||||||
# define VIR_MOCK_STUB_VOID_ARGS(name, ...) \
|
#define VIR_MOCK_STUB_VOID_ARGS(name, ...) \
|
||||||
void name(VIR_MOCK_ARGTYPENAMES_UNUSED(__VA_ARGS__)) \
|
void name(VIR_MOCK_ARGTYPENAMES_UNUSED(__VA_ARGS__)) \
|
||||||
{ \
|
{ \
|
||||||
}
|
}
|
||||||
@ -219,7 +218,7 @@
|
|||||||
* Define a replacement for @name which doesn't invoke or return
|
* Define a replacement for @name which doesn't invoke or return
|
||||||
* anything.
|
* anything.
|
||||||
*/
|
*/
|
||||||
# define VIR_MOCK_STUB_VOID_VOID(name) \
|
#define VIR_MOCK_STUB_VOID_VOID(name) \
|
||||||
void name(void) \
|
void name(void) \
|
||||||
{ \
|
{ \
|
||||||
}
|
}
|
||||||
@ -232,22 +231,22 @@
|
|||||||
* as the body of the method.
|
* 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__)); \
|
rettype name(VIR_MOCK_ARGTYPENAMES(__VA_ARGS__)); \
|
||||||
static rettype (*real_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \
|
static rettype (*real_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \
|
||||||
rettype name(VIR_MOCK_ARGTYPENAMES_UNUSED(__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); \
|
rettype name(void); \
|
||||||
static rettype (*real_##name)(void); \
|
static rettype (*real_##name)(void); \
|
||||||
rettype 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__)); \
|
void name(VIR_MOCK_ARGTYPENAMES(__VA_ARGS__)); \
|
||||||
static void (*real_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \
|
static void (*real_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \
|
||||||
void name(VIR_MOCK_ARGTYPENAMES_UNUSED(__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); \
|
void name(void); \
|
||||||
static void (*real_##name)(void); \
|
static void (*real_##name)(void); \
|
||||||
void name(void)
|
void name(void)
|
||||||
@ -259,28 +258,28 @@
|
|||||||
* as the body of the method.
|
* 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__)); \
|
rettype wrap_##name(VIR_MOCK_ARGTYPENAMES(__VA_ARGS__)); \
|
||||||
static rettype (*real_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \
|
static rettype (*real_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \
|
||||||
rettype wrap_##name(VIR_MOCK_ARGTYPENAMES_UNUSED(__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); \
|
rettype wrap_##name(void); \
|
||||||
static rettype (*real_##name)(void); \
|
static rettype (*real_##name)(void); \
|
||||||
rettype wrap_##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__)); \
|
void wrap_##name(VIR_MOCK_ARGTYPENAMES(__VA_ARGS__)); \
|
||||||
static void (*real_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \
|
static void (*real_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \
|
||||||
void wrap_##name(VIR_MOCK_ARGTYPENAMES_UNUSED(__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); \
|
void wrap_##name(void); \
|
||||||
static void (*real_##name)(void); \
|
static void (*real_##name)(void); \
|
||||||
void wrap_##name(void)
|
void wrap_##name(void)
|
||||||
|
|
||||||
|
|
||||||
# define VIR_MOCK_REAL_INIT(name) \
|
#define VIR_MOCK_REAL_INIT(name) \
|
||||||
do { \
|
do { \
|
||||||
if (real_##name == NULL && \
|
if (real_##name == NULL && \
|
||||||
!(real_##name = dlsym(RTLD_NEXT, \
|
!(real_##name = dlsym(RTLD_NEXT, \
|
||||||
@ -289,5 +288,3 @@
|
|||||||
abort(); \
|
abort(); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#endif /* LIBVIRT_VIRMOCK_H */
|
|
||||||
|
@ -16,17 +16,16 @@
|
|||||||
* <http://www.gnu.org/licenses/>.
|
* <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LIBVIRT_VIRNETTLSHELPERS_H
|
#pragma once
|
||||||
# define LIBVIRT_VIRNETTLSHELPERS_H
|
|
||||||
|
|
||||||
# include <gnutls/gnutls.h>
|
#include <gnutls/gnutls.h>
|
||||||
# include <gnutls/x509.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
|
* This contains parameter about how to generate
|
||||||
@ -77,6 +76,4 @@ void testTLSDiscardCert(struct testTLSCertReq *req);
|
|||||||
void testTLSInit(const char *keyfile);
|
void testTLSInit(const char *keyfile);
|
||||||
void testTLSCleanup(const char *keyfile);
|
void testTLSCleanup(const char *keyfile);
|
||||||
|
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
#endif /* LIBVIRT_VIRNETTLSHELPERS_H */
|
|
||||||
|
Loading…
Reference in New Issue
Block a user