diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-10-29 13:49:02 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-10-29 17:26:47 +0000 |
commit | 1418c0ea24acc3d8d3a26b7a1cf21db06ac22491 (patch) | |
tree | b5749095b99ee23470996d062260daebf5f1076f | |
parent | d89e06083eeea1bebdaa64f809e7e0a328e282f5 (diff) | |
download | poky-1418c0ea24acc3d8d3a26b7a1cf21db06ac22491.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)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/lib/oeqa/selftest/context.py | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py index ee83a9142e..11d5877c5f 100644 --- a/meta/lib/oeqa/selftest/context.py +++ b/meta/lib/oeqa/selftest/context.py | |||
@@ -204,30 +204,27 @@ 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): | 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') | 208 | json_result_dir = os.path.join(os.path.dirname(os.path.abspath(args.output_log)), 'log', 'oeqa') |
209 | if "OEQA_JSON_RESULT_DIR" in self.tc.td: | 209 | if "OEQA_JSON_RESULT_DIR" in self.tc.td: |
210 | json_result_dir = self.tc.td["OEQA_JSON_RESULT_DIR"] | 210 | json_result_dir = self.tc.td["OEQA_JSON_RESULT_DIR"] |
211 | 211 | ||
212 | return json_result_dir | 212 | return json_result_dir |
213 | 213 | ||
214 | def _get_configuration(self, args): | 214 | def get_configuration(self, args): |
215 | import platform | 215 | import platform |
216 | from oeqa.utils.metadata import metadata_from_bb | 216 | from oeqa.utils.metadata import metadata_from_bb |
217 | metadata = metadata_from_bb() | 217 | metadata = metadata_from_bb() |
218 | configuration = {'TEST_TYPE': 'oeselftest', | 218 | configuration = {'TEST_TYPE': 'oeselftest', |
219 | 'START_TIME': args.test_start_time, | 219 | 'STARTTIME': args.test_start_time, |
220 | 'MACHINE': self.tc.td["MACHINE"], | 220 | 'MACHINE': self.tc.td["MACHINE"], |
221 | 'HOST_DISTRO': ('-'.join(platform.linux_distribution())).replace(' ', '-'), | 221 | 'HOST_DISTRO': ('-'.join(platform.linux_distribution())).replace(' ', '-'), |
222 | 'HOST_NAME': metadata['hostname']} | 222 | 'HOST_NAME': metadata['hostname'], |
223 | layers = metadata['layers'] | 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 | 224 | return configuration |
228 | 225 | ||
229 | def _get_result_id(self, configuration): | 226 | def get_result_id(self, configuration): |
230 | return '%s_%s_%s' % (configuration['TEST_TYPE'], configuration['HOST_DISTRO'], configuration['MACHINE']) | 227 | return '%s_%s_%s_%s' % (configuration['TEST_TYPE'], configuration['HOST_DISTRO'], configuration['MACHINE'], configuration['STARTTIME']) |
231 | 228 | ||
232 | def _internal_run(self, logger, args): | 229 | def _internal_run(self, logger, args): |
233 | self.module_paths = self._get_cases_paths( | 230 | self.module_paths = self._get_cases_paths( |
@@ -245,10 +242,10 @@ class OESelftestTestContextExecutor(OETestContextExecutor): | |||
245 | else: | 242 | else: |
246 | self._pre_run() | 243 | self._pre_run() |
247 | rc = self.tc.runTests(**self.tc_kwargs['run']) | 244 | rc = self.tc.runTests(**self.tc_kwargs['run']) |
248 | configuration = self._get_configuration(args) | 245 | configuration = self.get_configuration(args) |
249 | rc.logDetails(self._get_json_result_dir(args), | 246 | rc.logDetails(self.get_json_result_dir(args), |
250 | configuration, | 247 | configuration, |
251 | self._get_result_id(configuration)) | 248 | self.get_result_id(configuration)) |
252 | rc.logSummary(self.name) | 249 | rc.logSummary(self.name) |
253 | 250 | ||
254 | return rc | 251 | return rc |