summaryrefslogtreecommitdiffstats
path: root/meta/classes/testexport.bbclass
diff options
context:
space:
mode:
authorMariano Lopez <mariano.lopez@linux.intel.com>2016-06-06 07:15:41 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-06-07 15:22:38 +0100
commit938f05333b94e91a628c940588e2bafc88b8bdef (patch)
tree0feb8cae22ed025cc6ac30c38aa00931684c970f /meta/classes/testexport.bbclass
parentd9b3ee8b38f877c1723e48f1aa311c28102786fb (diff)
downloadpoky-938f05333b94e91a628c940588e2bafc88b8bdef.tar.gz
oetest.py: Add install/uninstall functionality for DUTs
Add the functionality to install/unistall packages in the DUTs without the use of the package manager. This is possible with the extraction introduced in package manager class. testimage and testexport bbclasses has been modified in order to support this new feature. [YOCTO #8694] (From OE-Core rev: b7111d9e9d64d21f57729d1ac1865aea6e54cc8b) Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/testexport.bbclass')
-rw-r--r--meta/classes/testexport.bbclass33
1 files changed, 28 insertions, 5 deletions
diff --git a/meta/classes/testexport.bbclass b/meta/classes/testexport.bbclass
index c86eaac197..8046e29655 100644
--- a/meta/classes/testexport.bbclass
+++ b/meta/classes/testexport.bbclass
@@ -16,6 +16,9 @@
16 16
17TEST_LOG_DIR ?= "${WORKDIR}/testexport" 17TEST_LOG_DIR ?= "${WORKDIR}/testexport"
18TEST_EXPORT_DIR ?= "${TMPDIR}/testexport/${PN}" 18TEST_EXPORT_DIR ?= "${TMPDIR}/testexport/${PN}"
19TEST_EXPORT_PACKAGED_DIR ?= "packages/packaged"
20TEST_EXPORT_EXTRACTED_DIR ?= "packages/extracted"
21
19TEST_TARGET ?= "simpleremote" 22TEST_TARGET ?= "simpleremote"
20TEST_TARGET_IP ?= "" 23TEST_TARGET_IP ?= ""
21TEST_SERVER_IP ?= "" 24TEST_SERVER_IP ?= ""
@@ -28,9 +31,9 @@ python do_testexport() {
28} 31}
29 32
30addtask testexport 33addtask testexport
31do_testimage[nostamp] = "1" 34do_testexport[nostamp] = "1"
32do_testimage[depends] += "${TEST_EXPORT_DEPENDS}" 35do_testexport[depends] += "${TEST_EXPORT_DEPENDS} ${TESTIMAGEDEPENDS}"
33do_testimage[lockfiles] += "${TEST_EXPORT_LOCK}" 36do_testexport[lockfiles] += "${TEST_EXPORT_LOCK}"
34 37
35def exportTests(d,tc): 38def exportTests(d,tc):
36 import json 39 import json
@@ -96,6 +99,9 @@ def exportTests(d,tc):
96 shutil.copytree(foldername, target_folder) 99 shutil.copytree(foldername, target_folder)
97 if not isfolder: 100 if not isfolder:
98 shutil.copy2(mod.path, os.path.join(exportpath, "oeqa/runtime")) 101 shutil.copy2(mod.path, os.path.join(exportpath, "oeqa/runtime"))
102 json_file = "%s.json" % mod.path.rsplit(".", 1)[0]
103 if os.path.isfile(json_file):
104 shutil.copy2(json_file, os.path.join(exportpath, "oeqa/runtime"))
99 # Get meta layer 105 # Get meta layer
100 for layer in d.getVar("BBLAYERS", True).split(): 106 for layer in d.getVar("BBLAYERS", True).split():
101 if os.path.basename(layer) == "meta": 107 if os.path.basename(layer) == "meta":
@@ -115,6 +121,20 @@ def exportTests(d,tc):
115 for f in files: 121 for f in files:
116 shutil.copy2(os.path.join(root, f), os.path.join(exportpath, "oeqa/runtime/files")) 122 shutil.copy2(os.path.join(root, f), os.path.join(exportpath, "oeqa/runtime/files"))
117 123
124 # Copy packages needed for runtime testing
125 export_pkg_dir = os.path.join(d.getVar("TEST_EXPORT_DIR", True), "packages")
126 test_pkg_dir = d.getVar("TEST_NEEDED_PACKAGES_DIR", True)
127 for root, subdirs, files in os.walk(test_pkg_dir):
128 for subdir in subdirs:
129 tmp_dir = os.path.join(root.replace(test_pkg_dir, "").lstrip("/"), subdir)
130 new_dir = os.path.join(export_pkg_dir, tmp_dir)
131 bb.utils.mkdirhier(new_dir)
132
133 for f in files:
134 src_f = os.path.join(root, f)
135 dst_f = os.path.join(export_pkg_dir, root.replace(test_pkg_dir, "").lstrip("/"), f)
136 shutil.copy2(src_f, dst_f)
137
118 bb.plain("Exported tests to: %s" % exportpath) 138 bb.plain("Exported tests to: %s" % exportpath)
119 139
120def testexport_main(d): 140def testexport_main(d):
@@ -122,9 +142,11 @@ def testexport_main(d):
122 from oeqa.targetcontrol import get_target_controller 142 from oeqa.targetcontrol import get_target_controller
123 from oeqa.utils.dump import get_host_dumper 143 from oeqa.utils.dump import get_host_dumper
124 144
145 test_create_extract_dirs(d)
146 export_dir = d.getVar("TEST_EXPORT_DIR", True)
125 bb.utils.mkdirhier(d.getVar("TEST_LOG_DIR", True)) 147 bb.utils.mkdirhier(d.getVar("TEST_LOG_DIR", True))
126 bb.utils.remove(d.getVar("TEST_EXPORT_DIR", True), recurse=True) 148 bb.utils.remove(export_dir, recurse=True)
127 bb.utils.mkdirhier(d.getVar("TEST_EXPORT_DIR", True)) 149 bb.utils.mkdirhier(export_dir)
128 150
129 # the robot dance 151 # the robot dance
130 target = get_target_controller(d) 152 target = get_target_controller(d)
@@ -141,6 +163,7 @@ def testexport_main(d):
141 import traceback 163 import traceback
142 bb.fatal("Loading tests failed:\n%s" % traceback.format_exc()) 164 bb.fatal("Loading tests failed:\n%s" % traceback.format_exc())
143 165
166 tc.extract_packages()
144 exportTests(d,tc) 167 exportTests(d,tc)
145 168
146testexport_main[vardepsexclude] =+ "BB_ORIGENV" 169testexport_main[vardepsexclude] =+ "BB_ORIGENV"