summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/sdk/testsdk.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/sdk/testsdk.py')
-rw-r--r--meta/lib/oeqa/sdk/testsdk.py39
1 files changed, 29 insertions, 10 deletions
diff --git a/meta/lib/oeqa/sdk/testsdk.py b/meta/lib/oeqa/sdk/testsdk.py
index 35e40187bc..cffcf9f49a 100644
--- a/meta/lib/oeqa/sdk/testsdk.py
+++ b/meta/lib/oeqa/sdk/testsdk.py
@@ -23,14 +23,6 @@ class TestSDKBase(object):
23 return configuration 23 return configuration
24 24
25 @staticmethod 25 @staticmethod
26 def get_sdk_json_result_dir(d):
27 json_result_dir = os.path.join(d.getVar("LOG_DIR"), 'oeqa')
28 custom_json_result_dir = d.getVar("OEQA_JSON_RESULT_DIR")
29 if custom_json_result_dir:
30 json_result_dir = custom_json_result_dir
31 return json_result_dir
32
33 @staticmethod
34 def get_sdk_result_id(configuration): 26 def get_sdk_result_id(configuration):
35 return '%s_%s_%s_%s_%s' % (configuration['TEST_TYPE'], configuration['IMAGE_BASENAME'], configuration['SDKMACHINE'], configuration['MACHINE'], configuration['STARTTIME']) 27 return '%s_%s_%s_%s_%s' % (configuration['TEST_TYPE'], configuration['IMAGE_BASENAME'], configuration['SDKMACHINE'], configuration['MACHINE'], configuration['STARTTIME'])
36 28
@@ -39,6 +31,28 @@ class TestSDK(TestSDKBase):
39 context_class = OESDKTestContext 31 context_class = OESDKTestContext
40 test_type = 'sdk' 32 test_type = 'sdk'
41 33
34 def sdk_dir_names(self, d):
35 """Return list from TESTSDK_CASE_DIRS."""
36 testdirs = d.getVar("TESTSDK_CASE_DIRS")
37 if testdirs:
38 return testdirs.split()
39
40 bb.fatal("TESTSDK_CASE_DIRS unset, can't find SDK test directories.")
41
42 def get_sdk_paths(self, d):
43 """
44 Return a list of paths where SDK test cases reside.
45
46 SDK tests are expected in <LAYER_DIR>/lib/oeqa/<dirname>/cases
47 """
48 paths = []
49 for layer in d.getVar("BBLAYERS").split():
50 for dirname in self.sdk_dir_names(d):
51 case_path = os.path.join(layer, "lib", "oeqa", dirname, "cases")
52 if os.path.isdir(case_path):
53 paths.append(case_path)
54 return paths
55
42 def get_tcname(self, d): 56 def get_tcname(self, d):
43 """ 57 """
44 Get the name of the SDK file 58 Get the name of the SDK file
@@ -72,6 +86,7 @@ class TestSDK(TestSDKBase):
72 86
73 from bb.utils import export_proxies 87 from bb.utils import export_proxies
74 from oeqa.utils import make_logger_bitbake_compatible 88 from oeqa.utils import make_logger_bitbake_compatible
89 from oeqa.utils import get_json_result_dir
75 90
76 pn = d.getVar("PN") 91 pn = d.getVar("PN")
77 logger = make_logger_bitbake_compatible(logging.getLogger("BitBake")) 92 logger = make_logger_bitbake_compatible(logging.getLogger("BitBake"))
@@ -79,6 +94,9 @@ class TestSDK(TestSDKBase):
79 # sdk use network for download projects for build 94 # sdk use network for download projects for build
80 export_proxies(d) 95 export_proxies(d)
81 96
97 # We need the original PATH for testing the eSDK, not with our manipulations
98 os.environ['PATH'] = d.getVar("BB_ORIGENV", False).getVar("PATH")
99
82 tcname = self.get_tcname(d) 100 tcname = self.get_tcname(d)
83 101
84 if not os.path.exists(tcname): 102 if not os.path.exists(tcname):
@@ -118,7 +136,8 @@ class TestSDK(TestSDKBase):
118 host_pkg_manifest=host_pkg_manifest, **context_args) 136 host_pkg_manifest=host_pkg_manifest, **context_args)
119 137
120 try: 138 try:
121 tc.loadTests(self.context_executor_class.default_cases) 139 modules = (d.getVar("TESTSDK_SUITES") or "").split()
140 tc.loadTests(self.get_sdk_paths(d), modules)
122 except Exception as e: 141 except Exception as e:
123 import traceback 142 import traceback
124 bb.fatal("Loading tests failed:\n%s" % traceback.format_exc()) 143 bb.fatal("Loading tests failed:\n%s" % traceback.format_exc())
@@ -131,7 +150,7 @@ class TestSDK(TestSDKBase):
131 component = "%s %s" % (pn, self.context_executor_class.name) 150 component = "%s %s" % (pn, self.context_executor_class.name)
132 context_msg = "%s:%s" % (os.path.basename(tcname), os.path.basename(sdk_env)) 151 context_msg = "%s:%s" % (os.path.basename(tcname), os.path.basename(sdk_env))
133 configuration = self.get_sdk_configuration(d, self.test_type) 152 configuration = self.get_sdk_configuration(d, self.test_type)
134 result.logDetails(self.get_sdk_json_result_dir(d), 153 result.logDetails(get_json_result_dir(d),
135 configuration, 154 configuration,
136 self.get_sdk_result_id(configuration)) 155 self.get_sdk_result_id(configuration))
137 result.logSummary(component, context_msg) 156 result.logSummary(component, context_msg)