[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] iotests: fix source directory location
From: |
Daniel P . Berrangé |
Subject: |
Re: [PATCH] iotests: fix source directory location |
Date: |
Thu, 26 May 2022 08:54:26 +0100 |
User-agent: |
Mutt/2.2.1 (2022-02-19) |
On Wed, May 25, 2022 at 08:25:12PM -0400, John Snow wrote:
> If you invoke the check script from outside of the tests/qemu-iotests
> directory, the directories initialized as source_iotests and
> build_iotests will be incorrect.
>
> We can use the location of the source file itself to be more accurate.
>
> Signed-off-by: John Snow <jsnow@redhat.com>
> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> tests/qemu-iotests/testenv.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py
> index a864c74b123..9b0f01e84db 100644
> --- a/tests/qemu-iotests/testenv.py
> +++ b/tests/qemu-iotests/testenv.py
> @@ -217,10 +217,10 @@ def __init__(self, imgfmt: str, imgproto: str, aiomode:
> str,
> self.build_iotests =
> os.path.dirname(os.path.abspath(sys.argv[0]))
> else:
> # called from the source tree
> - self.source_iotests = os.getcwd()
> + self.source_iotests = str(Path(__file__, '..').resolve())
Path(__file__).parent
> self.build_iotests = self.source_iotests
>
> - self.build_root = os.path.join(self.build_iotests, '..', '..')
> + self.build_root = str(Path(self.build_iotests, '../..').resolve())
Path(self.build_iotests).parent.parent
to be portable
>
> self.init_directories()
> self.init_binaries()
> --
> 2.34.1
>
>
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|