qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 05/22] tests/functional: remove duplicated 'which' function i


From: Thomas Huth
Subject: Re: [PATCH 05/22] tests/functional: remove duplicated 'which' function impl
Date: Mon, 2 Dec 2024 13:45:40 +0100
User-agent: Mozilla Thunderbird

On 02/12/2024 12.44, Daniel P. Berrangé wrote:
On Sat, Nov 30, 2024 at 11:16:30AM +0100, Thomas Huth wrote:
On 29/11/2024 18.31, Daniel P. Berrangé wrote:
Put the 'which' function into shared code.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
   tests/functional/qemu_test/__init__.py |  2 +-
   tests/functional/qemu_test/cmd.py      | 10 ++++++++++
   tests/functional/test_acpi_bits.py     | 13 +------------
   tests/functional/test_ppc64_hv.py      | 13 +------------
   4 files changed, 13 insertions(+), 25 deletions(-)

None of the callers really seem to be interested in the location of the
command, only whether it is available in the $PATH or not ... so could we
maybe rather drop this function and use the has_cmd() function everywhere
instead?

Hmm, thinking about it twice - has_cmd() uses the "which" program
internally, but AFAIK this program is optional in Linux installations
nowadays ... so maybe it's still a good idea to move our Python which() to
cmd.py, but has_cmd() should maybe rather be changed to use it, too?

This reminds me I meant to ask about 'has_cmd' - it looks rather
over-engineered to me to be trying to invoke the command with
args.

Perhaps there was some reason to check support for individual
args in the past, but none of the current tests need that AFAICT.

So if anything I'd be looking to delete 'has_cmd' and 'has_cmds'
entirely, and rely only on the pure python 'which'.

Deleting has_cmd is fine for me, too! Especially since this function already caused confusion in the past (see https://gitlab.com/qemu-project/qemu/-/commit/59d100243d23451e66d2274d34edab7be6dab473 ).

 Thomas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]