summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/runexported.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/runexported.py')
-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()