From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: lvivier@redhat.com,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
jasowang@redhat.com, mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH 09/10] vhost-user-test: small changes to init_hugepagefs
Date: Thu, 15 Nov 2018 15:55:41 +0100 [thread overview]
Message-ID: <cc305bf4-fe14-89c0-79f3-a2051086e5f0@redhat.com> (raw)
In-Reply-To: <20181115143124.19234-10-pbonzini@redhat.com>
Hi Paolo,
On 15/11/18 15:31, Paolo Bonzini wrote:
> After the conversion to qgraph, the equivalent of "main" will be in
> a constructor and will run even if the tests are not being requested.
> Therefore, it should not assert that init_hugepagefs succeeds and will
> be called when creating the TestServer. This patch changes the prototype
> of init_hugepagefs, this way the next patch looks nicer.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> tests/vhost-user-test.c | 19 ++++++++++---------
> 1 file changed, 10 insertions(+), 9 deletions(-)
>
> diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
> index 93d5157b13..a282fc57c8 100644
> --- a/tests/vhost-user-test.c
> +++ b/tests/vhost-user-test.c
> @@ -461,13 +461,19 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
> g_mutex_unlock(&s->data_mutex);
> }
>
> -static const char *init_hugepagefs(const char *path)
> +static const char *init_hugepagefs(void)
> {
> + const char *path = getenv("QTEST_HUGETLBFS_PATH");
> struct statfs fs;
> int ret;
>
> + if (!path) {
> + return NULL;
> + }
> +
> if (access(path, R_OK | W_OK | X_OK)) {
> g_test_message("access on path (%s): %s\n", path, strerror(errno));
> + abort();
> return NULL;
Can we remove the 'return NULL's now?
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> }
>
> @@ -477,11 +483,13 @@ static const char *init_hugepagefs(const char *path)
>
> if (ret != 0) {
> g_test_message("statfs on path (%s): %s\n", path, strerror(errno));
> + abort();
> return NULL;
> }
>
> if (fs.f_type != HUGETLBFS_MAGIC) {
> g_test_message("Warning: path not on HugeTLBFS: %s\n", path);
> + abort();
> return NULL;
> }
>
> @@ -974,7 +982,6 @@ static void test_multiqueue(void)
>
> int main(int argc, char **argv)
> {
> - const char *hugefs;
> int ret;
> char template[] = "/tmp/vhost-test-XXXXXX";
>
> @@ -989,13 +996,7 @@ int main(int argc, char **argv)
> }
> g_assert(tmpfs);
>
> - hugefs = getenv("QTEST_HUGETLBFS_PATH");
> - if (hugefs) {
> - root = init_hugepagefs(hugefs);
> - g_assert(root);
> - } else {
> - root = tmpfs;
> - }
> + root = init_hugepagefs() ? : tmpfs;
>
> if (qemu_memfd_check(0)) {
> qtest_add_data_func("/vhost-user/read-guest-mem/memfd",
>
next prev parent reply other threads:[~2018-11-15 14:55 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-15 14:31 [Qemu-devel] [PATCH for-3.2 00/10] vhost: preparation for qgraph conversion of vhost-user-test Paolo Bonzini
2018-11-15 14:31 ` [Qemu-devel] [PATCH 01/10] vhost-user-test: use g_cond_broadcast Paolo Bonzini
2018-11-20 8:50 ` Marc-André Lureau
2018-11-15 14:31 ` [Qemu-devel] [PATCH 02/10] vhost-user-test: signal data_cond when s->rings changes Paolo Bonzini
2018-11-20 8:50 ` Marc-André Lureau
2018-11-15 14:31 ` [Qemu-devel] [PATCH 03/10] vhost-net: compile it for all targets Paolo Bonzini
2018-11-15 18:42 ` Paolo Bonzini
2018-11-20 8:50 ` Marc-André Lureau
2019-01-15 3:50 ` Michael S. Tsirkin
2019-01-15 7:18 ` Paolo Bonzini
2018-11-15 14:31 ` [Qemu-devel] [PATCH 04/10] vhost-user: support cross-endian vnet headers Paolo Bonzini
2018-11-20 8:50 ` Marc-André Lureau
2018-11-15 14:31 ` [Qemu-devel] [PATCH 05/10] vhost-user-test: support VHOST_USER_PROTOCOL_F_CROSS_ENDIAN Paolo Bonzini
2018-11-20 8:50 ` Marc-André Lureau
2018-11-15 14:31 ` [Qemu-devel] [PATCH 06/10] vhost-user-test: skip if there is no memory at address 0 Paolo Bonzini
2018-11-15 14:31 ` [Qemu-devel] [PATCH 07/10] vhost-user-test: reduce usage of global_qtest Paolo Bonzini
2018-11-20 8:50 ` Marc-André Lureau
2018-11-15 14:31 ` [Qemu-devel] [PATCH 08/10] vhost-user-test: create a main loop per TestServer Paolo Bonzini
2018-11-20 8:50 ` Marc-André Lureau
2018-11-15 14:31 ` [Qemu-devel] [PATCH 09/10] vhost-user-test: small changes to init_hugepagefs Paolo Bonzini
2018-11-15 14:55 ` Philippe Mathieu-Daudé [this message]
2018-11-15 18:41 ` Paolo Bonzini
2018-11-15 18:45 ` Philippe Mathieu-Daudé
2018-11-15 18:46 ` Paolo Bonzini
2018-11-15 14:31 ` [Qemu-devel] [PATCH 10/10] vhost-user-test: create a temporary directory per TestServer Paolo Bonzini
2018-11-20 8:50 ` Marc-André Lureau
2018-11-16 0:43 ` [Qemu-devel] [PATCH for-3.2 00/10] vhost: preparation for qgraph conversion of vhost-user-test no-reply
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=cc305bf4-fe14-89c0-79f3-a2051086e5f0@redhat.com \
--to=philmd@redhat.com \
--cc=jasowang@redhat.com \
--cc=lvivier@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mst@redhat.com \
--cc=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).