From: Liam Merwick <liam.merwick@oracle.com>
To: Wainer dos Santos Moschetta <wainersm@redhat.com>,
Stefano Garzarella <sgarzare@redhat.com>
Cc: fam@euphon.net, slp@redhat.com, alex.bennee@linaro.org,
qemu-devel@nongnu.org, pbonzini@redhat.com, philmd@redhat.com
Subject: Re: [PATCH 5/6] tests/boot_linux_console: add extract_from_rpm method
Date: Fri, 31 Jan 2020 15:02:29 +0000 [thread overview]
Message-ID: <027bfff2-ff27-3fc6-05e6-aa5940e7fc04@oracle.com> (raw)
In-Reply-To: <d6bed079-9e79-5e64-f7e2-76499f24454c@redhat.com>
On 30/01/2020 19:19, Wainer dos Santos Moschetta wrote:
>
> On 1/30/20 1:34 PM, Liam Merwick wrote:
>> On 30/01/2020 12:05, Stefano Garzarella wrote:
>>> On Mon, Jan 27, 2020 at 04:36:33PM +0000, Liam Merwick wrote:
>>>> Add a method to extract a specified file from an RPM to the test's
>>>> working directory and return the path to the extracted file.
>>>>
>>>> Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
>>>> ---
>>>> tests/acceptance/boot_linux_console.py | 14 ++++++++++++++
>>>> 1 file changed, 14 insertions(+)
>>>>
>>>> diff --git a/tests/acceptance/boot_linux_console.py
>>>> b/tests/acceptance/boot_linux_console.py
>>>> index 43bc928b03a2..6af19ae3b14a 100644
>>>> --- a/tests/acceptance/boot_linux_console.py
>>>> +++ b/tests/acceptance/boot_linux_console.py
>>>> @@ -51,6 +51,20 @@ class BootLinuxConsole(Test):
>>>> os.chdir(cwd)
>>>> return self.workdir + path
>>>> + def extract_from_rpm(self, rpm, path):
>>>> + """
>>>> + Extracts a file from a rpm package into the test workdir
>>>> +
>>>> + :param rpm: path to the rpm archive
>>>> + :param path: path within the rpm archive of the file to be
>>>> extracted
>
>
> Might not be obvious to users that `path` should start with '.', and if
> he/she doesn't do that then extract_from_rpm() will silently fail to
> extract the file. So could you document that?
Sure.
>
>>>>
>>>> + :returns: path of the extracted file
>>>> + """
>>>> + cwd = os.getcwd()
>>>> + os.chdir(self.workdir)
>>>> + process.run("rpm2cpio %s | cpio -id %s" % (rpm, path),
>>>> shell=True)
>>>> + os.chdir(cwd)
>>>> + return self.workdir + '/' + path
>>> ^
>>> Is the extra slash needed? (just because the extract_from_deb()
>>> doesn't put it)
>>>
>>
>>
>> Yes, I needed to put it in there because the 'path' passed in for
>> processing by cpio is a relative patch unlike the deb arg so it
>> couldn't be just appended to 'self.workdir' which doesn't end in a '/'.
>
>
> It is a good practice use the `os.path` module methods when dealing with
> filesystem paths. So that can be replaced with:
>
> >>> os.path.normpath(os.path.join('/path/to/workdir', './file/in/rpm'))
> '/path/to/workdir/file/in/rpm'
>
Will do. I'll add a patch to fix extract_from_deb() too.
Regards,
Liam
> Thanks,
>
> Wainer
>
>
>>
>>
>> Regards,
>> Liam
>>
>>
>>> Anyway this patch LGTM:
>>>
>>> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
>>>
>>>> +
>>>> def do_test_x86_64_machine(self):
>>>> """
>>>> :avocado: tags=arch:x86_64
>>>> --
>>>> 1.8.3.1
>>>>
>>>
>>
>
next prev parent reply other threads:[~2020-01-31 15:03 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-27 16:36 [PATCH 0/6] tests/boot_linux_console: add extra boot acceptance tests Liam Merwick
2020-01-27 16:36 ` [PATCH 1/6] tests/boot_linux_console: add microvm acceptance test Liam Merwick
2020-01-30 11:49 ` Stefano Garzarella
2020-01-30 17:41 ` Wainer dos Santos Moschetta
2020-01-30 23:51 ` Philippe Mathieu-Daudé
2020-01-31 18:10 ` Wainer dos Santos Moschetta
2020-01-27 16:36 ` [PATCH 2/6] tests/boot_linux_console: add BIOS " Liam Merwick
2020-01-30 11:27 ` Stefano Garzarella
2020-01-30 15:34 ` Liam Merwick
2020-01-30 16:28 ` Liam Merwick
2020-01-30 16:45 ` Stefano Garzarella
2020-01-27 16:36 ` [PATCH 3/6] tests/boot_linux_console: fix extract_from_deb() comment Liam Merwick
2020-01-30 11:29 ` Stefano Garzarella
2020-01-30 18:17 ` Wainer dos Santos Moschetta
2020-01-31 0:03 ` Philippe Mathieu-Daudé
2020-01-27 16:36 ` [PATCH 4/6] travis.yml: install rpm2cpio for acceptance tests Liam Merwick
2020-01-30 12:00 ` Stefano Garzarella
2020-01-27 16:36 ` [PATCH 5/6] tests/boot_linux_console: add extract_from_rpm method Liam Merwick
2020-01-30 12:05 ` Stefano Garzarella
2020-01-30 15:34 ` Liam Merwick
2020-01-30 19:19 ` Wainer dos Santos Moschetta
2020-01-30 23:59 ` Philippe Mathieu-Daudé
2020-01-31 15:02 ` Liam Merwick [this message]
2020-02-04 13:31 ` Liam Merwick
2020-02-04 14:22 ` Philippe Mathieu-Daudé
2020-01-27 16:36 ` [PATCH 6/6] tests/boot_linux_console: add PVH acceptance tests Liam Merwick
2020-01-30 12:08 ` Stefano Garzarella
2020-01-30 23:57 ` Philippe Mathieu-Daudé
2020-01-31 15:03 ` Liam Merwick
2020-01-31 15:18 ` Philippe Mathieu-Daudé
2020-01-30 17:57 ` [PATCH 0/6] tests/boot_linux_console: add extra boot " Wainer dos Santos Moschetta
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=027bfff2-ff27-3fc6-05e6-aa5940e7fc04@oracle.com \
--to=liam.merwick@oracle.com \
--cc=alex.bennee@linaro.org \
--cc=fam@euphon.net \
--cc=pbonzini@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.com \
--cc=slp@redhat.com \
--cc=wainersm@redhat.com \
/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).