mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 11:33:36 -04:00
kunit: tool: make --json handling a bit clearer
Currently kunit_json.get_json_result() will output the JSON-ified test output to json_path, but iff it's not "stdout". Instead, move the responsibility entirely over to the one caller. Signed-off-by: Daniel Latypov <dlatypov@google.com> Reviewed-by: David Gow <davidgow@google.com> Reviewed-by: Brendan Higgins <brendanhiggins@google.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
This commit is contained in:
committed by
Shuah Khan
parent
3123109284
commit
00f75043e4
@@ -51,15 +51,7 @@ def _get_group_json(test: Test, def_config: str,
|
||||
return test_group
|
||||
|
||||
def get_json_result(test: Test, def_config: str,
|
||||
build_dir: Optional[str], json_path: str) -> str:
|
||||
build_dir: Optional[str]) -> str:
|
||||
test_group = _get_group_json(test, def_config, build_dir)
|
||||
test_group["name"] = "KUnit Test Group"
|
||||
json_obj = json.dumps(test_group, indent=4)
|
||||
if json_path != 'stdout':
|
||||
with open(json_path, 'w') as result_path:
|
||||
result_path.write(json_obj)
|
||||
root = __file__.split('tools/testing/kunit/')[0]
|
||||
kunit_parser.print_with_timestamp(
|
||||
"Test results stored in %s" %
|
||||
os.path.join(root, result_path.name))
|
||||
return json_obj
|
||||
return json.dumps(test_group, indent=4)
|
||||
|
||||
Reference in New Issue
Block a user