summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorMariano Lopez <mariano.lopez@linux.intel.com>2016-06-06 07:15:44 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-06-07 15:22:38 +0100
commit120f7067c802a02856d44c2c241da6c0f7fd5126 (patch)
tree062b7daefd2318013f6e6f80d90754c07d008bc7 /meta/lib
parent7d18d9f9c5a9ce52610732cc1836b243a660eacb (diff)
downloadpoky-120f7067c802a02856d44c2c241da6c0f7fd5126.tar.gz
testexport.bbclass: Add support for testexport-tarball
Add support to export the SDK tarball needed when a test system doesn't have the required software to perform runtime tests. The support is when exporting the test and when running the test on a remote system. The user of this feature just need to set TEST_EXPORT_SDK_ENABLED to "1" and declare the sdk packages in TEST_EXPORT_SDK_PACKAGES. [YOCTO #7850] (From OE-Core rev: a6041f81b81baa7564e4c712fc88de2b997e52e4) (From OE-Core rev: 05e6c89f0f71311f8bd32cdb86a2deb789c58035) Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rwxr-xr-xmeta/lib/oeqa/runexported.py35
1 files changed, 34 insertions, 1 deletions
diff --git a/meta/lib/oeqa/runexported.py b/meta/lib/oeqa/runexported.py
index f1366a63d3..58867393bb 100755
--- a/meta/lib/oeqa/runexported.py
+++ b/meta/lib/oeqa/runexported.py
@@ -31,8 +31,8 @@ except ImportError:
31sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "oeqa"))) 31sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "oeqa")))
32 32
33from oeqa.oetest import ExportTestContext 33from oeqa.oetest import ExportTestContext
34from oeqa.utils.commands import runCmd
34from oeqa.utils.sshcontrol import SSHControl 35from oeqa.utils.sshcontrol import SSHControl
35from oeqa.utils.dump import get_host_dumper
36 36
37# this isn't pretty but we need a fake target object 37# this isn't pretty but we need a fake target object
38# for running the tests externally as we don't care 38# for running the tests externally as we don't care
@@ -107,6 +107,8 @@ def main():
107 if not os.path.isdir(d["DEPLOY_DIR"]): 107 if not os.path.isdir(d["DEPLOY_DIR"]):
108 print("WARNING: The path to DEPLOY_DIR does not exist: %s" % d["DEPLOY_DIR"]) 108 print("WARNING: The path to DEPLOY_DIR does not exist: %s" % d["DEPLOY_DIR"])
109 109
110 extract_sdk(d)
111
110 target = FakeTarget(d) 112 target = FakeTarget(d)
111 for key in loaded["target"].keys(): 113 for key in loaded["target"].keys():
112 setattr(target, key, loaded["target"][key]) 114 setattr(target, key, loaded["target"][key])
@@ -118,6 +120,37 @@ def main():
118 120
119 return 0 121 return 0
120 122
123def extract_sdk(d):
124 """
125 Extract SDK if needed
126 """
127
128 export_dir = os.path.dirname(os.path.realpath(__file__))
129 tools_dir = d.getVar("TEST_EXPORT_SDK_DIR", True)
130 tarball_name = "%s.sh" % d.getVar("TEST_EXPORT_SDK_NAME", True)
131 tarball_path = os.path.join(export_dir, tools_dir, tarball_name)
132 extract_path = os.path.join(export_dir, "sysroot")
133 if os.path.isfile(tarball_path):
134 print ("Found SDK tarball %s. Extracting..." % tarball_path)
135 result = runCmd("%s -y -d %s" % (tarball_path, extract_path))
136 for f in os.listdir(extract_path):
137 if f.startswith("environment-setup"):
138 print("Setting up SDK environment...")
139 env_file = os.path.join(extract_path, f)
140 update_env(env_file)
141
142def update_env(env_file):
143 """
144 Source a file and update environment
145 """
146
147 cmd = ". %s; env -0" % env_file
148 result = runCmd(cmd)
149
150 for line in result.output.split("\0"):
151 (key, _, value) = line.partition("=")
152 os.environ[key] = value
153
121if __name__ == "__main__": 154if __name__ == "__main__":
122 try: 155 try:
123 ret = main() 156 ret = main()