summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorMariano Lopez <mariano.lopez@linux.intel.com>2016-05-24 12:44:15 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-30 15:58:13 +0100
commitd56ccf691b194ce4d753b2bd1a4b12c524d4a887 (patch)
tree6d751a027de09a594519a1361d4edea736986c06 /meta/lib
parent92afca71817e6f5d95d2566eee1f2c9f70c45ef9 (diff)
downloadopenembedded-core-contrib-d56ccf691b194ce4d753b2bd1a4b12c524d4a887.tar.gz
openembedded-core-contrib-d56ccf691b194ce4d753b2bd1a4b12c524d4a887.tar.bz2
openembedded-core-contrib-d56ccf691b194ce4d753b2bd1a4b12c524d4a887.zip
oetest.py: Add support to copy unextracted packages for runtime testing
Sometimes is needed to have a package without extraction when running a test. This patch adds the functionality. [YOCTO #8536] (From OE-Core rev: 49234fe926224c21ef6c8292132620b4716c5263) Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/oetest.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/meta/lib/oeqa/oetest.py b/meta/lib/oeqa/oetest.py
index 8dd494a064..a50f9d8187 100644
--- a/meta/lib/oeqa/oetest.py
+++ b/meta/lib/oeqa/oetest.py
@@ -409,6 +409,7 @@ class RuntimeTestContext(TestContext):
needed_packages = {}
extracted_path = self.d.getVar("TEST_EXTRACTED_DIR", True)
+ packaged_path = self.d.getVar("TEST_PACKAGED_DIR", True)
modules = self.getTestModules()
bbpaths = self.d.getVar("BBPATH", True).split(":")
@@ -433,6 +434,8 @@ class RuntimeTestContext(TestContext):
extract = package.get("extract", True)
if extract:
dst_dir = os.path.join(extracted_path, pkg)
+ else:
+ dst_dir = os.path.join(packaged_path)
# Extract package and copy it to TEST_EXTRACTED_DIR
if extract and not os.path.exists(dst_dir):
@@ -440,6 +443,10 @@ class RuntimeTestContext(TestContext):
shutil.copytree(pkg_dir, dst_dir)
shutil.rmtree(pkg_dir)
+ # Copy package to TEST_PACKAGED_DIR
+ elif not extract:
+ self._copy_package(pkg)
+
def _getJsonFile(self, module):
"""
Returns the path of the JSON file for a module, empty if doesn't exitst.
@@ -492,6 +499,21 @@ class RuntimeTestContext(TestContext):
return extract_dir
+ def _copy_package(self, pkg):
+ """
+ Copy the RPM, DEB or IPK package to dst_dir
+ """
+
+ from oeqa.utils.package_manager import get_package_manager
+
+ pkg_path = os.path.join(self.d.getVar("TEST_INSTALL_TMP_DIR", True), pkg)
+ dst_dir = self.d.getVar("TEST_PACKAGED_DIR", True)
+ pm = get_package_manager(self.d, pkg_path)
+ pkg_info = pm.package_info(pkg)
+ file_path = pkg_info[pkg]["filepath"]
+ shutil.copy2(file_path, dst_dir)
+ shutil.rmtree(pkg_path)
+
class ImageTestContext(RuntimeTestContext):
def __init__(self, d, target, host_dumper):
super(ImageTestContext, self).__init__(d, target)