tests: simplify common setup

A few of the tests were missing basic sanity checks, while most
of them were doing copy-and-paste initialization (in fact, some
of them pasted the argc > 1 check more than once!).  It's much
nicer to do things in one common place, and minimizes the size of
the next patch that fixes getcwd usage.

* tests/testutils.h (EXIT_AM_HARDFAIL): New define.
(progname, abs_srcdir): Define for all tests.
(VIRT_TEST_MAIN): Change callback signature.
* tests/testutils.c (virtTestMain): Do more common init.
* tests/commandtest.c (mymain): Simplify.
* tests/cputest.c (mymain): Likewise.
* tests/esxutilstest.c (mymain): Likewise.
* tests/eventtest.c (mymain): Likewise.
* tests/hashtest.c (mymain): Likewise.
* tests/networkxml2xmltest.c (mymain): Likewise.
* tests/nodedevxml2xmltest.c (myname): Likewise.
* tests/nodeinfotest.c (mymain): Likewise.
* tests/nwfilterxml2xmltest.c (mymain): Likewise.
* tests/qemuargv2xmltest.c (mymain): Likewise.
* tests/qemuhelptest.c (mymain): Likewise.
* tests/qemuxml2argvtest.c (mymain): Likewise.
* tests/qemuxml2xmltest.c (mymain): Likewise.
* tests/qparamtest.c (mymain): Likewise.
* tests/sexpr2xmltest.c (mymain): Likewise.
* tests/sockettest.c (mymain): Likewise.
* tests/statstest.c (mymain): Likewise.
* tests/storagepoolxml2xmltest.c (mymain): Likewise.
* tests/storagevolxml2xmltest.c (mymain): Likewise.
* tests/virbuftest.c (mymain): Likewise.
* tests/virshtest.c (mymain): Likewise.
* tests/vmx2xmltest.c (mymain): Likewise.
* tests/xencapstest.c (mymain): Likewise.
* tests/xmconfigtest.c (mymain): Likewise.
* tests/xml2sexprtest.c (mymain): Likewise.
* tests/xml2vmxtest.c (mymain): Likewise.
This commit is contained in:
Eric Blake 2011-04-29 10:21:20 -06:00
parent 63956ca055
commit 20986e58aa
29 changed files with 65 additions and 380 deletions

View File

@ -46,10 +46,6 @@ mymain(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
#else
static char *progname;
static char *abs_srcdir;
static int checkoutput(const char *testname)
{
int ret = -1;
@ -754,23 +750,11 @@ cleanup:
}
static int
mymain(int argc, char **argv)
mymain(void)
{
int ret = 0;
char cwd[PATH_MAX];
int fd;
abs_srcdir = getenv("abs_srcdir");
if (!abs_srcdir)
abs_srcdir = getcwd(cwd, sizeof(cwd));
progname = argv[0];
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return(EXIT_FAILURE);
}
if (chdir("/tmp") < 0)
return(EXIT_FAILURE);

View File

@ -1,7 +1,7 @@
/*
* cputest.c: Test the libvirtd internal CPU APIs
*
* Copyright (C) 2010 Red Hat, Inc.
* Copyright (C) 2010-2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -39,8 +39,6 @@
#include "cpu/cpu.h"
#include "cpu/cpu_map.h"
static const char *progname;
static const char *abs_srcdir;
static const char *abs_top_srcdir;
#define VIR_FROM_THIS VIR_FROM_CPU
@ -494,23 +492,11 @@ static const char *nomodel[] = { "nomodel" };
static const char *models[] = { "qemu64", "core2duo", "Nehalem" };
static int
mymain(int argc, char **argv)
mymain(void)
{
int ret = 0;
char cwd[PATH_MAX];
char map[PATH_MAX];
progname = argv[0];
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return EXIT_FAILURE;
}
abs_srcdir = getenv("abs_srcdir");
if (!abs_srcdir)
abs_srcdir = getcwd(cwd, sizeof(cwd));
abs_top_srcdir = getenv("abs_top_srcdir");
if (!abs_top_srcdir)
abs_top_srcdir = "..";

View File

@ -14,9 +14,6 @@
# include "esx/esx_util.h"
# include "esx/esx_vi_types.h"
static char *progname;
static void
testQuietError(void *userData ATTRIBUTE_UNUSED,
@ -323,22 +320,10 @@ testConvertWindows1252ToUTF8(const void *data ATTRIBUTE_UNUSED)
static int
mymain(int argc, char **argv)
mymain(void)
{
int result = 0;
progname = argv[0];
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return EXIT_FAILURE;
}
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return EXIT_FAILURE;
}
virSetErrorFunc(NULL, testQuietError);
# define DO_TEST(_name) \

View File

@ -259,20 +259,12 @@ resetAll(void)
}
static int
mymain(int argc, char **argv)
mymain(void)
{
char *progname;
int i;
pthread_t eventThread;
char one = '1';
progname = argv[0];
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return EXIT_FAILURE;
}
for (i = 0 ; i < NUM_FDS ; i++) {
if (pipe(handles[i].pipeFD) < 0) {
fprintf(stderr, "Cannot create pipe: %d", errno);
@ -483,5 +475,4 @@ mymain(int argc, char **argv)
return EXIT_SUCCESS;
}
VIRT_TEST_MAIN(mymain)

View File

@ -476,8 +476,7 @@ cleanup:
static int
mymain(int argc ATTRIBUTE_UNUSED,
char **argv ATTRIBUTE_UNUSED)
mymain(void)
{
int ret = 0;

View File

@ -13,9 +13,6 @@
#include "interface_conf.h"
#include "testutilsqemu.h"
static char *progname;
static char *abs_srcdir;
#define MAX_FILE 4096
@ -57,21 +54,9 @@ static int testCompareXMLToXMLHelper(const void *data) {
static int
mymain(int argc, char **argv)
mymain(void)
{
int ret = 0;
char cwd[PATH_MAX];
progname = argv[0];
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return (EXIT_FAILURE);
}
abs_srcdir = getenv("abs_srcdir");
if (!abs_srcdir)
abs_srcdir = getcwd(cwd, sizeof(cwd));
#define DO_TEST(name) \
if (virtTestRun("Interface XML-2-XML " name, \

View File

@ -13,9 +13,6 @@
#include "network_conf.h"
#include "testutilsqemu.h"
static char *progname;
static char *abs_srcdir;
#define MAX_FILE 4096
@ -64,21 +61,9 @@ static int testCompareXMLToXMLHelper(const void *data) {
static int
mymain(int argc, char **argv)
mymain(void)
{
int ret = 0;
char cwd[PATH_MAX];
progname = argv[0];
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return (EXIT_FAILURE);
}
abs_srcdir = getenv("abs_srcdir");
if (!abs_srcdir)
abs_srcdir = getcwd(cwd, sizeof(cwd));
#define DO_TEST(name) \
if (virtTestRun("Network XML-2-XML " name, \

View File

@ -13,9 +13,6 @@
#include "node_device_conf.h"
#include "testutilsqemu.h"
static char *progname;
static char *abs_srcdir;
#define MAX_FILE 4096
@ -57,21 +54,9 @@ static int testCompareXMLToXMLHelper(const void *data) {
static int
mymain(int argc, char **argv)
mymain(void)
{
int ret = 0;
char cwd[PATH_MAX];
progname = argv[0];
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return (EXIT_FAILURE);
}
abs_srcdir = getenv("abs_srcdir");
if (!abs_srcdir)
abs_srcdir = getcwd(cwd, sizeof(cwd));
#define DO_TEST(name) \
if (virtTestRun("Node device XML-2-XML " name, \

View File

@ -21,9 +21,6 @@ mymain(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
#else
static char *progname;
static char *abs_srcdir;
# define MAX_FILE 4096
extern int linuxNodeInfoCPUPopulate(FILE *cpuinfo, virNodeInfoPtr nodeinfo,
@ -89,7 +86,7 @@ static int linuxTestNodeInfo(const void *data) {
static int
mymain(int argc, char **argv)
mymain(void)
{
int ret = 0;
int i;
@ -101,18 +98,6 @@ mymain(int argc, char **argv)
"nodeinfo-5",
"nodeinfo-6",
};
char cwd[PATH_MAX];
abs_srcdir = getenv("abs_srcdir");
if (!abs_srcdir)
abs_srcdir = getcwd(cwd, sizeof(cwd));
progname = argv[0];
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return(EXIT_FAILURE);
}
if (virInitialize() < 0)
return EXIT_FAILURE;

View File

@ -16,9 +16,6 @@
#include "nwfilter_conf.h"
#include "testutilsqemu.h"
static char *progname;
static char *abs_srcdir;
#define MAX_FILE 4096
@ -85,21 +82,9 @@ static int testCompareXMLToXMLHelper(const void *data) {
static int
mymain(int argc, char **argv)
mymain(void)
{
int ret = 0;
char cwd[PATH_MAX];
progname = argv[0];
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return (EXIT_FAILURE);
}
abs_srcdir = getenv("abs_srcdir");
if (!abs_srcdir)
abs_srcdir = getcwd(cwd, sizeof(cwd));
#define DO_TEST(NAME, EXPECT_WARN) \
do { \

View File

@ -16,8 +16,6 @@
# include "testutilsqemu.h"
static char *progname;
static char *abs_srcdir;
static struct qemud_driver driver;
# define MAX_FILE 4096
@ -103,21 +101,9 @@ static int testCompareXMLToArgvHelper(const void *data) {
static int
mymain(int argc, char **argv)
mymain(void)
{
int ret = 0;
char cwd[PATH_MAX];
progname = argv[0];
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return (EXIT_FAILURE);
}
abs_srcdir = getenv("abs_srcdir");
if (!abs_srcdir)
abs_srcdir = getcwd(cwd, sizeof(cwd));
if ((driver.caps = testQemuCapsInit()) == NULL)
return EXIT_FAILURE;

View File

@ -19,9 +19,6 @@ struct testInfo {
unsigned int kvm_version;
};
static char *progname;
static char *abs_srcdir;
static void printMismatchedFlags(virBitmapPtr got,
virBitmapPtr expect)
{
@ -121,21 +118,9 @@ cleanup:
}
static int
mymain(int argc, char **argv)
mymain(void)
{
int ret = 0;
char cwd[PATH_MAX];
progname = argv[0];
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return (EXIT_FAILURE);
}
abs_srcdir = getenv("abs_srcdir");
if (!abs_srcdir)
abs_srcdir = getcwd(cwd, sizeof(cwd));
# define DO_TEST(name, version, is_kvm, kvm_version, ...) \
do { \

View File

@ -19,8 +19,6 @@
# include "testutilsqemu.h"
static char *progname;
static char *abs_srcdir;
static const char *abs_top_srcdir;
static struct qemud_driver driver;
@ -190,23 +188,11 @@ static int testCompareXMLToArgvHelper(const void *data) {
static int
mymain(int argc, char **argv)
mymain(void)
{
int ret = 0;
char cwd[PATH_MAX];
char map[PATH_MAX];
progname = argv[0];
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return (EXIT_FAILURE);
}
abs_srcdir = getenv("abs_srcdir");
if (!abs_srcdir)
abs_srcdir = getcwd(cwd, sizeof(cwd));
abs_top_srcdir = getenv("abs_top_srcdir");
if (!abs_top_srcdir)
abs_top_srcdir = "..";

View File

@ -15,8 +15,6 @@
# include "qemu/qemu_conf.h"
# include "testutilsqemu.h"
static char *progname;
static char *abs_srcdir;
static struct qemud_driver driver;
# define MAX_FILE 4096
@ -83,21 +81,9 @@ static int testCompareXMLToXMLHelper(const void *data) {
static int
mymain(int argc, char **argv)
mymain(void)
{
int ret = 0;
char cwd[PATH_MAX];
progname = argv[0];
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return (EXIT_FAILURE);
}
abs_srcdir = getenv("abs_srcdir");
if (!abs_srcdir)
abs_srcdir = getcwd(cwd, sizeof(cwd));
if ((driver.caps = testQemuCapsInit()) == NULL)
return (EXIT_FAILURE);

View File

@ -183,8 +183,7 @@ static const struct qparamParseDataEntry params5[] = { { "foo", "one two" } };
static const struct qparamParseDataEntry params6[] = { { "foo", "one" } };
static int
mymain(int argc ATTRIBUTE_UNUSED,
char **argv ATTRIBUTE_UNUSED)
mymain(void)
{
int ret = 0;

View File

@ -13,8 +13,6 @@
#include "testutils.h"
#include "testutilsxen.h"
static char *progname;
static char *abs_srcdir;
static virCapsPtr caps;
#define MAX_FILE 4096
@ -99,26 +97,9 @@ static int testCompareHelper(const void *data) {
static int
mymain(int argc, char **argv)
mymain(void)
{
int ret = 0;
char cwd[PATH_MAX];
progname = argv[0];
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return(EXIT_FAILURE);
}
abs_srcdir = getenv("abs_srcdir");
if (!abs_srcdir)
abs_srcdir = getcwd(cwd, sizeof(cwd));
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return(EXIT_FAILURE);
}
if (!(caps = testXenCapsInit()))
return(EXIT_FAILURE);

View File

@ -1,7 +1,7 @@
/*
* sockettest.c: Testing for src/util/network.c APIs
*
* Copyright (C) 2010 Red Hat, Inc.
* Copyright (C) 2010-2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -159,8 +159,7 @@ static int testNetmaskHelper(const void *opaque)
static int
mymain(int argc ATTRIBUTE_UNUSED,
char **argv ATTRIBUTE_UNUSED)
mymain(void)
{
int ret = 0;
/* Some of our tests deliberately test failure cases, so

View File

@ -41,8 +41,7 @@ static int testDeviceHelper(const void *data)
}
static int
mymain(int argc ATTRIBUTE_UNUSED,
char **argv ATTRIBUTE_UNUSED)
mymain(void)
{
int ret = 0;
/* Some of our tests delibrately test failure cases, so

View File

@ -13,9 +13,6 @@
#include "storage_conf.h"
#include "testutilsqemu.h"
static char *progname;
static char *abs_srcdir;
#define MAX_FILE 4096
@ -64,21 +61,9 @@ static int testCompareXMLToXMLHelper(const void *data) {
static int
mymain(int argc, char **argv)
mymain(void)
{
int ret = 0;
char cwd[PATH_MAX];
progname = argv[0];
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return (EXIT_FAILURE);
}
abs_srcdir = getenv("abs_srcdir");
if (!abs_srcdir)
abs_srcdir = getcwd(cwd, sizeof(cwd));
#define DO_TEST(name) \
if (virtTestRun("Storage Pool XML-2-XML " name, \

View File

@ -13,9 +13,6 @@
#include "storage_conf.h"
#include "testutilsqemu.h"
static char *progname;
static char *abs_srcdir;
#define MAX_FILE 4096
@ -85,21 +82,9 @@ static int testCompareXMLToXMLHelper(const void *data) {
static int
mymain(int argc, char **argv)
mymain(void)
{
int ret = 0;
char cwd[PATH_MAX];
progname = argv[0];
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return (EXIT_FAILURE);
}
abs_srcdir = getenv("abs_srcdir");
if (!abs_srcdir)
abs_srcdir = getcwd(cwd, sizeof(cwd));
#define DO_TEST(pool, name) \
do { \

View File

@ -55,6 +55,9 @@ static unsigned int testVerbose = -1;
static unsigned int testOOM = 0;
static unsigned int testCounter = 0;
char *progname;
char *abs_srcdir;
double
virtTestCountAverage(double *items, int nitems)
{
@ -472,9 +475,10 @@ virTestGetVerbose(void) {
int virtTestMain(int argc,
char **argv,
int (*func)(int, char **))
int (*func)(void))
{
int ret;
char cwd[PATH_MAX];
#if TEST_OOM
int approxAlloc = 0;
int n;
@ -485,7 +489,20 @@ int virtTestMain(int argc,
int worker = 0;
#endif
fprintf(stderr, "TEST: %s\n", STRPREFIX(argv[0], "./") ? argv[0] + 2 : argv[0]);
abs_srcdir = getenv("abs_srcdir");
if (!abs_srcdir)
abs_srcdir = getcwd(cwd, sizeof(cwd));
if (!abs_srcdir)
exit(EXIT_AM_HARDFAIL);
progname = argv[0];
if (STRPREFIX(progname, "./"))
progname += 2;
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", argv[0]);
return EXIT_FAILURE;
}
fprintf(stderr, "TEST: %s\n", progname);
if (!virTestGetVerbose())
fprintf(stderr, " ");
@ -520,7 +537,7 @@ int virtTestMain(int argc,
}
/* Run once to prime any static allocations & ensure it passes */
ret = (func)(argc, argv);
ret = (func)();
if (ret != EXIT_SUCCESS)
goto cleanup;
@ -537,7 +554,7 @@ int virtTestMain(int argc,
virAllocTestInit();
/* Run again to count allocs, and ensure it passes :-) */
ret = (func)(argc, argv);
ret = (func)();
if (ret != EXIT_SUCCESS)
goto cleanup;
@ -574,7 +591,7 @@ int virtTestMain(int argc,
}
virAllocTestOOM(n+1, oomCount);
if (((func)(argc, argv)) != EXIT_FAILURE) {
if (((func)()) != EXIT_FAILURE) {
ret = EXIT_FAILURE;
break;
}
@ -604,7 +621,7 @@ int virtTestMain(int argc,
}
cleanup:
#else
ret = (func)(argc, argv);
ret = (func)();
#endif
virResetLastError();

View File

@ -1,7 +1,7 @@
/*
* utils.c: test utils
*
* Copyright (C) 2005, 2008-2010 Red Hat, Inc.
* Copyright (C) 2005, 2008-2011 Red Hat, Inc.
*
* See COPYING.LIB for the License of this software
*
@ -14,6 +14,10 @@
# 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);
@ -44,11 +48,12 @@ char *virtTestLogContentAndReset(void);
int virtTestMain(int argc,
char **argv,
int (*func)(int, char **));
int (*func)(void));
/* Setup, then call func() */
# define VIRT_TEST_MAIN(func) \
int main(int argc, char **argv) { \
return virtTestMain(argc,argv, func); \
return virtTestMain(argc, argv, func); \
}
#endif /* __VIT_TEST_UTILS_H__ */

View File

@ -64,8 +64,7 @@ out:
}
static int
mymain(int argc ATTRIBUTE_UNUSED,
char **argv ATTRIBUTE_UNUSED)
mymain(void)
{
int ret = 0;

View File

@ -8,8 +8,6 @@
#include "xml.h"
#include "testutils.h"
static char *progname;
static char *abs_srcdir;
#define MAX_FILE 4096
#define DOM_UUID "ef861801-45b9-11cb-88e3-afbfe5370493"
@ -232,30 +230,20 @@ static int testCompareEcho(const void *data) {
static int
mymain(int argc, char **argv)
mymain(void)
{
int ret = 0;
char buffer[PATH_MAX];
char cwd[PATH_MAX];
abs_srcdir = getenv("abs_srcdir");
if (!abs_srcdir)
abs_srcdir = getcwd(cwd, sizeof(cwd));
#ifdef WIN32
exit (EXIT_AM_SKIP);
#endif
snprintf(buffer, PATH_MAX-1, "test://%s/../examples/xml/test/testnode.xml", abs_srcdir);
snprintf(buffer, PATH_MAX-1,
"test://%s/../examples/xml/test/testnode.xml", abs_srcdir);
buffer[PATH_MAX-1] = '\0';
progname = argv[0];
custom_uri = buffer;
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return(EXIT_FAILURE);
}
if (virtTestRun("virsh list (default)",
1, testCompareListDefault, NULL) != 0)
ret = -1;

View File

@ -11,8 +11,6 @@
# include "testutils.h"
# include "vmx/vmx.h"
static char *progname = NULL;
static char *abs_srcdir = NULL;
static virCapsPtr caps = NULL;
static virVMXContext ctx;
@ -181,28 +179,9 @@ testParseVMXFileName(const char *fileName, void *opaque ATTRIBUTE_UNUSED)
}
static int
mymain(int argc, char **argv)
mymain(void)
{
int result = 0;
char cwd[PATH_MAX];
progname = argv[0];
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return EXIT_FAILURE;
}
abs_srcdir = getenv("abs_srcdir");
if (abs_srcdir == NULL) {
abs_srcdir = getcwd(cwd, sizeof(cwd));
}
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return EXIT_FAILURE;
}
# define DO_TEST(_in, _out) \
do { \

View File

@ -11,9 +11,6 @@
#include "xen/xen_hypervisor.h"
#include "files.h"
static char *progname;
static char *abs_srcdir;
#define MAX_FILE 4096
static int testCompareFiles(const char *hostmachine,
@ -151,21 +148,9 @@ static int testXenppc64(const void *data ATTRIBUTE_UNUSED) {
static int
mymain(int argc, char **argv)
mymain(void)
{
int ret = 0;
char cwd[PATH_MAX];
progname = argv[0];
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return(EXIT_FAILURE);
}
abs_srcdir = getenv("abs_srcdir");
if (!abs_srcdir)
abs_srcdir = getcwd(cwd, sizeof(cwd));
virInitialize();

View File

@ -1,7 +1,7 @@
/*
* xmconfigtest.c: Test backend for xm_internal config file handling
*
* Copyright (C) 2007, 2010 Red Hat, Inc.
* Copyright (C) 2007, 2010-2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -36,8 +36,6 @@
#include "testutilsxen.h"
#include "memory.h"
static char *progname;
static char *abs_srcdir;
static virCapsPtr caps;
#define MAX_FILE 4096
@ -174,21 +172,9 @@ static int testCompareHelper(const void *data) {
static int
mymain(int argc, char **argv)
mymain(void)
{
int ret = 0;
char cwd[PATH_MAX];
progname = argv[0];
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return(EXIT_FAILURE);
}
abs_srcdir = getenv("abs_srcdir");
if (!abs_srcdir)
abs_srcdir = getcwd(cwd, sizeof(cwd));
if (!(caps = testXenCapsInit()))
return(EXIT_FAILURE);

View File

@ -14,8 +14,6 @@
#include "testutils.h"
#include "testutilsxen.h"
static char *progname;
static char *abs_srcdir;
static virCapsPtr caps;
#define MAX_FILE 4096
@ -77,21 +75,9 @@ static int testCompareHelper(const void *data) {
static int
mymain(int argc, char **argv)
mymain(void)
{
int ret = 0;
char cwd[PATH_MAX];
progname = argv[0];
abs_srcdir = getenv("abs_srcdir");
if (!abs_srcdir)
abs_srcdir = getcwd(cwd, sizeof(cwd));
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return(EXIT_FAILURE);
}
#define DO_TEST(in, out, name, version) \
do { \

View File

@ -11,8 +11,6 @@
# include "testutils.h"
# include "vmx/vmx.h"
static char *progname = NULL;
static char *abs_srcdir = NULL;
static virCapsPtr caps = NULL;
static virVMXContext ctx;
@ -198,28 +196,9 @@ testFormatVMXFileName(const char *src, void *opaque ATTRIBUTE_UNUSED)
}
static int
mymain(int argc, char **argv)
mymain(void)
{
int result = 0;
char cwd[PATH_MAX];
progname = argv[0];
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return EXIT_FAILURE;
}
abs_srcdir = getenv("abs_srcdir");
if (abs_srcdir == NULL) {
abs_srcdir = getcwd(cwd, sizeof(cwd));
}
if (argc > 1) {
fprintf(stderr, "Usage: %s\n", progname);
return EXIT_FAILURE;
}
# define DO_TEST(_in, _out, _version) \
do { \