From: Jim Meyering <meyering(a)redhat.com>
* tests/virshtest.c (mymain): Use only one definition of this function.
[WIN32]: Call exit(77) to skip the test.
* tests/nodeinfotest.c: Likewise.
---
tests/nodeinfotest.c | 8 +++-----
tests/virshtest.c | 11 ++++-------
2 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/tests/nodeinfotest.c b/tests/nodeinfotest.c
index 66f60d9..ea7819a 100644
--- a/tests/nodeinfotest.c
+++ b/tests/nodeinfotest.c
@@ -15,8 +15,6 @@ static char *abs_srcdir;
#define MAX_FILE 4096
-#ifdef __linux__
-
extern int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo, virNodeInfoPtr
nodeinfo);
static int linuxTestCompareFiles(const char *cpuinfofile, const char *outputfile) {
@@ -64,14 +62,12 @@ static int linuxTestNodeInfo(const void *data) {
abs_srcdir, (const char*)data);
return linuxTestCompareFiles(cpuinfo, output);
}
-#endif
static int
mymain(int argc, char **argv)
{
int ret = 0;
-#ifdef __linux__
int i;
const char *nodeData[] = {
"nodeinfo-1",
@@ -82,6 +78,9 @@ mymain(int argc, char **argv)
"nodeinfo-6",
};
char cwd[PATH_MAX];
+#ifndef __linux__
+ exit (77); /* means 'test skipped' for automake */
+#endif
abs_srcdir = getenv("abs_srcdir");
if (!abs_srcdir)
@@ -99,7 +98,6 @@ mymain(int argc, char **argv)
for (i = 0 ; i < ARRAY_CARDINALITY(nodeData); i++)
if (virtTestRun(nodeData[i], 1, linuxTestNodeInfo, nodeData[i]) != 0)
ret = -1;
-#endif
return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
diff --git a/tests/virshtest.c b/tests/virshtest.c
index c080362..c9ba6b2 100644
--- a/tests/virshtest.c
+++ b/tests/virshtest.c
@@ -265,8 +265,6 @@ static int testCompareDomstateByName(const void *data
ATTRIBUTE_UNUSED) {
argv);
}
-
-#ifndef WIN32
static int
mymain(int argc, char **argv)
{
@@ -278,6 +276,10 @@ mymain(int argc, char **argv)
if (!abs_srcdir)
abs_srcdir = getcwd(cwd, sizeof(cwd));
+#ifdef WIN32
+ exit (77); /* means 'test skipped' for automake */
+#endif
+
snprintf(buffer, PATH_MAX-1, "test://%s/../docs/testnode.xml",
abs_srcdir);
buffer[PATH_MAX-1] = '\0';
progname = argv[0];
@@ -354,10 +356,5 @@ mymain(int argc, char **argv)
return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
-#else /* ! WIN32 */
-
-static int mymain (void) { exit (77); /* means 'test skipped' for automake */ }
-
-#endif /* WIN32 */
VIRT_TEST_MAIN(mymain)
--
1.6.0.3.756.gb776d