aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/model
diff options
context:
space:
mode:
authorVratko Polak <vrpolak@cisco.com>2024-04-09 10:22:49 +0200
committerVratko Polak <vrpolak@cisco.com>2024-04-09 10:22:49 +0200
commitc4b7705089d6c2d01f743c2e93087a6a44025e6a (patch)
tree40989e148a8e055add175b388e16a200a43ed302 /resources/libraries/python/model
parentf890c0cbdee1b0da6e15cc1a9c2b14a423aa2b83 (diff)
fix(perpatch): Sort comparison output by test name
Change-Id: Id68a4e2b7514b9cf2e1f2f30b78dc0cd696a673a Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'resources/libraries/python/model')
-rw-r--r--resources/libraries/python/model/parse.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/resources/libraries/python/model/parse.py b/resources/libraries/python/model/parse.py
index b2e8da67ea..1e0aebfe18 100644
--- a/resources/libraries/python/model/parse.py
+++ b/resources/libraries/python/model/parse.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2023 Cisco and/or its affiliates.
+# Copyright (c) 2024 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -54,6 +54,9 @@ def parse(dirpath: str, fake_value: float = 1.0) -> Dict[str, List[float]]:
Units are ignored, as both parent and current are tested
with the same CSIT code so the unit should be identical.
+ The test results are sorted by test_id,
+ as the filesystem order is not deterministic enough.
+
The result is also cached as results.json file.
:param dirpath: Path to the directory tree to examine.
@@ -103,6 +106,7 @@ def parse(dirpath: str, fake_value: float = 1.0) -> Dict[str, List[float]]:
results[name] = [result_object["bandwidth"]["value"]]
else:
raise RuntimeError(f"Unknown result type: {result_type}")
+ results = {test_id: results[test_id] for test_id in sorted(results)}
with open(resultpath, "wt", encoding="utf8") as file_out:
json.dump(results, file_out, indent=1, separators=(", ", ": "))
return results