This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Pau Espin Pedrol gerrit-no-reply at lists.osmocom.orgPau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/11712 Change subject: iperf3: Fix parsing of incorrect json from iperf3 ...................................................................... iperf3: Fix parsing of incorrect json from iperf3 Change-Id: I759d99857c17de061e6d7c1ae1c38f6b15172131 --- M src/osmo_gsm_tester/iperf3.py 1 file changed, 13 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/12/11712/1 diff --git a/src/osmo_gsm_tester/iperf3.py b/src/osmo_gsm_tester/iperf3.py index 8141fea..e1ed6ff 100644 --- a/src/osmo_gsm_tester/iperf3.py +++ b/src/osmo_gsm_tester/iperf3.py @@ -24,6 +24,17 @@ DEFAULT_SRV_PORT = 5003 + +def iperf3_result_to_json(file): + with open(file) as f: + # Sometimes iperf3 provides 2 dictionaries, the 2nd one being an error about being interrupted (by us). + # json parser doesn't support (raises exception) parsing several dictionaries at a time (not a valid json object). + # We are only interested in the first dictionary, the regular results one: + d = f.read().split("\n}\n")[0] + "\n}\n" + data = json.loads(d) + return data + + class IPerf3Server(log.Origin): def __init__(self, suite_run, ip_address): @@ -55,9 +66,7 @@ self.suite_run.stop_process(self.process) def get_results(self): - with open(self.log_file) as f: - data = json.load(f) - return data + return iperf3_result_to_json(self.log_file) def addr(self): return self.ip_address.get('addr') @@ -100,8 +109,6 @@ return self.get_results() def get_results(self): - with open(self.log_file) as f: - data = json.load(f) - return data + return iperf3_result_to_json(self.log_file) # vim: expandtab tabstop=4 shiftwidth=4 -- To view, visit https://gerrit.osmocom.org/11712 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-gsm-tester Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I759d99857c17de061e6d7c1ae1c38f6b15172131 Gerrit-Change-Number: 11712 Gerrit-PatchSet: 1 Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181109/5d549698/attachment.htm>