All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: John Snow <jsnow@redhat.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	Qemu-block <qemu-block@nongnu.org>,
	"Hanna Reitz" <hreitz@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [PATCH] iotests: fix source directory location
Date: Fri, 27 May 2022 18:29:29 +0200	[thread overview]
Message-ID: <YpD8aeAUxXokKy4n@redhat.com> (raw)
In-Reply-To: <CAFn=p-Y2+3JyTd_nn_HfCz6BbE=G3FYf5E1hZF7sovXBRK7YpQ@mail.gmail.com>

Am 26.05.2022 um 16:21 hat John Snow geschrieben:
> On Thu, May 26, 2022, 3:54 AM Daniel P. Berrangé <berrange@redhat.com>
> wrote:
> 
> > 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
> >
> 
> With windows? I think Path() is meant to be a fully portable class as-is,
> but I'll double-check my assumption. I use ".." elsewhere in code already
> checked in, so if it's a problem I ought to fix it everywhere.

I don't see any potential problem with the second hunk because we're
dealing with the path of a directory there, but "regular_file.py/.."
looks a bit fishy to me and doesn't work if you ask the kernel. Is this
guaranteed to work in Python or is it an implementation detail of Path
that may change?

Kevin



  parent reply	other threads:[~2022-05-27 16:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-26  0:25 [PATCH] iotests: fix source directory location John Snow
2022-05-26  7:54 ` Daniel P. Berrangé
2022-05-26 14:21   ` John Snow
2022-05-26 15:20     ` John Snow
2022-05-26 15:23       ` Daniel P. Berrangé
2022-05-27 16:29     ` Kevin Wolf [this message]
2022-07-11 21:30       ` John Snow

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=YpD8aeAUxXokKy4n@redhat.com \
    --to=kwolf@redhat.com \
    --cc=berrange@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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.