]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: Unify style of test skipping code
authorMatthias Bolte <matthias.bolte@googlemail.com>
Thu, 28 Jul 2011 15:48:12 +0000 (17:48 +0200)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Fri, 29 Jul 2011 10:12:58 +0000 (12:12 +0200)
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
tests/nodeinfotest.c
tests/qemuargv2xmltest.c
tests/qemuxml2xmltest.c
tests/virnettlscontexttest.c
tests/virshtest.c

index ef2850d2575515e4ecfb0422a8c13a589362dedc..2e800ae879dba27a8bc37fc8aa8935c967c34337 100644 (file)
 
 #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 */
index 5abee9230f6e448f9d0c285bfbcc8940aed7a23c..448e072a122f811eaf80d929be797a02f3447ef3 100644 (file)
                                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__ */
index bade95dc05d79eb1cc7d4606fa7e072b36b5cedb..c2b6cf2a8b4167bd7761ffc08c6ac8d03f4a5b40 100644 (file)
@@ -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 */
index 44737d441e72e883055997ab28aac31941c68c65..c74f96c7b533a0bc159c6025088dd049f7deac4d 100644 (file)
@@ -206,6 +206,10 @@ VIRT_TEST_MAIN(mymain)
 
 #else
 
-int main (void) { exit (EXIT_AM_SKIP); }
+int
+main(void)
+{
+    return EXIT_AM_SKIP;
+}
 
 #endif /* WITH_QEMU */
index 12ecf1e44ba6347fab8e063a9b5308a8f3f2fc05..520b006a183121bf4c524b3027fd85d79e757d5d 100644 (file)
@@ -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
index e22e5823103fc55b9467af54e8efcd7eb49fda10..de5138c6f8dc29786e26f2dcb65895bba18dd7c2 100644 (file)
@@ -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 */