From 601c9fca5042d9a5f49c3caad3a2bfd1136b31bf Mon Sep 17 00:00:00 2001 From: Jaikiran Date: Fri, 24 May 2024 09:34:22 +0530 Subject: [PATCH] maintain the right client/server order while writing out the test results as JSON (#391) --- interop.py | 57 +++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/interop.py b/interop.py index e7e6562..b571813 100644 --- a/interop.py +++ b/interop.py @@ -306,35 +306,36 @@ def _export_results(self): "measurements": [], } - for client, server in self._client_server_pairs: - results = [] - for test in self._tests: - r = None - if hasattr(self.test_results[server][client][test], "value"): - r = self.test_results[server][client][test].value - results.append( - { - "abbr": test.abbreviation(), - "name": test.name(), # TODO: remove - "result": r, - } - ) - out["results"].append(results) + for client in clients: + for server in servers: + results = [] + for test in self._tests: + r = None + if hasattr(self.test_results[server][client][test], "value"): + r = self.test_results[server][client][test].value + results.append( + { + "abbr": test.abbreviation(), + "name": test.name(), # TODO: remove + "result": r, + } + ) + out["results"].append(results) - measurements = [] - for measurement in self._measurements: - res = self.measurement_results[server][client][measurement] - if not hasattr(res, "result"): - continue - measurements.append( - { - "name": measurement.name(), # TODO: remove - "abbr": measurement.abbreviation(), - "result": res.result.value, - "details": res.details, - } - ) - out["measurements"].append(measurements) + measurements = [] + for measurement in self._measurements: + res = self.measurement_results[server][client][measurement] + if not hasattr(res, "result"): + continue + measurements.append( + { + "name": measurement.name(), # TODO: remove + "abbr": measurement.abbreviation(), + "result": res.result.value, + "details": res.details, + } + ) + out["measurements"].append(measurements) f = open(self._output, "w") json.dump(out, f)