mirror of
https://git.yoctoproject.org/poky
synced 2026-09-15 15:49:32 +02:00
oeqa/oetest.py: Allow to export packages using symlinks
Currently packages that contains symlinks can't be extracted and exported. This allows to export extracted such packages. A nice side effect is improved readability. [YOCTO #9932] (From OE-Core rev: 0338f66c0d246c3b8d94ac68d60fbc4c314e500b) 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>
This commit is contained in:
committed by
Richard Purdie
parent
65a03c3f94
commit
65459f5b6d
@@ -47,6 +47,7 @@ def exportTests(d,tc):
|
|||||||
import shutil
|
import shutil
|
||||||
import pkgutil
|
import pkgutil
|
||||||
import re
|
import re
|
||||||
|
import oe.path
|
||||||
|
|
||||||
exportpath = d.getVar("TEST_EXPORT_DIR", True)
|
exportpath = d.getVar("TEST_EXPORT_DIR", True)
|
||||||
|
|
||||||
@@ -103,7 +104,7 @@ def exportTests(d,tc):
|
|||||||
isfolder = True
|
isfolder = True
|
||||||
target_folder = os.path.join(exportpath, "oeqa", "runtime", os.path.basename(foldername))
|
target_folder = os.path.join(exportpath, "oeqa", "runtime", os.path.basename(foldername))
|
||||||
if not os.path.exists(target_folder):
|
if not os.path.exists(target_folder):
|
||||||
shutil.copytree(foldername, target_folder)
|
oe.path.copytree(foldername, target_folder)
|
||||||
if not isfolder:
|
if not isfolder:
|
||||||
shutil.copy2(mod.path, os.path.join(exportpath, "oeqa/runtime"))
|
shutil.copy2(mod.path, os.path.join(exportpath, "oeqa/runtime"))
|
||||||
json_file = "%s.json" % mod.path.rsplit(".", 1)[0]
|
json_file = "%s.json" % mod.path.rsplit(".", 1)[0]
|
||||||
@@ -132,27 +133,12 @@ def exportTests(d,tc):
|
|||||||
create_tarball(d, "testexport.tar.gz", d.getVar("TEST_EXPORT_DIR", True))
|
create_tarball(d, "testexport.tar.gz", d.getVar("TEST_EXPORT_DIR", True))
|
||||||
|
|
||||||
# Copy packages needed for runtime testing
|
# Copy packages needed for runtime testing
|
||||||
export_pkg_dir = os.path.join(d.getVar("TEST_EXPORT_DIR", True), "packages")
|
|
||||||
test_pkg_dir = d.getVar("TEST_NEEDED_PACKAGES_DIR", True)
|
test_pkg_dir = d.getVar("TEST_NEEDED_PACKAGES_DIR", True)
|
||||||
need_pkg_dir = False
|
if os.listdir(test_pkg_dir):
|
||||||
for root, subdirs, files in os.walk(test_pkg_dir):
|
export_pkg_dir = os.path.join(d.getVar("TEST_EXPORT_DIR", True), "packages")
|
||||||
for subdir in subdirs:
|
oe.path.copytree(test_pkg_dir, export_pkg_dir)
|
||||||
tmp_dir = os.path.join(root.replace(test_pkg_dir, "").lstrip("/"), subdir)
|
|
||||||
new_dir = os.path.join(export_pkg_dir, tmp_dir)
|
|
||||||
bb.utils.mkdirhier(new_dir)
|
|
||||||
|
|
||||||
for f in files:
|
|
||||||
need_pkg_dir = True
|
|
||||||
src_f = os.path.join(root, f)
|
|
||||||
dst_f = os.path.join(export_pkg_dir, root.replace(test_pkg_dir, "").lstrip("/"), f)
|
|
||||||
shutil.copy2(src_f, dst_f)
|
|
||||||
|
|
||||||
if need_pkg_dir:
|
|
||||||
# Create tar file for packages needed by the DUT
|
# Create tar file for packages needed by the DUT
|
||||||
create_tarball(d, "testexport_packages_%s.tar.gz" % d.getVar("MACHINE", True), export_pkg_dir)
|
create_tarball(d, "testexport_packages_%s.tar.gz" % d.getVar("MACHINE", True), export_pkg_dir)
|
||||||
else:
|
|
||||||
# Remov packages dir from exported test
|
|
||||||
bb.utils.remove(export_pkg_dir, True)
|
|
||||||
|
|
||||||
# Copy SDK
|
# Copy SDK
|
||||||
if d.getVar("TEST_EXPORT_SDK_ENABLED", True) == "1":
|
if d.getVar("TEST_EXPORT_SDK_ENABLED", True) == "1":
|
||||||
|
|||||||
@@ -443,6 +443,8 @@ class RuntimeTestContext(TestContext):
|
|||||||
modules = self.getTestModules()
|
modules = self.getTestModules()
|
||||||
bbpaths = self.d.getVar("BBPATH", True).split(":")
|
bbpaths = self.d.getVar("BBPATH", True).split(":")
|
||||||
|
|
||||||
|
shutil.rmtree(self.d.getVar("TEST_EXTRACTED_DIR", True))
|
||||||
|
shutil.rmtree(self.d.getVar("TEST_PACKAGED_DIR", True))
|
||||||
for module in modules:
|
for module in modules:
|
||||||
json_file = self._getJsonFile(module)
|
json_file = self._getJsonFile(module)
|
||||||
if json_file:
|
if json_file:
|
||||||
@@ -454,6 +456,8 @@ class RuntimeTestContext(TestContext):
|
|||||||
Extract packages that will be needed during runtime.
|
Extract packages that will be needed during runtime.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import oe.path
|
||||||
|
|
||||||
extracted_path = self.d.getVar("TEST_EXTRACTED_DIR", True)
|
extracted_path = self.d.getVar("TEST_EXTRACTED_DIR", True)
|
||||||
packaged_path = self.d.getVar("TEST_PACKAGED_DIR", True)
|
packaged_path = self.d.getVar("TEST_PACKAGED_DIR", True)
|
||||||
|
|
||||||
@@ -477,13 +481,18 @@ class RuntimeTestContext(TestContext):
|
|||||||
dst_dir = os.path.join(packaged_path)
|
dst_dir = os.path.join(packaged_path)
|
||||||
|
|
||||||
# Extract package and copy it to TEST_EXTRACTED_DIR
|
# Extract package and copy it to TEST_EXTRACTED_DIR
|
||||||
if extract and not os.path.exists(dst_dir):
|
pkg_dir = self._extract_in_tmpdir(pkg)
|
||||||
pkg_dir = self._extract_in_tmpdir(pkg)
|
if extract:
|
||||||
shutil.copytree(pkg_dir, dst_dir)
|
|
||||||
|
# Same package used for more than one test,
|
||||||
|
# don't need to extract again.
|
||||||
|
if os.path.exists(dst_dir):
|
||||||
|
continue
|
||||||
|
oe.path.copytree(pkg_dir, dst_dir)
|
||||||
shutil.rmtree(pkg_dir)
|
shutil.rmtree(pkg_dir)
|
||||||
|
|
||||||
# Copy package to TEST_PACKAGED_DIR
|
# Copy package to TEST_PACKAGED_DIR
|
||||||
elif not extract:
|
else:
|
||||||
self._copy_package(pkg)
|
self._copy_package(pkg)
|
||||||
|
|
||||||
def _getJsonFile(self, module):
|
def _getJsonFile(self, module):
|
||||||
|
|||||||
Reference in New Issue
Block a user