summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/context.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/selftest/context.py')
-rw-r--r--meta/lib/oeqa/selftest/context.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py
index 33316d3179..964a46c45a 100644
--- a/meta/lib/oeqa/selftest/context.py
+++ b/meta/lib/oeqa/selftest/context.py
@@ -202,6 +202,31 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
202 self.tc.logger.info("Running bitbake -p") 202 self.tc.logger.info("Running bitbake -p")
203 runCmd("bitbake -p") 203 runCmd("bitbake -p")
204 204
205 def _get_json_result_dir(self, args):
206 json_result_dir = os.path.join(os.path.dirname(os.path.abspath(args.output_log)), 'oeqa')
207 if "OEQA_JSON_RESULT_DIR" in self.tc.td:
208 json_result_dir = self.tc.td["OEQA_JSON_RESULT_DIR"]
209
210 return json_result_dir
211
212 def _get_configuration(self, args):
213 import platform
214 from oeqa.utils.metadata import metadata_from_bb
215 metadata = metadata_from_bb()
216 configuration = {'TEST_TYPE': 'oeselftest',
217 'START_TIME': args.test_start_time,
218 'MACHINE': self.tc.td["MACHINE"],
219 'HOST_DISTRO': ('-'.join(platform.linux_distribution())).replace(' ', '-'),
220 'HOST_NAME': metadata['hostname']}
221 layers = metadata['layers']
222 for l in layers:
223 configuration['%s_BRANCH_REV' % os.path.basename(l)] = '%s:%s' % (metadata['layers'][l]['branch'],
224 metadata['layers'][l]['commit'])
225 return configuration
226
227 def _get_result_id(self, configuration):
228 return '%s_%s_%s' % (configuration['TEST_TYPE'], configuration['HOST_DISTRO'], configuration['MACHINE'])
229
205 def _internal_run(self, logger, args): 230 def _internal_run(self, logger, args):
206 self.module_paths = self._get_cases_paths( 231 self.module_paths = self._get_cases_paths(
207 self.tc_kwargs['init']['td']['BBPATH'].split(':')) 232 self.tc_kwargs['init']['td']['BBPATH'].split(':'))
@@ -218,7 +243,10 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
218 else: 243 else:
219 self._pre_run() 244 self._pre_run()
220 rc = self.tc.runTests(**self.tc_kwargs['run']) 245 rc = self.tc.runTests(**self.tc_kwargs['run'])
221 rc.logDetails() 246 configuration = self._get_configuration(args)
247 rc.logDetails(self._get_json_result_dir(args),
248 configuration,
249 self._get_result_id(configuration))
222 rc.logSummary(self.name) 250 rc.logSummary(self.name)
223 251
224 return rc 252 return rc