summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/selftest/context.py34
1 files changed, 31 insertions, 3 deletions
diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py
index c78947e200..ee83a9142e 100644
--- a/meta/lib/oeqa/selftest/context.py
+++ b/meta/lib/oeqa/selftest/context.py
@@ -99,8 +99,8 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
99 return cases_paths 99 return cases_paths
100 100
101 def _process_args(self, logger, args): 101 def _process_args(self, logger, args):
102 args.output_log = '%s-results-%s.log' % (self.name, 102 args.test_start_time = time.strftime("%Y%m%d%H%M%S")
103 time.strftime("%Y%m%d%H%M%S")) 103 args.output_log = '%s-results-%s.log' % (self.name, args.test_start_time)
104 args.test_data_file = None 104 args.test_data_file = None
105 args.CASES_PATHS = None 105 args.CASES_PATHS = None
106 106
@@ -204,6 +204,31 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
204 self.tc.logger.info("Running bitbake -e to test the configuration is valid/parsable") 204 self.tc.logger.info("Running bitbake -e to test the configuration is valid/parsable")
205 runCmd("bitbake -e") 205 runCmd("bitbake -e")
206 206
207 def _get_json_result_dir(self, args):
208 json_result_dir = os.path.join(os.path.dirname(os.path.abspath(args.output_log)), 'oeqa')
209 if "OEQA_JSON_RESULT_DIR" in self.tc.td:
210 json_result_dir = self.tc.td["OEQA_JSON_RESULT_DIR"]
211
212 return json_result_dir
213
214 def _get_configuration(self, args):
215 import platform
216 from oeqa.utils.metadata import metadata_from_bb
217 metadata = metadata_from_bb()
218 configuration = {'TEST_TYPE': 'oeselftest',
219 'START_TIME': args.test_start_time,
220 'MACHINE': self.tc.td["MACHINE"],
221 'HOST_DISTRO': ('-'.join(platform.linux_distribution())).replace(' ', '-'),
222 'HOST_NAME': metadata['hostname']}
223 layers = metadata['layers']
224 for l in layers:
225 configuration['%s_BRANCH_REV' % os.path.basename(l)] = '%s:%s' % (metadata['layers'][l]['branch'],
226 metadata['layers'][l]['commit'])
227 return configuration
228
229 def _get_result_id(self, configuration):
230 return '%s_%s_%s' % (configuration['TEST_TYPE'], configuration['HOST_DISTRO'], configuration['MACHINE'])
231
207 def _internal_run(self, logger, args): 232 def _internal_run(self, logger, args):
208 self.module_paths = self._get_cases_paths( 233 self.module_paths = self._get_cases_paths(
209 self.tc_kwargs['init']['td']['BBPATH'].split(':')) 234 self.tc_kwargs['init']['td']['BBPATH'].split(':'))
@@ -220,7 +245,10 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
220 else: 245 else:
221 self._pre_run() 246 self._pre_run()
222 rc = self.tc.runTests(**self.tc_kwargs['run']) 247 rc = self.tc.runTests(**self.tc_kwargs['run'])
223 rc.logDetails() 248 configuration = self._get_configuration(args)
249 rc.logDetails(self._get_json_result_dir(args),
250 configuration,
251 self._get_result_id(configuration))
224 rc.logSummary(self.name) 252 rc.logSummary(self.name)
225 253
226 return rc 254 return rc