Skip to content

Commit

Permalink
kernelci.runtime.lava: get chromeos version for os-release
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Jeny Sadadia authored and nuclearcat committed Nov 14, 2024
1 parent 47fdd94 commit e993441
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions kernelci/runtime/lava.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit e993441

Please sign in to comment.