test: execute g_test_run when tests are skipped
Sometimes a test's main() function recognizes that the environment does not support the test, and therefore exits. In this case, we still should run g_test_run() so that a TAP harness will print the test plan ("1..0") and the test will be marked as skipped. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <1543513531-1151-2-git-send-email-pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
4ac8086647
commit
4848cb3d9f
@ -169,7 +169,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if (exec_genisoimg(genisocheck)) {
|
if (exec_genisoimg(genisocheck)) {
|
||||||
/* genisoimage not available - so can't run tests */
|
/* genisoimage not available - so can't run tests */
|
||||||
return 0;
|
return g_test_run();
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = prepare_image(arch, isoimage);
|
ret = prepare_image(arch, isoimage);
|
||||||
|
@ -492,7 +492,7 @@ int main(int argc, char **argv)
|
|||||||
/* shm */
|
/* shm */
|
||||||
tmpshm = mktempshm(TMPSHMSIZE, &fd);
|
tmpshm = mktempshm(TMPSHMSIZE, &fd);
|
||||||
if (!tmpshm) {
|
if (!tmpshm) {
|
||||||
return 0;
|
goto out;
|
||||||
}
|
}
|
||||||
tmpshmem = mmap(0, TMPSHMSIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
|
tmpshmem = mmap(0, TMPSHMSIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
|
||||||
g_assert(tmpshmem != MAP_FAILED);
|
g_assert(tmpshmem != MAP_FAILED);
|
||||||
@ -514,9 +514,8 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
ret = g_test_run();
|
ret = g_test_run();
|
||||||
|
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -789,7 +789,7 @@ int main(int argc, char **argv)
|
|||||||
g_test_init(&argc, &argv, NULL);
|
g_test_init(&argc, &argv, NULL);
|
||||||
|
|
||||||
if (!ufd_version_check()) {
|
if (!ufd_version_check()) {
|
||||||
return 0;
|
return g_test_run();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -800,7 +800,7 @@ int main(int argc, char **argv)
|
|||||||
if (g_str_equal(qtest_get_arch(), "ppc64") &&
|
if (g_str_equal(qtest_get_arch(), "ppc64") &&
|
||||||
access("/sys/module/kvm_hv", F_OK)) {
|
access("/sys/module/kvm_hv", F_OK)) {
|
||||||
g_test_message("Skipping test: kvm_hv not available");
|
g_test_message("Skipping test: kvm_hv not available");
|
||||||
return 0;
|
return g_test_run();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -811,11 +811,11 @@ int main(int argc, char **argv)
|
|||||||
#if defined(HOST_S390X)
|
#if defined(HOST_S390X)
|
||||||
if (access("/dev/kvm", R_OK | W_OK)) {
|
if (access("/dev/kvm", R_OK | W_OK)) {
|
||||||
g_test_message("Skipping test: kvm not available");
|
g_test_message("Skipping test: kvm not available");
|
||||||
return 0;
|
return g_test_run();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
g_test_message("Skipping test: Need s390x host to work properly");
|
g_test_message("Skipping test: Need s390x host to work properly");
|
||||||
return 0;
|
return g_test_run();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,6 +440,7 @@ int main(int argc, char **argv)
|
|||||||
#else
|
#else
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
return 0;
|
g_test_init(&argc, &argv, NULL);
|
||||||
|
return g_test_run();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user