[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 5/6] tests/boot_linux_console: add extract_from_rpm method
From: |
Liam Merwick |
Subject: |
[PATCH 5/6] tests/boot_linux_console: add extract_from_rpm method |
Date: |
Mon, 27 Jan 2020 16:36:33 +0000 |
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 <address@hidden>
---
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
+ :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
+
def do_test_x86_64_machine(self):
"""
:avocado: tags=arch:x86_64
--
1.8.3.1
- [PATCH 1/6] tests/boot_linux_console: add microvm acceptance test, (continued)
[PATCH 6/6] tests/boot_linux_console: add PVH acceptance tests, Liam Merwick, 2020/01/27