提交 cffba7ea 编写于 作者: M Matthias Bolte

tests: Unify style of test skipping code

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.
上级 f0a5eaf3
...@@ -38,10 +38,10 @@ ...@@ -38,10 +38,10 @@
#ifdef WIN32 #ifdef WIN32
static int int
mymain(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) main(void)
{ {
exit (EXIT_AM_SKIP); return EXIT_AM_SKIP;
} }
#else #else
...@@ -814,6 +814,6 @@ mymain(void) ...@@ -814,6 +814,6 @@ mymain(void)
return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE); return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
} }
#endif /* !WIN32 */
VIRT_TEST_MAIN(mymain) VIRT_TEST_MAIN(mymain)
#endif /* !WIN32 */
...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
defined(__amd64__) || \ defined(__amd64__) || \
defined(__i386__))) defined(__i386__)))
static int int
mymain(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) main(void)
{ {
exit (EXIT_AM_SKIP); return EXIT_AM_SKIP;
} }
#else #else
...@@ -130,6 +130,6 @@ mymain(void) ...@@ -130,6 +130,6 @@ mymain(void)
return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE); return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
} }
#endif /* __linux__ */
VIRT_TEST_MAIN(mymain) VIRT_TEST_MAIN(mymain)
#endif /* __linux__ */
...@@ -239,6 +239,10 @@ VIRT_TEST_MAIN(mymain) ...@@ -239,6 +239,10 @@ VIRT_TEST_MAIN(mymain)
#else #else
int main (void) { return (EXIT_AM_SKIP); } int
main(void)
{
return EXIT_AM_SKIP;
}
#endif /* WITH_QEMU */ #endif /* WITH_QEMU */
...@@ -206,6 +206,10 @@ VIRT_TEST_MAIN(mymain) ...@@ -206,6 +206,10 @@ VIRT_TEST_MAIN(mymain)
#else #else
int main (void) { exit (EXIT_AM_SKIP); } int
main(void)
{
return EXIT_AM_SKIP;
}
#endif /* WITH_QEMU */ #endif /* WITH_QEMU */
...@@ -1249,9 +1249,11 @@ mymain(void) ...@@ -1249,9 +1249,11 @@ mymain(void)
VIRT_TEST_MAIN(mymain) VIRT_TEST_MAIN(mymain)
#else #else
int int
main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) main(void)
{ {
exit (EXIT_AM_SKIP); return EXIT_AM_SKIP;
} }
#endif #endif
...@@ -9,7 +9,17 @@ ...@@ -9,7 +9,17 @@
#include "util.h" #include "util.h"
#include "testutils.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 = "\ static const char *dominfo_fc4 = "\
Id: 2\n\ Id: 2\n\
...@@ -71,13 +81,13 @@ cleanup: ...@@ -71,13 +81,13 @@ cleanup:
return result; return result;
} }
#define VIRSH_DEFAULT "../tools/virsh", \ # define VIRSH_DEFAULT "../tools/virsh", \
"--connect", \ "--connect", \
"test:///default" "test:///default"
static char *custom_uri; static char *custom_uri;
#define VIRSH_CUSTOM "../tools/virsh", \ # define VIRSH_CUSTOM "../tools/virsh", \
"--connect", \ "--connect", \
custom_uri custom_uri
...@@ -224,10 +234,6 @@ mymain(void) ...@@ -224,10 +234,6 @@ mymain(void)
{ {
int ret = 0; int ret = 0;
#ifdef WIN32
exit (EXIT_AM_SKIP);
#endif
if (virAsprintf(&custom_uri, "test://%s/../examples/xml/test/testnode.xml", if (virAsprintf(&custom_uri, "test://%s/../examples/xml/test/testnode.xml",
abs_srcdir) < 0) abs_srcdir) < 0)
return EXIT_FAILURE; return EXIT_FAILURE;
...@@ -298,7 +304,7 @@ mymain(void) ...@@ -298,7 +304,7 @@ mymain(void)
/* It's a bit awkward listing result before argument, but that's a /* It's a bit awkward listing result before argument, but that's a
* limitation of C99 vararg macros. */ * limitation of C99 vararg macros. */
#define DO_TEST(i, result, ...) \ # define DO_TEST(i, result, ...) \
do { \ do { \
const char *myargv[] = { VIRSH_DEFAULT, __VA_ARGS__, NULL }; \ const char *myargv[] = { VIRSH_DEFAULT, __VA_ARGS__, NULL }; \
const struct testInfo info = { myargv, result }; \ const struct testInfo info = { myargv, result }; \
...@@ -380,10 +386,12 @@ mymain(void) ...@@ -380,10 +386,12 @@ mymain(void)
DO_TEST(30, "--shell a\n", DO_TEST(30, "--shell a\n",
"echo \t '-'\"-\" \t --shell \t a"); "echo \t '-'\"-\" \t --shell \t a");
#undef DO_TEST # undef DO_TEST
free(custom_uri); free(custom_uri);
return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE); return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
} }
VIRT_TEST_MAIN(mymain) VIRT_TEST_MAIN(mymain)
#endif /* WIN32 */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册