From: Roman Bogorodskiy <bogorodskiy@gmail.com>
To: Brad Smith <brad@comstyle.com>
Cc: Michael Roth <michael.roth@amd.com>,
Kostiantyn Kostiuk <kkostiuk@redhat.com>,
qemu-devel@nongnu.org
Subject: Re: [PATCH] tests/unit/test-qga: only run tests for commands the host provides
Date: Sat, 31 Oct 2026 14:03:54 +0100 [thread overview]
Message-ID: <auXnOpeNx5eToSWA@tulp> (raw)
In-Reply-To: <auUjhZW4dqR63oA3@humpty.home.comstyle.com>
Brad Smith wrote:
> tests/unit/test-qga: only run tests for commands the host provides
>
> guest-fsfreeze-status is only implemented when CONFIG_FSFREEZE is
> set (Linux and FreeBSD), and guest-get-users is only built on POSIX
> hosts when HAVE_UTMPX is set, so neither command exists on hosts such
> as OpenBSD. Only build and register these tests where the commands
> are available.
Does that also need something like:
--- a/tests/unit/meson.build
+++ b/tests/unit/meson.build
@@ -170,7 +170,7 @@ if have_system
tests += {'test-qdev': [qom, hwcore]}
endif
-if have_ga and host_os in ['freebsd', 'linux']
+if have_ga and host_os in ['freebsd', 'linux', 'openbsd']
tests += {'test-qga': ['../qtest/libqmp.c', '../qtest/libqtest.c']}
test_deps += {'test-qga': qga}
endif
Otherwise it's not clear how to spot these issues if the test never runs
on OpenBSD.
> Signed-off-by: Brad Smith <brad@comstyle.com>
> ---
> tests/unit/test-qga.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/tests/unit/test-qga.c b/tests/unit/test-qga.c
> index b1c84c188b..ef796f2f7d 100644
> --- a/tests/unit/test-qga.c
> +++ b/tests/unit/test-qga.c
> @@ -787,6 +787,7 @@ static void test_qga_config(gconstpointer data)
> g_free(env[0]);
> }
>
> +#ifdef CONFIG_FSFREEZE
> static void test_qga_fsfreeze_status(gconstpointer fix)
> {
> const TestFixture *fixture = fix;
> @@ -800,6 +801,7 @@ static void test_qga_fsfreeze_status(gconstpointer fix)
> status = qdict_get_try_str(ret, "return");
> g_assert_cmpstr(status, ==, "thawed");
> }
> +#endif
>
> static QDict *wait_for_guest_exec_completion(int fd, int64_t pid)
> {
> @@ -1028,6 +1030,7 @@ static void test_qga_guest_get_timezone(gconstpointer fix)
> g_assert(qdict_haskey(val, "offset"));
> }
>
> +#ifdef HAVE_UTMPX
> static void test_qga_guest_get_users(gconstpointer fix)
> {
> const TestFixture *fixture = fix;
> @@ -1042,6 +1045,7 @@ static void test_qga_guest_get_users(gconstpointer fix)
> val = qdict_get_qlist(ret, "return");
> g_assert_nonnull(val);
> }
> +#endif
>
> static void test_qga_guest_get_osinfo(gconstpointer data)
> {
> @@ -1133,8 +1137,10 @@ int main(int argc, char **argv)
> g_test_add_data_func("/qga/invalid-oob", &fix, test_qga_invalid_oob);
> g_test_add_data_func("/qga/invalid-cmd", &fix, test_qga_invalid_cmd);
> g_test_add_data_func("/qga/invalid-args", &fix, test_qga_invalid_args);
> +#ifdef CONFIG_FSFREEZE
> g_test_add_data_func("/qga/fsfreeze-status", &fix,
> test_qga_fsfreeze_status);
> +#endif
>
> g_test_add_data_func("/qga/blockedrpcs", NULL, test_qga_blockedrpcs);
> g_test_add_data_func("/qga/allowedrpcs", NULL, test_qga_allowedrpcs);
> @@ -1152,8 +1158,10 @@ int main(int argc, char **argv)
> test_qga_guest_get_host_name);
> g_test_add_data_func("/qga/guest-get-timezone", &fix,
> test_qga_guest_get_timezone);
> +#ifdef HAVE_UTMPX
> g_test_add_data_func("/qga/guest-get-users", &fix,
> test_qga_guest_get_users);
> +#endif
>
> ret = g_test_run();
>
> --
> 2.56.0
>
>
next prev parent reply other threads:[~2026-10-31 13:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 23:08 [PATCH] tests/unit/test-qga: only run tests for commands the host provides Brad Smith
2026-10-31 13:03 ` Roman Bogorodskiy [this message]
2026-10-31 21:20 ` Brad Smith
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=auXnOpeNx5eToSWA@tulp \
--to=bogorodskiy@gmail.com \
--cc=brad@comstyle.com \
--cc=kkostiuk@redhat.com \
--cc=michael.roth@amd.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 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.