summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/lib/oeqa/oetest.py26
-rwxr-xr-xmeta/lib/oeqa/runexported.py16
2 files changed, 19 insertions, 23 deletions
diff --git a/meta/lib/oeqa/oetest.py b/meta/lib/oeqa/oetest.py
index 6a908ee379..70db119e39 100644
--- a/meta/lib/oeqa/oetest.py
+++ b/meta/lib/oeqa/oetest.py
@@ -186,11 +186,19 @@ def custom_verbose(msg, *args, **kwargs):
186 _buffer_logger = "" 186 _buffer_logger = ""
187 187
188class TestContext(object): 188class TestContext(object):
189 def __init__(self, d): 189 def __init__(self, d, exported=False):
190 self.d = d 190 self.d = d
191 191
192 self.testsuites = self._get_test_suites() 192 self.testsuites = self._get_test_suites()
193 self.testslist = self._get_tests_list(d.getVar("BBPATH", True).split(':')) 193
194 if exported:
195 path = [os.path.dirname(os.path.abspath(__file__))]
196 extrapath = ""
197 else:
198 path = d.getVar("BBPATH", True).split(':')
199 extrapath = "lib/oeqa"
200
201 self.testslist = self._get_tests_list(path, extrapath)
194 self.testsrequired = self._get_test_suites_required() 202 self.testsrequired = self._get_test_suites_required()
195 203
196 self.filesdir = os.path.join(os.path.dirname(os.path.abspath( 204 self.filesdir = os.path.join(os.path.dirname(os.path.abspath(
@@ -213,7 +221,7 @@ class TestContext(object):
213 return " ".join(tcs) 221 return " ".join(tcs)
214 222
215 # return test list by type also filter if TEST_SUITES is specified 223 # return test list by type also filter if TEST_SUITES is specified
216 def _get_tests_list(self, bbpath): 224 def _get_tests_list(self, bbpath, extrapath):
217 testslist = [] 225 testslist = []
218 226
219 type = self._get_test_namespace() 227 type = self._get_test_namespace()
@@ -227,11 +235,11 @@ class TestContext(object):
227 continue 235 continue
228 found = False 236 found = False
229 for p in bbpath: 237 for p in bbpath:
230 if os.path.exists(os.path.join(p, 'lib', 'oeqa', type, testname + '.py')): 238 if os.path.exists(os.path.join(p, extrapath, type, testname + ".py")):
231 testslist.append("oeqa." + type + "." + testname) 239 testslist.append("oeqa." + type + "." + testname)
232 found = True 240 found = True
233 break 241 break
234 elif os.path.exists(os.path.join(p, 'lib', 'oeqa', type, testname.split(".")[0] + '.py')): 242 elif os.path.exists(os.path.join(p, extrapath, type, testname.split(".")[0] + ".py")):
235 testslist.append("oeqa." + type + "." + testname) 243 testslist.append("oeqa." + type + "." + testname)
236 found = True 244 found = True
237 break 245 break
@@ -333,8 +341,8 @@ class TestContext(object):
333 return runner.run(self.suite) 341 return runner.run(self.suite)
334 342
335class RuntimeTestContext(TestContext): 343class RuntimeTestContext(TestContext):
336 def __init__(self, d, target): 344 def __init__(self, d, target, exported=False):
337 super(RuntimeTestContext, self).__init__(d) 345 super(RuntimeTestContext, self).__init__(d, exported)
338 346
339 self.tagexp = d.getVar("TEST_SUITES_TAGS", True) 347 self.tagexp = d.getVar("TEST_SUITES_TAGS", True)
340 348
@@ -393,8 +401,8 @@ class ImageTestContext(RuntimeTestContext):
393 self.target.stop() 401 self.target.stop()
394 402
395class ExportTestContext(RuntimeTestContext): 403class ExportTestContext(RuntimeTestContext):
396 def __init__(self, d, target): 404 def __init__(self, d, target, exported=False):
397 super(ExportTestContext, self).__init__(d, target) 405 super(ExportTestContext, self).__init__(d, target, exported)
398 self.sigterm = None 406 self.sigterm = None
399 407
400class SDKTestContext(TestContext): 408class SDKTestContext(TestContext):
diff --git a/meta/lib/oeqa/runexported.py b/meta/lib/oeqa/runexported.py
index f333879c22..52c1171a3a 100755
--- a/meta/lib/oeqa/runexported.py
+++ b/meta/lib/oeqa/runexported.py
@@ -30,7 +30,7 @@ except ImportError:
30 30
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 TestContext 33from oeqa.oetest import ExportTestContext
34from oeqa.utils.sshcontrol import SSHControl 34from oeqa.utils.sshcontrol import SSHControl
35from oeqa.utils.dump import get_host_dumper 35from oeqa.utils.dump import get_host_dumper
36 36
@@ -69,10 +69,6 @@ class MyDataDict(dict):
69 def getVar(self, key, unused = None): 69 def getVar(self, key, unused = None):
70 return self.get(key, "") 70 return self.get(key, "")
71 71
72class ExportTestContext(TestContext):
73 def __init__(self, d):
74 self.d = d
75
76def main(): 72def main():
77 73
78 parser = argparse.ArgumentParser() 74 parser = argparse.ArgumentParser()
@@ -111,20 +107,12 @@ def main():
111 if not os.path.isdir(d["DEPLOY_DIR"]): 107 if not os.path.isdir(d["DEPLOY_DIR"]):
112 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"])
113 109
114
115 target = FakeTarget(d) 110 target = FakeTarget(d)
116 for key in loaded["target"].keys(): 111 for key in loaded["target"].keys():
117 setattr(target, key, loaded["target"][key]) 112 setattr(target, key, loaded["target"][key])
118 113
119 target.exportStart() 114 target.exportStart()
120 tc = ExportTestContext(d) 115 tc = ExportTestContext(d, target, True)
121
122 setattr(tc, "d", d)
123 setattr(tc, "target", target)
124 for key in loaded.keys():
125 if key != "d" and key != "target" and key != "host_dumper":
126 setattr(tc, key, loaded[key])
127
128 tc.loadTests() 116 tc.loadTests()
129 tc.runTests() 117 tc.runTests()
130 118