mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 01:34:11 +03:00
8fe454ce90
The bulk of this patch was done with: sed -i 's/\(\bfree *(/VIR_FREE(/g' tests/*.c followed by fixing the few compile errors that resulted. * cfg.mk (exclude_file_name_regexp--sc_prohibit_raw_allocation): Remove tests from exemption. * tests/testutils.h: Add common header. * tests/commandhelper.c: Fix offenders. * tests/cputest.c: Likewise. * tests/domainsnapshotxml2xmltest.c: Likewise. * tests/interfacexml2xmltest.c: Likewise. * tests/networkxml2argvtest.c: Likewise. * tests/networkxml2xmltest.c: Likewise. * tests/nodedevxml2xmltest.c: Likewise. * tests/nodeinfotest.c: Likewise. * tests/nwfilterxml2xmltest.c: Likewise. * tests/qemuargv2xmltest.c: Likewise. * tests/qemuxml2argvtest.c: Likewise. * tests/qemuxml2xmltest.c: Likewise. * tests/qemuxmlnstest.c: Likewise. * tests/qparamtest.c: Likewise. * tests/sexpr2xmltest.c: Likewise. * tests/storagepoolxml2xmltest.c: Likewise. * tests/storagevolxml2xmltest.c: Likewise. * tests/testutils.c: Likewise. * tests/virshtest.c: Likewise. * tests/xencapstest.c: Likewise. * tests/xmconfigtest.c: Likewise. * tests/xml2sexprtest.c: Likewise.
61 lines
1.7 KiB
C
61 lines
1.7 KiB
C
/*
|
|
* utils.c: test utils
|
|
*
|
|
* Copyright (C) 2005, 2008-2012 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>
|
|
# include "memory.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);
|
|
int virtTestDifferenceBin(FILE *stream,
|
|
const char *expect,
|
|
const char *actual,
|
|
size_t length);
|
|
|
|
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__ */
|