From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Laurent Vivier" <lvivier@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [PULL 5/9] qtest: kill orphaned qtest QEMU processes on FreeBSD
Date: Fri, 15 Sep 2023 16:08:45 +0100 [thread overview]
Message-ID: <20230915150849.595896-6-alex.bennee@linaro.org> (raw)
In-Reply-To: <20230915150849.595896-1-alex.bennee@linaro.org>
From: Daniel P. Berrangé <berrange@redhat.com>
On Linux we use PR_SET_PDEATHSIG to kill orphaned QEMU processes
if we fail to call qtest_quit(), or the test program aborts/segvs.
This prevents meson from hanging forever due to the orphaned
process keeping stdout open.
On FreeBSD we can achieve the same using PROC_PDEATHSIG_CTL, which
gives us the equivalent protection against hangs.
Signed-off-by: "Daniel P. Berrangé" <berrange@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20230912184130.3056054-3-berrange@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20230914155422.426639-6-alex.bennee@linaro.org>
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 34b9c14b75..b1eba71ffe 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -24,6 +24,9 @@
#ifdef __linux__
#include <sys/prctl.h>
#endif /* __linux__ */
+#ifdef __FreeBSD__
+#include <sys/procctl.h>
+#endif /* __FreeBSD__ */
#include "libqtest.h"
#include "libqmp.h"
@@ -414,6 +417,10 @@ static QTestState *G_GNUC_PRINTF(1, 2) qtest_spawn_qemu(const char *fmt, ...)
*/
prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
#endif /* __linux__ */
+#ifdef __FreeBSD__
+ int sig = SIGKILL;
+ procctl(P_PID, getpid(), PROC_PDEATHSIG_CTL, &sig);
+#endif /* __FreeBSD__ */
if (!g_setenv("QEMU_AUDIO_DRV", "none", true)) {
exit(1);
}
--
2.39.2
next prev parent reply other threads:[~2023-09-15 15:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-15 15:08 [PULL 0/9] testing updates (back to green!) Alex Bennée
2023-09-15 15:08 ` [PULL 1/9] tests: update Debian images to Bookworm Alex Bennée
2023-09-15 15:08 ` [PULL 2/9] gitlab: fix typo/spelling in comments Alex Bennée
2023-09-15 15:08 ` [PULL 3/9] tests/docker: Update docker-loongarch-cross toolchain Alex Bennée
2023-09-15 15:08 ` [PULL 4/9] microbit: add missing qtest_quit() call Alex Bennée
2023-09-15 15:08 ` Alex Bennée [this message]
2023-09-15 15:08 ` [PULL 6/9] gitlab: make Cirrus CI timeout explicit Alex Bennée
2023-09-15 15:08 ` [PULL 7/9] gitlab: make Cirrus CI jobs gating Alex Bennée
2023-09-15 15:08 ` [PULL 8/9] tests/avocado: Fix console data loss Alex Bennée
2023-09-15 15:08 ` [PULL 9/9] tests/avocado: Disable MIPS Malta tests due to GitLab issue #1884 Alex Bennée
2023-09-18 13:47 ` [PULL 0/9] testing updates (back to green!) Stefan Hajnoczi
2023-09-18 15:23 ` Alex Bennée
2023-09-19 6:37 ` Alex Bennée
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=20230915150849.595896-6-alex.bennee@linaro.org \
--to=alex.bennee@linaro.org \
--cc=berrange@redhat.com \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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 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).