Files
libvirt/tests/testutils.h
T

60 lines
1.7 KiB
C
Raw Normal View History

2006-05-09 15:35:46 +00:00
/*
* utils.c: test utils
*
2011-04-29 10:21:20 -06:00
* Copyright (C) 2005, 2008-2011 Red Hat, Inc.
2006-05-09 15:35:46 +00:00
*
* See COPYING.LIB for the License of this software
*
* Karel Zak <kzak@redhat.com>
*/
#ifndef __VIT_TEST_UTILS_H__
# define __VIT_TEST_UTILS_H__
2006-05-09 15:35:46 +00:00
# include <stdio.h>
2009-05-12 16:45:14 +00:00
# define EXIT_AM_SKIP 77 /* tell Automake we're skipping a test */
2011-04-29 10:21:20 -06:00
# define EXIT_AM_HARDFAIL 99 /* tell Automake that the framework is broken */
extern char *progname;
extern char *abs_srcdir;
double virtTestCountAverage(double *items,
int nitems);
2006-05-09 15:35:46 +00:00
2009-11-30 19:01:31 +00:00
void virtTestResult(const char *name, int ret, const char *msg, ...);
int virtTestRun(const char *title,
int nloops,
int (*body)(const void *data),
const void *data);
2011-04-25 00:25:10 +02:00
int virtTestLoadFile(const char *file, char **buf);
int virtTestCaptureProgramOutput(const char *const argv[], char **buf, int maxlen);
int virtTestClearLineRegex(const char *pattern,
char *string);
2006-05-09 15:35:46 +00:00
int virtTestDifference(FILE *stream,
const char *expect,
const char *actual);
int virtTestDifferenceBin(FILE *stream,
const char *expect,
const char *actual,
size_t length);
2006-05-09 15:35:46 +00:00
2009-11-30 19:01:31 +00:00
unsigned int virTestGetDebug(void);
unsigned int virTestGetVerbose(void);
2010-09-10 10:25:49 -06:00
char *virtTestLogContentAndReset(void);
int virtTestMain(int argc,
char **argv,
2011-04-29 10:21:20 -06:00
int (*func)(void));
2008-05-29 15:21:45 +00:00
2011-04-29 10:21:20 -06:00
/* Setup, then call func() */
# define VIRT_TEST_MAIN(func) \
int main(int argc, char **argv) { \
return virtTestMain(argc, argv, func); \
2008-05-29 15:21:45 +00:00
}
2006-05-09 15:35:46 +00:00
#endif /* __VIT_TEST_UTILS_H__ */