summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-10-29 13:49:02 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-12-16 14:31:27 +0000
commitf50977c3b596c915b2c863fb727b678db2425f99 (patch)
treea60460a0a329abcff07293988f9ee8fdec6e75fd /meta/lib
parent8ea47d187dbb211b6caa33e996694ab6be136804 (diff)
downloadpoky-f50977c3b596c915b2c863fb727b678db2425f99.tar.gz
oeqa/selftest: Improvements to the json logging
Tweak the preceeding commit to: * Add STARTTIME to the identifier to make it unique * Use LOG_DIR * Store the layer config in a more natural json format * Drop '_' function prefixes (From OE-Core rev: 173f59acf9722e2ef27fdd49c20f7d3d664917eb) (From OE-Core rev: 3b69099edc7db99c11bfb41eab2af50bd0e3d4f2) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/selftest/context.py25
1 files changed, 11 insertions, 14 deletions
diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py
index 964a46c45a..a5116a7e46 100644
--- a/meta/lib/oeqa/selftest/context.py
+++ b/meta/lib/oeqa/selftest/context.py
@@ -202,30 +202,27 @@ 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): 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') 206 json_result_dir = os.path.join(os.path.dirname(os.path.abspath(args.output_log)), 'log', 'oeqa')
207 if "OEQA_JSON_RESULT_DIR" in self.tc.td: 207 if "OEQA_JSON_RESULT_DIR" in self.tc.td:
208 json_result_dir = self.tc.td["OEQA_JSON_RESULT_DIR"] 208 json_result_dir = self.tc.td["OEQA_JSON_RESULT_DIR"]
209 209
210 return json_result_dir 210 return json_result_dir
211 211
212 def _get_configuration(self, args): 212 def get_configuration(self, args):
213 import platform 213 import platform
214 from oeqa.utils.metadata import metadata_from_bb 214 from oeqa.utils.metadata import metadata_from_bb
215 metadata = metadata_from_bb() 215 metadata = metadata_from_bb()
216 configuration = {'TEST_TYPE': 'oeselftest', 216 configuration = {'TEST_TYPE': 'oeselftest',
217 'START_TIME': args.test_start_time, 217 'STARTTIME': args.test_start_time,
218 'MACHINE': self.tc.td["MACHINE"], 218 'MACHINE': self.tc.td["MACHINE"],
219 'HOST_DISTRO': ('-'.join(platform.linux_distribution())).replace(' ', '-'), 219 'HOST_DISTRO': ('-'.join(platform.linux_distribution())).replace(' ', '-'),
220 'HOST_NAME': metadata['hostname']} 220 'HOST_NAME': metadata['hostname'],
221 layers = metadata['layers'] 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 222 return configuration
226 223
227 def _get_result_id(self, configuration): 224 def get_result_id(self, configuration):
228 return '%s_%s_%s' % (configuration['TEST_TYPE'], configuration['HOST_DISTRO'], configuration['MACHINE']) 225 return '%s_%s_%s_%s' % (configuration['TEST_TYPE'], configuration['HOST_DISTRO'], configuration['MACHINE'], configuration['STARTTIME'])
229 226
230 def _internal_run(self, logger, args): 227 def _internal_run(self, logger, args):
231 self.module_paths = self._get_cases_paths( 228 self.module_paths = self._get_cases_paths(
@@ -243,10 +240,10 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
243 else: 240 else:
244 self._pre_run() 241 self._pre_run()
245 rc = self.tc.runTests(**self.tc_kwargs['run']) 242 rc = self.tc.runTests(**self.tc_kwargs['run'])
246 configuration = self._get_configuration(args) 243 configuration = self.get_configuration(args)
247 rc.logDetails(self._get_json_result_dir(args), 244 rc.logDetails(self.get_json_result_dir(args),
248 configuration, 245 configuration,
249 self._get_result_id(configuration)) 246 self.get_result_id(configuration))
250 rc.logSummary(self.name) 247 rc.logSummary(self.name)
251 248
252 return rc 249 return rc