From e9934418f3fc8c1f909b080b90f674157352c402 Mon Sep 17 00:00:00 2001 From: Jeny Sadadia Date: Wed, 13 Nov 2024 16:33:20 +0530 Subject: [PATCH] kernelci.runtime.lava: get chromeos version for `os-release` Add a method to get `measurement`(chromeos version) field for `os-release` test case from LAVA callback data. Store the information into `node.data.misc` field of test node. Signed-off-by: Jeny Sadadia --- kernelci/runtime/lava.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/kernelci/runtime/lava.py b/kernelci/runtime/lava.py index 1d4a236e00..b2b8ea1933 100644 --- a/kernelci/runtime/lava.py +++ b/kernelci/runtime/lava.py @@ -140,6 +140,17 @@ def _get_kernelmsg_case(cls, tests): result = kernelmsg and kernelmsg['result'] == 'pass' return 'pass' if result else 'fail' + def _get_os_release_measurement(self): + for suite_name, suite_results in self._data['results'].items(): + if suite_name != '0_tast': + continue + tests = yaml.safe_load(suite_results) + tests_map = {test['name']: test for test in tests} + os_release = tests_map.get('os-release') + if os_release: + return os_release.get('measurement') + return None + @classmethod def _get_suite_results(cls, tests): suite_results = {} @@ -195,6 +206,9 @@ def _get_results_hierarchy(self, results): elif isinstance(value, str): node['result'] = value node['kind'] = 'test' + if node['name'] == 'os-release': + node['data'] = {"misc": {}} + node['data']['misc']['measurement'] = self._get_os_release_measurement() hierarchy.append(item) return hierarchy