Prefer 'return EXIT_AM_SKIP' over 'exit(EXIT_AM_SKIP)'.
Prefer 'int main(void)' over 'int main(int argc, char **argv)'.
Fix mymain signature in commandtest and nodeinfotest.
---
tests/commandtest.c | 10 +++++-----
tests/nodeinfotest.c | 10 +++++-----
tests/qemuargv2xmltest.c | 6 +++++-
tests/qemuxml2xmltest.c | 6 +++++-
tests/virnettlscontexttest.c | 6 ++++--
tests/virshtest.c | 26 +++++++++++++++++---------
6 files changed, 41 insertions(+), 23 deletions(-)
diff --git a/tests/commandtest.c b/tests/commandtest.c
index ef2850d..2e800ae 100644
--- a/tests/commandtest.c
+++ b/tests/commandtest.c
@@ -38,10 +38,10 @@
#ifdef WIN32
-static int
-mymain(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
+int
+main(void)
{
- exit (EXIT_AM_SKIP);
+ return EXIT_AM_SKIP;
}
#else
@@ -814,6 +814,6 @@ mymain(void)
return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
-#endif /* !WIN32 */
-
VIRT_TEST_MAIN(mymain)
+
+#endif /* !WIN32 */
diff --git a/tests/nodeinfotest.c b/tests/nodeinfotest.c
index 5abee92..448e072 100644
--- a/tests/nodeinfotest.c
+++ b/tests/nodeinfotest.c
@@ -15,10 +15,10 @@
defined(__amd64__) || \
defined(__i386__)))
-static int
-mymain(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
+int
+main(void)
{
- exit (EXIT_AM_SKIP);
+ return EXIT_AM_SKIP;
}
#else
@@ -130,6 +130,6 @@ mymain(void)
return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
-#endif /* __linux__ */
-
VIRT_TEST_MAIN(mymain)
+
+#endif /* __linux__ */
diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c
index bade95d..c2b6cf2 100644
--- a/tests/qemuargv2xmltest.c
+++ b/tests/qemuargv2xmltest.c
@@ -239,6 +239,10 @@ VIRT_TEST_MAIN(mymain)
#else
-int main (void) { return (EXIT_AM_SKIP); }
+int
+main(void)
+{
+ return EXIT_AM_SKIP;
+}
#endif /* WITH_QEMU */
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index f1900c5..461fd0d 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -204,6 +204,10 @@ VIRT_TEST_MAIN(mymain)
#else
-int main (void) { exit (EXIT_AM_SKIP); }
+int
+main(void)
+{
+ return EXIT_AM_SKIP;
+}
#endif /* WITH_QEMU */
diff --git a/tests/virnettlscontexttest.c b/tests/virnettlscontexttest.c
index 12ecf1e..520b006 100644
--- a/tests/virnettlscontexttest.c
+++ b/tests/virnettlscontexttest.c
@@ -1249,9 +1249,11 @@ mymain(void)
VIRT_TEST_MAIN(mymain)
#else
+
int
-main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
+main(void)
{
- exit (EXIT_AM_SKIP);
+ return EXIT_AM_SKIP;
}
+
#endif
diff --git a/tests/virshtest.c b/tests/virshtest.c
index e22e582..de5138c 100644
--- a/tests/virshtest.c
+++ b/tests/virshtest.c
@@ -9,7 +9,17 @@
#include "util.h"
#include "testutils.h"
-#define DOM_UUID "ef861801-45b9-11cb-88e3-afbfe5370493"
+#ifdef WIN32
+
+int
+main(void)
+{
+ return EXIT_AM_SKIP;
+}
+
+#else
+
+# define DOM_UUID "ef861801-45b9-11cb-88e3-afbfe5370493"
static const char *dominfo_fc4 = "\
Id: 2\n\
@@ -71,13 +81,13 @@ cleanup:
return result;
}
-#define VIRSH_DEFAULT "../tools/virsh", \
+# define VIRSH_DEFAULT "../tools/virsh", \
"--connect", \
"test:///default"
static char *custom_uri;
-#define VIRSH_CUSTOM "../tools/virsh", \
+# define VIRSH_CUSTOM "../tools/virsh", \
"--connect", \
custom_uri
@@ -224,10 +234,6 @@ mymain(void)
{
int ret = 0;
-#ifdef WIN32
- exit (EXIT_AM_SKIP);
-#endif
-
if (virAsprintf(&custom_uri,
"test://%s/../examples/xml/test/testnode.xml",
abs_srcdir) < 0)
return EXIT_FAILURE;
@@ -298,7 +304,7 @@ mymain(void)
/* It's a bit awkward listing result before argument, but that's a
* limitation of C99 vararg macros. */
-#define DO_TEST(i, result, ...) \
+# define DO_TEST(i, result, ...) \
do { \
const char *myargv[] = { VIRSH_DEFAULT, __VA_ARGS__, NULL }; \
const struct testInfo info = { myargv, result }; \
@@ -380,10 +386,12 @@ mymain(void)
DO_TEST(30, "--shell a\n",
"echo \t '-'\"-\" \t --shell \t a");
-#undef DO_TEST
+# undef DO_TEST
free(custom_uri);
return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
VIRT_TEST_MAIN(mymain)
+
+#endif /* WIN32 */
--
1.7.4.1