mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
tests: Improve output of tests that decide to skip at runtime
Don't print OK/FAIL for tests that decide to be skipped after calling virtTestMain. Delay printing of the indentation before the first test until we know that the test didn't decide to be skipped. Also make the reconnect test use VIRT_TEST_MAIN.
This commit is contained in:
@@ -11,7 +11,9 @@ static void errorHandler(void *userData ATTRIBUTE_UNUSED,
|
||||
virErrorPtr error ATTRIBUTE_UNUSED) {
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
static int
|
||||
mymain(void)
|
||||
{
|
||||
int id = 0;
|
||||
int ro = 0;
|
||||
virConnectPtr conn;
|
||||
@@ -36,12 +38,12 @@ int main(void) {
|
||||
}
|
||||
if (conn == NULL) {
|
||||
fprintf(stderr, "First virConnectOpen() failed\n");
|
||||
exit(EXIT_FAILURE);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
dom = virDomainLookupByID(conn, id);
|
||||
if (dom == NULL) {
|
||||
fprintf(stderr, "First lookup for domain %d failed\n", id);
|
||||
exit(EXIT_FAILURE);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
virDomainFree(dom);
|
||||
virConnectClose(conn);
|
||||
@@ -51,16 +53,17 @@ int main(void) {
|
||||
conn = virConnectOpen(NULL);
|
||||
if (conn == NULL) {
|
||||
fprintf(stderr, "Second virConnectOpen() failed\n");
|
||||
exit(EXIT_FAILURE);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
dom = virDomainLookupByID(conn, id);
|
||||
if (dom == NULL) {
|
||||
fprintf(stderr, "Second lookup for domain %d failed\n", id);
|
||||
exit(EXIT_FAILURE);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
virDomainFree(dom);
|
||||
virConnectClose(conn);
|
||||
printf("OK\n");
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
VIRT_TEST_MAIN(mymain)
|
||||
|
||||
Reference in New Issue
Block a user