mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
tests: Return EXIT_FAILURE/EXIT_SUCCESS instead of -1/0
When using VIR_TEST_MAIN() or VIR_TEST_MAIN_PRELOAD() macros, the retval of mymain() will become retval of main(). Hence, mymain() should use EXIT_FAILURE and EXIT_SUCCESS return values for greater portability. Another reason is that otherwise our summary printing of failed tests doesn't work (see following commit for more info). Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
351742e859
commit
5d99b157bc
@ -374,7 +374,7 @@ mymain(void)
|
||||
ret = -1;
|
||||
|
||||
VIR_FREE(fchost_prefix);
|
||||
return ret;
|
||||
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
||||
VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virrandom"))
|
||||
|
@ -261,7 +261,7 @@ mymain(void)
|
||||
#endif
|
||||
virObjectUnref(dac);
|
||||
virObjectUnref(stack);
|
||||
return ret;
|
||||
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
||||
VIR_TEST_MAIN_PRELOAD(mymain,
|
||||
|
@ -282,7 +282,7 @@ mymain(void)
|
||||
VIR_FREE(fakerootdir);
|
||||
VIR_FREE(fakesysfsdir);
|
||||
VIR_FREE(scsihost_class_path);
|
||||
return ret;
|
||||
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
||||
VIR_TEST_MAIN(mymain)
|
||||
|
@ -33,7 +33,7 @@ mymain(void)
|
||||
|
||||
virObjectUnref(mgr);
|
||||
|
||||
return 0;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
VIR_TEST_MAIN(mymain)
|
||||
|
@ -101,7 +101,7 @@ mymain(void)
|
||||
DO_TEST("full", fullCaps);
|
||||
DO_TEST("fs", fsCaps);
|
||||
|
||||
return ret;
|
||||
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
||||
VIR_TEST_MAIN(mymain)
|
||||
|
@ -784,7 +784,7 @@ mymain(void)
|
||||
if (virTestRun("test16", test16, NULL) < 0)
|
||||
ret = -1;
|
||||
|
||||
return ret;
|
||||
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
||||
VIR_TEST_MAIN(mymain)
|
||||
|
@ -113,7 +113,7 @@ mymain(void)
|
||||
DO_TEST_FULL("resctrl-skx-twocaches", VIR_ARCH_X86_64, true, true);
|
||||
DO_TEST_FULL("resctrl-fake-feature", VIR_ARCH_X86_64, true, true);
|
||||
|
||||
return ret;
|
||||
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
||||
VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virnuma"))
|
||||
|
@ -249,7 +249,7 @@ mymain(void)
|
||||
ret = -1;
|
||||
#endif /* WITH_LXC */
|
||||
|
||||
return ret;
|
||||
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
||||
VIR_TEST_MAIN(mymain)
|
||||
|
@ -465,7 +465,7 @@ mymain(void)
|
||||
if (virTestRun("string-list", testConfParseStringList, NULL) < 0)
|
||||
ret = -1;
|
||||
|
||||
return ret;
|
||||
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -108,7 +108,7 @@ mymain(void)
|
||||
if (virTestRun("test2", test2, NULL) < 0)
|
||||
ret = -1;
|
||||
|
||||
return ret;
|
||||
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
||||
VIR_TEST_MAIN(mymain)
|
||||
|
@ -151,7 +151,7 @@ mymain(void)
|
||||
TEST_PARSE_FILTERS_FAIL(":foo", 1);
|
||||
TEST_PARSE_FILTERS_FAIL("1:+", 1);
|
||||
|
||||
return ret;
|
||||
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
||||
VIR_TEST_MAIN(mymain)
|
||||
|
@ -93,7 +93,7 @@ mymain(void)
|
||||
DO_TEST_UNUSED("resctrl-skx");
|
||||
DO_TEST_UNUSED("resctrl-skx-twocaches");
|
||||
|
||||
return ret;
|
||||
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
||||
VIR_TEST_MAIN(mymain)
|
||||
|
@ -229,7 +229,7 @@ mymain(void)
|
||||
if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
|
||||
virFileDeleteTree(tmpdir);
|
||||
VIR_FREE(virscsi_prefix);
|
||||
return ret;
|
||||
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
||||
VIR_TEST_MAIN(mymain)
|
||||
|
Loading…
Reference in New Issue
Block a user