kunit_json.py (de4fb176622d54a82ea3ceb7362392aaf5ff0b5a) kunit_json.py (00f75043e46d5bd2bba87b3fada6c1090b61bd40)
1# SPDX-License-Identifier: GPL-2.0
2#
3# Generates JSON from KUnit results according to
4# KernelCI spec: https://github.com/kernelci/kernelci-doc/wiki/Test-API
5#
6# Copyright (C) 2020, Google LLC.
7# Author: Heidi Fahim <heidifahim@google.com>
8

--- 37 unchanged lines hidden (view full) ---

46 "lab_name": None,
47 "kernel": None,
48 "job": None,
49 "git_branch": "kselftest",
50 }
51 return test_group
52
53def get_json_result(test: Test, def_config: str,
1# SPDX-License-Identifier: GPL-2.0
2#
3# Generates JSON from KUnit results according to
4# KernelCI spec: https://github.com/kernelci/kernelci-doc/wiki/Test-API
5#
6# Copyright (C) 2020, Google LLC.
7# Author: Heidi Fahim <heidifahim@google.com>
8

--- 37 unchanged lines hidden (view full) ---

46 "lab_name": None,
47 "kernel": None,
48 "job": None,
49 "git_branch": "kselftest",
50 }
51 return test_group
52
53def get_json_result(test: Test, def_config: str,
54 build_dir: Optional[str], json_path: str) -> str:
54 build_dir: Optional[str]) -> str:
55 test_group = _get_group_json(test, def_config, build_dir)
56 test_group["name"] = "KUnit Test Group"
55 test_group = _get_group_json(test, def_config, build_dir)
56 test_group["name"] = "KUnit Test Group"
57 json_obj = json.dumps(test_group, indent=4)
58 if json_path != 'stdout':
59 with open(json_path, 'w') as result_path:
60 result_path.write(json_obj)
61 root = __file__.split('tools/testing/kunit/')[0]
62 kunit_parser.print_with_timestamp(
63 "Test results stored in %s" %
64 os.path.join(root, result_path.name))
65 return json_obj
57 return json.dumps(test_group, indent=4)