From: Wainer dos Santos Moschetta <wainersm@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>, qemu-devel@nongnu.org
Cc: Laurent Vivier <lvivier@redhat.com>,
Kevin Wolf <kwolf@redhat.com>, Thomas Huth <thuth@redhat.com>,
qemu-block@nongnu.org, "Michael S . Tsirkin" <mst@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>,
Coiby Xu <Coiby.Xu@gmail.com>, Max Reitz <mreitz@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Raphael Norwitz <raphael.norwitz@nutanix.com>
Subject: Re: [PATCH v2 03/12] libqtest: add qtest_kill_qemu()
Date: Mon, 4 Jan 2021 16:28:22 -0300 [thread overview]
Message-ID: <c1a155f7-c8f2-2a71-a4bd-1eef30018ff2@redhat.com> (raw)
In-Reply-To: <20201207172030.251905-4-stefanha@redhat.com>
On 12/7/20 2:20 PM, Stefan Hajnoczi wrote:
> Tests that manage multiple processes may wish to kill QEMU before
> destroying the QTestState. Expose a function to do that.
>
> The vhost-user-blk-test testcase will need this.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> tests/qtest/libqos/libqtest.h | 11 +++++++++++
> tests/qtest/libqtest.c | 7 ++++---
> 2 files changed, 15 insertions(+), 3 deletions(-)
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
>
> diff --git a/tests/qtest/libqos/libqtest.h b/tests/qtest/libqos/libqtest.h
> index e5f1ec590c..51287b9276 100644
> --- a/tests/qtest/libqos/libqtest.h
> +++ b/tests/qtest/libqos/libqtest.h
> @@ -74,6 +74,17 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args);
> */
> QTestState *qtest_init_with_serial(const char *extra_args, int *sock_fd);
>
> +/**
> + * qtest_kill_qemu:
> + * @s: #QTestState instance to operate on.
> + *
> + * Kill the QEMU process and wait for it to terminate. It is safe to call this
> + * function multiple times. Normally qtest_quit() is used instead because it
> + * also frees QTestState. Use qtest_kill_qemu() when you just want to kill QEMU
> + * and qtest_quit() will be called later.
> + */
> +void qtest_kill_qemu(QTestState *s);
> +
> /**
> * qtest_quit:
> * @s: #QTestState instance to operate on.
> diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
> index bc389d422b..cc2cec4a35 100644
> --- a/tests/qtest/libqtest.c
> +++ b/tests/qtest/libqtest.c
> @@ -133,7 +133,7 @@ void qtest_set_expected_status(QTestState *s, int status)
> s->expected_status = status;
> }
>
> -static void kill_qemu(QTestState *s)
> +void qtest_kill_qemu(QTestState *s)
> {
> pid_t pid = s->qemu_pid;
> int wstatus;
> @@ -143,6 +143,7 @@ static void kill_qemu(QTestState *s)
> kill(pid, SIGTERM);
> TFR(pid = waitpid(s->qemu_pid, &s->wstatus, 0));
> assert(pid == s->qemu_pid);
> + s->qemu_pid = -1;
> }
>
> /*
> @@ -169,7 +170,7 @@ static void kill_qemu(QTestState *s)
>
> static void kill_qemu_hook_func(void *s)
> {
> - kill_qemu(s);
> + qtest_kill_qemu(s);
> }
>
> static void sigabrt_handler(int signo)
> @@ -373,7 +374,7 @@ void qtest_quit(QTestState *s)
> /* Uninstall SIGABRT handler on last instance */
> cleanup_sigabrt_handler();
>
> - kill_qemu(s);
> + qtest_kill_qemu(s);
> close(s->fd);
> close(s->qmp_fd);
> g_string_free(s->rx, true);
next prev parent reply other threads:[~2021-01-04 19:30 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-07 17:20 [PATCH v2 00/12] block/export: vhost-user-blk server tests and input validation Stefan Hajnoczi
2020-12-07 17:20 ` [PATCH v2 01/12] vhost-user-blk: fix blkcfg->num_queues endianness Stefan Hajnoczi
2021-01-04 4:01 ` Raphael Norwitz
2021-01-20 9:43 ` Michael S. Tsirkin
2020-12-07 17:20 ` [PATCH v2 02/12] libqtest: add qtest_socket_server() Stefan Hajnoczi
2020-12-18 11:29 ` Thomas Huth
2021-01-04 19:23 ` Wainer dos Santos Moschetta
2020-12-07 17:20 ` [PATCH v2 03/12] libqtest: add qtest_kill_qemu() Stefan Hajnoczi
2021-01-04 19:28 ` Wainer dos Santos Moschetta [this message]
2020-12-07 17:20 ` [PATCH v2 04/12] libqtest: add qtest_remove_abrt_handler() Stefan Hajnoczi
2021-01-04 21:02 ` Wainer dos Santos Moschetta
2020-12-07 17:20 ` [PATCH v2 05/12] test: new qTest case to test the vhost-user-blk-server Stefan Hajnoczi
2020-12-18 14:56 ` Coiby Xu
2021-02-23 14:40 ` Stefan Hajnoczi
2020-12-07 17:20 ` [PATCH v2 06/12] tests/qtest: add multi-queue test case to vhost-user-blk-test Stefan Hajnoczi
2020-12-07 17:20 ` [PATCH v2 07/12] block/export: fix blk_size double byteswap Stefan Hajnoczi
2020-12-07 17:20 ` [PATCH v2 08/12] block/export: use VIRTIO_BLK_SECTOR_BITS Stefan Hajnoczi
2020-12-07 17:20 ` [PATCH v2 09/12] block/export: fix vhost-user-blk export sector number calculation Stefan Hajnoczi
2020-12-07 17:20 ` [PATCH v2 10/12] block/export: port virtio-blk discard/write zeroes input validation Stefan Hajnoczi
2020-12-07 17:20 ` [PATCH v2 11/12] vhost-user-blk-test: test discard/write zeroes invalid inputs Stefan Hajnoczi
2020-12-07 17:20 ` [PATCH v2 12/12] block/export: port virtio-blk read/write range check Stefan Hajnoczi
2021-02-15 10:41 ` [PATCH v2 00/12] block/export: vhost-user-blk server tests and input validation Kevin Wolf
2021-02-19 22:38 ` Peter Maydell
2021-02-23 11:06 ` Philippe Mathieu-Daudé
2021-03-10 15:51 ` Peter Maydell
2021-03-10 16:26 ` Kevin Wolf
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=c1a155f7-c8f2-2a71-a4bd-1eef30018ff2@redhat.com \
--to=wainersm@redhat.com \
--cc=Coiby.Xu@gmail.com \
--cc=kwolf@redhat.com \
--cc=lvivier@redhat.com \
--cc=mreitz@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=raphael.norwitz@nutanix.com \
--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 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).