From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 22/35] test: execute g_test_run when tests are skipped
Date: Fri, 21 Dec 2018 13:36:22 +0100 [thread overview]
Message-ID: <1545395783-39040-2-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1545395783-39040-1-git-send-email-pbonzini@redhat.com>
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>
---
tests/cdrom-test.c | 2 +-
tests/ivshmem-test.c | 5 ++---
tests/migration-test.c | 8 ++++----
tests/test-crypto-pbkdf.c | 3 ++-
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/tests/cdrom-test.c b/tests/cdrom-test.c
index 9b43dc9..14bd981 100644
--- a/tests/cdrom-test.c
+++ b/tests/cdrom-test.c
@@ -169,7 +169,7 @@ int main(int argc, char **argv)
if (exec_genisoimg(genisocheck)) {
/* genisoimage not available - so can't run tests */
- return 0;
+ return g_test_run();
}
ret = prepare_image(arch, isoimage);
diff --git a/tests/ivshmem-test.c b/tests/ivshmem-test.c
index 089e268..fe5eb30 100644
--- a/tests/ivshmem-test.c
+++ b/tests/ivshmem-test.c
@@ -492,7 +492,7 @@ int main(int argc, char **argv)
/* shm */
tmpshm = mktempshm(TMPSHMSIZE, &fd);
if (!tmpshm) {
- return 0;
+ goto out;
}
tmpshmem = mmap(0, TMPSHMSIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
g_assert(tmpshmem != MAP_FAILED);
@@ -514,9 +514,8 @@ int main(int argc, char **argv)
}
}
+out:
ret = g_test_run();
-
cleanup();
-
return ret;
}
diff --git a/tests/migration-test.c b/tests/migration-test.c
index 06ca506..8352612 100644
--- a/tests/migration-test.c
+++ b/tests/migration-test.c
@@ -789,7 +789,7 @@ int main(int argc, char **argv)
g_test_init(&argc, &argv, NULL);
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") &&
access("/sys/module/kvm_hv", F_OK)) {
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 (access("/dev/kvm", R_OK | W_OK)) {
g_test_message("Skipping test: kvm not available");
- return 0;
+ return g_test_run();
}
#else
g_test_message("Skipping test: Need s390x host to work properly");
- return 0;
+ return g_test_run();
#endif
}
diff --git a/tests/test-crypto-pbkdf.c b/tests/test-crypto-pbkdf.c
index d937aff..85ed1f9 100644
--- a/tests/test-crypto-pbkdf.c
+++ b/tests/test-crypto-pbkdf.c
@@ -440,6 +440,7 @@ int main(int argc, char **argv)
#else
int main(int argc, char **argv)
{
- return 0;
+ g_test_init(&argc, &argv, NULL);
+ return g_test_run();
}
#endif
--
1.8.3.1
next prev parent reply other threads:[~2018-12-21 12:36 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-21 12:36 [Qemu-devel] [PULL v4 00/35] Misc patches for 2018-12-21 Paolo Bonzini
2018-12-21 12:36 ` Paolo Bonzini [this message]
2018-12-21 12:36 ` [Qemu-devel] [PULL 23/35] test: replace gtester with a TAP driver Paolo Bonzini
2018-12-21 21:09 ` [Qemu-devel] [PULL v4 00/35] Misc patches for 2018-12-21 Peter Maydell
2018-12-22 8:41 ` Paolo Bonzini
2018-12-22 11:26 ` Peter Maydell
2019-01-03 18:37 ` Peter Maydell
2019-01-04 7:59 ` Paolo Bonzini
2019-01-04 10:06 ` Peter Maydell
2019-01-04 11:01 ` Paolo Bonzini
2019-01-04 11:31 ` Peter Maydell
2019-01-04 12:59 ` Paolo Bonzini
2019-01-04 13:03 ` Peter Maydell
2019-01-04 13:34 ` Paolo Bonzini
2019-01-04 13:45 ` Peter Maydell
-- strict thread matches above, loose matches on Subject: below --
2018-12-20 12:36 [Qemu-devel] [PULL v3 00/35] Misc patches for 2018-12-18 Paolo Bonzini
2018-12-20 12:36 ` [Qemu-devel] [PULL 22/35] test: execute g_test_run when tests are skipped Paolo Bonzini
2018-12-19 15:18 [Qemu-devel] [PULL v2 00/35] Misc patches for 2018-12-18 Paolo Bonzini
2018-12-19 15:19 ` [Qemu-devel] [PULL 22/35] test: execute g_test_run when tests are skipped Paolo Bonzini
2018-12-17 23:16 [Qemu-devel] [PULL 00/35] Misc patches for 2018-12-18 Paolo Bonzini
2018-12-17 23:16 ` [Qemu-devel] [PULL 22/35] test: execute g_test_run when tests are skipped Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1545395783-39040-2-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).