summaryrefslogtreecommitdiff
path: root/meta/classes/testimage.bbclass
diff options
context:
space:
mode:
authorLucian Musat <george.l.musat@intel.com>2015-10-09 20:16:26 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-11-16 11:28:32 +0000
commit8fe45badd3dfe44fa5161229324b6439594123fd (patch)
tree8a891e56c8151d2d80f9ed97006694051539d1fc /meta/classes/testimage.bbclass
parent29945c12d43a1cc40b22caf04fe57f25b946e84f (diff)
downloadopenembedded-core-8fe45badd3dfe44fa5161229324b6439594123fd.tar.gz
openembedded-core-8fe45badd3dfe44fa5161229324b6439594123fd.tar.bz2
openembedded-core-8fe45badd3dfe44fa5161229324b6439594123fd.zip
oeqa/testimage: Add support for test folder export.
If tests are organized in folders then it will copy the whole folder to the export location. This should keep the original directory structure for exported oeqa/runtime. Signed-off-by: Lucian Musat <george.l.musat@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/classes/testimage.bbclass')
-rw-r--r--meta/classes/testimage.bbclass14
1 files changed, 13 insertions, 1 deletions
diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass
index d571672bc0..e833db4bfe 100644
--- a/meta/classes/testimage.bbclass
+++ b/meta/classes/testimage.bbclass
@@ -229,11 +229,23 @@ def exportTests(d,tc):
bb.utils.mkdirhier(os.path.join(exportpath, "oeqa/runtime/files"))
bb.utils.mkdirhier(os.path.join(exportpath, "oeqa/utils"))
# copy test modules, this should cover tests in other layers too
+ bbpath = d.getVar("BBPATH", True).split(':')
for t in tc.testslist:
+ isfolder = False
if re.search("\w+\.\w+\.test_\S+", t):
t = '.'.join(t.split('.')[:3])
mod = pkgutil.get_loader(t)
- shutil.copy2(mod.filename, os.path.join(exportpath, "oeqa/runtime"))
+ # More depth than usual?
+ if (t.count('.') > 2):
+ for p in bbpath:
+ foldername = os.path.join(p, 'lib', os.sep.join(t.split('.')).rsplit(os.sep, 1)[0])
+ if os.path.isdir(foldername):
+ isfolder = True
+ target_folder = os.path.join(exportpath, "oeqa", "runtime", os.path.basename(foldername))
+ if not os.path.exists(target_folder):
+ shutil.copytree(foldername, target_folder)
+ if not isfolder:
+ shutil.copy2(mod.filename, os.path.join(exportpath, "oeqa/runtime"))
# copy __init__.py files
oeqadir = pkgutil.get_loader("oeqa").filename
shutil.copy2(os.path.join(oeqadir, "__init__.py"), os.path.join(exportpath, "oeqa"))