From: Thomas Huth <thuth@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>, mst@redhat.com
Cc: qemu-devel@nongnu.org, philmd@linaro.org, eblake@redhat.com,
michael.roth@amd.com, armbru@redhat.com, farosas@suse.de,
peterx@redhat.com, berrange@redhat.com, jasowang@redhat.com,
steven.sistare@oracle.com, leiyang@redhat.com,
davydov-max@yandex-team.ru, yc-core@yandex-team.ru
Subject: Re: [PATCH v5 18/19] tests/functional: add skipUnlessPasswordlessSudo() decorator
Date: Fri, 19 Sep 2025 14:00:09 +0200 [thread overview]
Message-ID: <137b1cb6-f264-4690-b17d-f41b367fcf0f@redhat.com> (raw)
In-Reply-To: <20250919095545.1912042-19-vsementsov@yandex-team.ru>
On 19/09/2025 11.55, Vladimir Sementsov-Ogievskiy wrote:
> To be used in the next commit: that would be a test for TAP
> networking, and it will need to setup TAP device.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> tests/functional/qemu_test/decorators.py | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/tests/functional/qemu_test/decorators.py b/tests/functional/qemu_test/decorators.py
> index c0d1567b14..4b332804ef 100644
> --- a/tests/functional/qemu_test/decorators.py
> +++ b/tests/functional/qemu_test/decorators.py
> @@ -6,6 +6,7 @@
> import os
> import platform
> import resource
> +import subprocess
> from unittest import skipIf, skipUnless
>
> from .cmd import which
> @@ -149,3 +150,18 @@ def skipLockedMemoryTest(locked_memory):
> ulimit_memory == resource.RLIM_INFINITY or ulimit_memory >= locked_memory * 1024,
> f'Test required {locked_memory} kB of available locked memory',
> )
> +
> +'''
> +Decorator to skip execution of a test if passwordless
> +sudo command is not available.
> +'''
> +def skipUnlessPasswordlessSudo():
> + proc = subprocess.run(["sudo", "-n", "/bin/true"],
> + stdin=subprocess.PIPE,
> + stdout=subprocess.PIPE,
> + stderr=subprocess.STDOUT,
> + universal_newlines=True,
> + check=False)
> +
> + return skipUnless(proc.returncode == 0,
> + f'requires password-less sudo access: {proc.stdout}')
I'd maybe rather just call it "skipWithoutSudo" ... but anyway:
Reviewed-by: Thomas Huth <thuth@redhat.com>
next prev parent reply other threads:[~2025-09-19 12:01 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-19 9:55 [PATCH v5 00/19] virtio-net: live-TAP local migration Vladimir Sementsov-Ogievskiy
2025-09-19 9:55 ` [PATCH v5 01/19] migration/qemu-file: don't make incoming fds blocking again Vladimir Sementsov-Ogievskiy
2025-09-19 9:55 ` [PATCH v5 02/19] io/channel: document how qio_channel_readv_full() handles fds Vladimir Sementsov-Ogievskiy
2025-09-19 9:55 ` [PATCH v5 03/19] net/tap: net_init_tap_one(): drop extra error propagation Vladimir Sementsov-Ogievskiy
2025-09-19 9:55 ` [PATCH v5 04/19] net/tap: net_init_tap_one(): move parameter checking earlier Vladimir Sementsov-Ogievskiy
2025-09-19 9:55 ` [PATCH v5 05/19] net/tap: rework net_tap_init() Vladimir Sementsov-Ogievskiy
2025-09-19 9:55 ` [PATCH v5 06/19] net/tap: setup exit notifier only when needed Vladimir Sementsov-Ogievskiy
2025-09-19 9:55 ` [PATCH v5 07/19] net/tap: split net_tap_fd_init() Vladimir Sementsov-Ogievskiy
2025-09-19 9:55 ` [PATCH v5 08/19] net/tap: rework tap_set_sndbuf() Vladimir Sementsov-Ogievskiy
2025-09-19 9:55 ` [PATCH v5 09/19] net/tap: rework sndbuf handling Vladimir Sementsov-Ogievskiy
2025-09-19 9:55 ` [PATCH v5 10/19] net/tap: introduce net_tap_setup() Vladimir Sementsov-Ogievskiy
2025-09-19 9:55 ` [PATCH v5 11/19] net/tap: move vhost fd initialization to net_tap_new() Vladimir Sementsov-Ogievskiy
2025-09-19 9:55 ` [PATCH v5 12/19] net/tap: use net_tap_setup() in net_init_bridge() Vladimir Sementsov-Ogievskiy
2025-09-19 9:55 ` [PATCH v5 13/19] net/tap: finalize net_tap_set_fd() logic Vladimir Sementsov-Ogievskiy
2025-09-19 9:55 ` [PATCH v5 14/19] migration: add MIG_EVENT_PRE_INCOMING Vladimir Sementsov-Ogievskiy
2025-09-19 9:55 ` [PATCH v5 15/19] net/tap: postpone tap setup to pre-incoming Vladimir Sementsov-Ogievskiy
2025-09-19 17:19 ` Vladimir Sementsov-Ogievskiy
2025-09-19 9:55 ` [PATCH v5 16/19] qapi: add interface for local TAP migration Vladimir Sementsov-Ogievskiy
2025-09-19 15:20 ` Fabiano Rosas
2025-09-19 15:50 ` Vladimir Sementsov-Ogievskiy
2025-09-19 17:13 ` Fabiano Rosas
2025-09-19 17:35 ` Vladimir Sementsov-Ogievskiy
2025-09-19 9:55 ` [PATCH v5 17/19] virtio-net: support fds migration of TAP backend Vladimir Sementsov-Ogievskiy
2025-09-19 9:55 ` [PATCH v5 18/19] tests/functional: add skipUnlessPasswordlessSudo() decorator Vladimir Sementsov-Ogievskiy
2025-09-19 12:00 ` Thomas Huth [this message]
2025-09-19 9:55 ` [PATCH v5 19/19] tests/functional: add test_x86_64_tap_fd_migration Vladimir Sementsov-Ogievskiy
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=137b1cb6-f264-4690-b17d-f41b367fcf0f@redhat.com \
--to=thuth@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=davydov-max@yandex-team.ru \
--cc=eblake@redhat.com \
--cc=farosas@suse.de \
--cc=jasowang@redhat.com \
--cc=leiyang@redhat.com \
--cc=michael.roth@amd.com \
--cc=mst@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=steven.sistare@oracle.com \
--cc=vsementsov@yandex-team.ru \
--cc=yc-core@yandex-team.ru \
/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).