mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-05 04:41:20 +00:00
9ba4eb3c08
Make virtTestLoadFile allocate the buffer to read the file into. Fix logic error in virtTestLoadFile, stop reading on the first empty line. Use virFileReadLimFD in virtTestCaptureProgramOutput to avoid manual buffer handling.
56 lines
1.5 KiB
C
56 lines
1.5 KiB
C
/*
|
|
* utils.c: test utils
|
|
*
|
|
* Copyright (C) 2005, 2008-2011 Red Hat, Inc.
|
|
*
|
|
* See COPYING.LIB for the License of this software
|
|
*
|
|
* Karel Zak <kzak@redhat.com>
|
|
*/
|
|
|
|
#ifndef __VIT_TEST_UTILS_H__
|
|
# define __VIT_TEST_UTILS_H__
|
|
|
|
# include <stdio.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 */
|
|
|
|
extern char *progname;
|
|
extern char *abs_srcdir;
|
|
|
|
double virtTestCountAverage(double *items,
|
|
int nitems);
|
|
|
|
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);
|
|
int virtTestLoadFile(const char *file, char **buf);
|
|
int virtTestCaptureProgramOutput(const char *const argv[], char **buf, int maxlen);
|
|
|
|
int virtTestClearLineRegex(const char *pattern,
|
|
char *string);
|
|
|
|
int virtTestDifference(FILE *stream,
|
|
const char *expect,
|
|
const char *actual);
|
|
|
|
unsigned int virTestGetDebug(void);
|
|
unsigned int virTestGetVerbose(void);
|
|
|
|
char *virtTestLogContentAndReset(void);
|
|
|
|
int virtTestMain(int argc,
|
|
char **argv,
|
|
int (*func)(void));
|
|
|
|
/* Setup, then call func() */
|
|
# define VIRT_TEST_MAIN(func) \
|
|
int main(int argc, char **argv) { \
|
|
return virtTestMain(argc, argv, func); \
|
|
}
|
|
|
|
#endif /* __VIT_TEST_UTILS_H__ */
|