diff options
author | Mariano Lopez <mariano.lopez@linux.intel.com> | 2016-05-24 12:44:15 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-30 15:58:13 +0100 |
commit | d56ccf691b194ce4d753b2bd1a4b12c524d4a887 (patch) | |
tree | 6d751a027de09a594519a1361d4edea736986c06 | |
parent | 92afca71817e6f5d95d2566eee1f2c9f70c45ef9 (diff) | |
download | poky-d56ccf691b194ce4d753b2bd1a4b12c524d4a887.tar.gz |
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>
-rw-r--r-- | meta/lib/oeqa/oetest.py | 22 |
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): | |||
409 | 409 | ||
410 | needed_packages = {} | 410 | needed_packages = {} |
411 | extracted_path = self.d.getVar("TEST_EXTRACTED_DIR", True) | 411 | extracted_path = self.d.getVar("TEST_EXTRACTED_DIR", True) |
412 | packaged_path = self.d.getVar("TEST_PACKAGED_DIR", True) | ||
412 | modules = self.getTestModules() | 413 | modules = self.getTestModules() |
413 | bbpaths = self.d.getVar("BBPATH", True).split(":") | 414 | bbpaths = self.d.getVar("BBPATH", True).split(":") |
414 | 415 | ||
@@ -433,6 +434,8 @@ class RuntimeTestContext(TestContext): | |||
433 | extract = package.get("extract", True) | 434 | extract = package.get("extract", True) |
434 | if extract: | 435 | if extract: |
435 | dst_dir = os.path.join(extracted_path, pkg) | 436 | dst_dir = os.path.join(extracted_path, pkg) |
437 | else: | ||
438 | dst_dir = os.path.join(packaged_path) | ||
436 | 439 | ||
437 | # Extract package and copy it to TEST_EXTRACTED_DIR | 440 | # Extract package and copy it to TEST_EXTRACTED_DIR |
438 | if extract and not os.path.exists(dst_dir): | 441 | if extract and not os.path.exists(dst_dir): |
@@ -440,6 +443,10 @@ class RuntimeTestContext(TestContext): | |||
440 | shutil.copytree(pkg_dir, dst_dir) | 443 | shutil.copytree(pkg_dir, dst_dir) |
441 | shutil.rmtree(pkg_dir) | 444 | shutil.rmtree(pkg_dir) |
442 | 445 | ||
446 | # Copy package to TEST_PACKAGED_DIR | ||
447 | elif not extract: | ||
448 | self._copy_package(pkg) | ||
449 | |||
443 | def _getJsonFile(self, module): | 450 | def _getJsonFile(self, module): |
444 | """ | 451 | """ |
445 | Returns the path of the JSON file for a module, empty if doesn't exitst. | 452 | Returns the path of the JSON file for a module, empty if doesn't exitst. |
@@ -492,6 +499,21 @@ class RuntimeTestContext(TestContext): | |||
492 | 499 | ||
493 | return extract_dir | 500 | return extract_dir |
494 | 501 | ||
502 | def _copy_package(self, pkg): | ||
503 | """ | ||
504 | Copy the RPM, DEB or IPK package to dst_dir | ||
505 | """ | ||
506 | |||
507 | from oeqa.utils.package_manager import get_package_manager | ||
508 | |||
509 | pkg_path = os.path.join(self.d.getVar("TEST_INSTALL_TMP_DIR", True), pkg) | ||
510 | dst_dir = self.d.getVar("TEST_PACKAGED_DIR", True) | ||
511 | pm = get_package_manager(self.d, pkg_path) | ||
512 | pkg_info = pm.package_info(pkg) | ||
513 | file_path = pkg_info[pkg]["filepath"] | ||
514 | shutil.copy2(file_path, dst_dir) | ||
515 | shutil.rmtree(pkg_path) | ||
516 | |||
495 | class ImageTestContext(RuntimeTestContext): | 517 | class ImageTestContext(RuntimeTestContext): |
496 | def __init__(self, d, target, host_dumper): | 518 | def __init__(self, d, target, host_dumper): |
497 | super(ImageTestContext, self).__init__(d, target) | 519 | super(ImageTestContext, self).__init__(d, target) |