diff options
| author | Mariano Lopez <mariano.lopez@linux.intel.com> | 2016-07-26 09:38:56 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-08-04 15:22:22 +0100 |
| commit | 65459f5b6d39f9fb2cdf66ba4f01b7889e41df16 (patch) | |
| tree | 7b71fc8abbea8c4de154d2682a8c2a0c20204460 /meta/classes/testexport.bbclass | |
| parent | 65a03c3f949e27f64f43b6b0b6452218dfe1a4ec (diff) | |
| download | poky-65459f5b6d39f9fb2cdf66ba4f01b7889e41df16.tar.gz | |
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>
Diffstat (limited to 'meta/classes/testexport.bbclass')
| -rw-r--r-- | meta/classes/testexport.bbclass | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/meta/classes/testexport.bbclass b/meta/classes/testexport.bbclass index 15fa470785..5147020820 100644 --- a/meta/classes/testexport.bbclass +++ b/meta/classes/testexport.bbclass | |||
| @@ -47,6 +47,7 @@ def exportTests(d,tc): | |||
| 47 | import shutil | 47 | import shutil |
| 48 | import pkgutil | 48 | import pkgutil |
| 49 | import re | 49 | import re |
| 50 | import oe.path | ||
| 50 | 51 | ||
| 51 | exportpath = d.getVar("TEST_EXPORT_DIR", True) | 52 | exportpath = d.getVar("TEST_EXPORT_DIR", True) |
| 52 | 53 | ||
| @@ -103,7 +104,7 @@ def exportTests(d,tc): | |||
| 103 | isfolder = True | 104 | isfolder = True |
| 104 | target_folder = os.path.join(exportpath, "oeqa", "runtime", os.path.basename(foldername)) | 105 | target_folder = os.path.join(exportpath, "oeqa", "runtime", os.path.basename(foldername)) |
| 105 | if not os.path.exists(target_folder): | 106 | if not os.path.exists(target_folder): |
| 106 | shutil.copytree(foldername, target_folder) | 107 | oe.path.copytree(foldername, target_folder) |
| 107 | if not isfolder: | 108 | if not isfolder: |
| 108 | shutil.copy2(mod.path, os.path.join(exportpath, "oeqa/runtime")) | 109 | shutil.copy2(mod.path, os.path.join(exportpath, "oeqa/runtime")) |
| 109 | json_file = "%s.json" % mod.path.rsplit(".", 1)[0] | 110 | json_file = "%s.json" % mod.path.rsplit(".", 1)[0] |
| @@ -132,27 +133,12 @@ def exportTests(d,tc): | |||
| 132 | create_tarball(d, "testexport.tar.gz", d.getVar("TEST_EXPORT_DIR", True)) | 133 | create_tarball(d, "testexport.tar.gz", d.getVar("TEST_EXPORT_DIR", True)) |
| 133 | 134 | ||
| 134 | # Copy packages needed for runtime testing | 135 | # Copy packages needed for runtime testing |
| 135 | export_pkg_dir = os.path.join(d.getVar("TEST_EXPORT_DIR", True), "packages") | ||
| 136 | test_pkg_dir = d.getVar("TEST_NEEDED_PACKAGES_DIR", True) | 136 | test_pkg_dir = d.getVar("TEST_NEEDED_PACKAGES_DIR", True) |
| 137 | need_pkg_dir = False | 137 | if os.listdir(test_pkg_dir): |
| 138 | for root, subdirs, files in os.walk(test_pkg_dir): | 138 | export_pkg_dir = os.path.join(d.getVar("TEST_EXPORT_DIR", True), "packages") |
| 139 | for subdir in subdirs: | 139 | oe.path.copytree(test_pkg_dir, export_pkg_dir) |
| 140 | tmp_dir = os.path.join(root.replace(test_pkg_dir, "").lstrip("/"), subdir) | ||
| 141 | new_dir = os.path.join(export_pkg_dir, tmp_dir) | ||
| 142 | bb.utils.mkdirhier(new_dir) | ||
| 143 | |||
| 144 | for f in files: | ||
| 145 | need_pkg_dir = True | ||
| 146 | src_f = os.path.join(root, f) | ||
| 147 | dst_f = os.path.join(export_pkg_dir, root.replace(test_pkg_dir, "").lstrip("/"), f) | ||
| 148 | shutil.copy2(src_f, dst_f) | ||
| 149 | |||
| 150 | if need_pkg_dir: | ||
| 151 | # Create tar file for packages needed by the DUT | 140 | # Create tar file for packages needed by the DUT |
| 152 | create_tarball(d, "testexport_packages_%s.tar.gz" % d.getVar("MACHINE", True), export_pkg_dir) | 141 | create_tarball(d, "testexport_packages_%s.tar.gz" % d.getVar("MACHINE", True), export_pkg_dir) |
| 153 | else: | ||
| 154 | # Remov packages dir from exported test | ||
| 155 | bb.utils.remove(export_pkg_dir, True) | ||
| 156 | 142 | ||
| 157 | # Copy SDK | 143 | # Copy SDK |
| 158 | if d.getVar("TEST_EXPORT_SDK_ENABLED", True) == "1": | 144 | if d.getVar("TEST_EXPORT_SDK_ENABLED", True) == "1": |
