All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Julia Suvorova <jusual@mail.ru>
Cc: qemu-devel@nongnu.org, "Peter Maydell" <peter.maydell@linaro.org>,
	"Thomas Huth" <thuth@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Joel Stanley" <joel@jms.id.au>,
	"Jim Mussared" <jim@groklearning.com>,
	"Steffen Görtz" <contrib@steffen-goertz.de>
Subject: Re: [Qemu-devel] [PATCH v5 1/3] tests/libqtest: Introduce qtest_init_with_serial()
Date: Wed, 23 Jan 2019 14:20:58 +0000	[thread overview]
Message-ID: <87zhrrzc8l.fsf@linaro.org> (raw)
In-Reply-To: <20190123120759.7162-2-jusual@mail.ru>


Julia Suvorova <jusual@mail.ru> writes:

> Run qtest with a socket that connects QEMU chardev and test code.
>
> Signed-off-by: Julia Suvorova <jusual@mail.ru>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

> ---
>  tests/libqtest.c | 25 +++++++++++++++++++++++++
>  tests/libqtest.h | 11 +++++++++++
>  2 files changed, 36 insertions(+)
>
> diff --git a/tests/libqtest.c b/tests/libqtest.c
> index 55750dd68d..6fb30855fa 100644
> --- a/tests/libqtest.c
> +++ b/tests/libqtest.c
> @@ -315,6 +315,31 @@ QTestState *qtest_initf(const char *fmt, ...)
>      return s;
>  }
>
> +QTestState *qtest_init_with_serial(const char *extra_args, int *sock_fd)
> +{
> +    int sock_fd_init;
> +    char *sock_path, sock_dir[] = "/tmp/qtest-serial-XXXXXX";
> +    QTestState *qts;
> +
> +    g_assert_true(mkdtemp(sock_dir) != NULL);
> +    sock_path = g_strdup_printf("%s/sock", sock_dir);
> +
> +    sock_fd_init = init_socket(sock_path);
> +
> +    qts = qtest_initf("-chardev socket,id=s0,path=%s -serial chardev:s0 %s",
> +                      sock_path, extra_args);
> +
> +    *sock_fd = socket_accept(sock_fd_init);
> +
> +    unlink(sock_path);
> +    g_free(sock_path);
> +    rmdir(sock_dir);
> +
> +    g_assert_true(*sock_fd >= 0);
> +
> +    return qts;
> +}
> +
>  void qtest_quit(QTestState *s)
>  {
>      g_hook_destroy_link(&abrt_hooks, g_hook_find_data(&abrt_hooks, TRUE, s));
> diff --git a/tests/libqtest.h b/tests/libqtest.h
> index 7ea94139b0..5937f91912 100644
> --- a/tests/libqtest.h
> +++ b/tests/libqtest.h
> @@ -62,6 +62,17 @@ QTestState *qtest_init(const char *extra_args);
>   */
>  QTestState *qtest_init_without_qmp_handshake(const char *extra_args);
>
> +/**
> + * qtest_init_with_serial:
> + * @extra_args: other arguments to pass to QEMU.  CAUTION: these
> + * arguments are subject to word splitting and shell evaluation.
> + * @sock_fd: pointer to store the socket file descriptor for
> + * connection with serial.
> + *
> + * Returns: #QTestState instance.
> + */
> +QTestState *qtest_init_with_serial(const char *extra_args, int *sock_fd);
> +
>  /**
>   * qtest_quit:
>   * @s: #QTestState instance to operate on.


--
Alex Bennée

  parent reply	other threads:[~2019-01-23 14:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-23 12:07 [Qemu-devel] [PATCH v5 0/3] tests/microbit-test: Add UART device test Julia Suvorova
2019-01-23 12:07 ` [Qemu-devel] [PATCH v5 1/3] tests/libqtest: Introduce qtest_init_with_serial() Julia Suvorova
2019-01-23 13:06   ` Thomas Huth
2019-01-23 14:20   ` Alex Bennée [this message]
2019-01-23 14:44     ` Eric Blake
2019-01-23 14:56       ` Daniel P. Berrangé
2019-01-23 12:07 ` [Qemu-devel] [PATCH v5 2/3] tests/microbit-test: Make test independent of global_qtest Julia Suvorova
2019-01-23 12:07 ` [Qemu-devel] [PATCH v5 3/3] tests/microbit-test: Check nRF51 UART functionality Julia Suvorova
2019-01-23 13:09   ` Thomas Huth
2019-01-23 17:49   ` Stefan Hajnoczi
2019-01-24 13:44 ` [Qemu-devel] [PATCH v5 0/3] tests/microbit-test: Add UART device test Peter Maydell

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=87zhrrzc8l.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=contrib@steffen-goertz.de \
    --cc=jim@groklearning.com \
    --cc=joel@jms.id.au \
    --cc=jusual@mail.ru \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=thuth@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.