From 35330baeea8670cb360b8c23bdf5445d5993b1ad Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 7 Dec 2022 14:19:18 +0100 Subject: [PATCH] CI: Fix AnalyzeIperf - Handle k(ilo) bytes - Fix magnitudes for kilo and giga - Correctly parse status line in iperf logs --- ci-scripts/cls_containerize.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index ab621a7cd7..4540f2a8a0 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -153,11 +153,11 @@ def AnalyzeBuildLogs(buildRoot, images, globalStatus): def AnalyzeIperf(cliOptions, clientReport, serverReport): req_bw = 1.0 # default iperf throughput, in Mbps - result = re.search('-b *(?P[0-9\.]+)(?P[KMG])', cliOptions) + result = re.search('-b *(?P[0-9\.]+)(?P[kKMG])', cliOptions) if result is not None: req_bw = float(result.group('iperf_bandwidth')) magn = result.group('magnitude') - if magn == "K": + if magn == "k" or magn == "K": req_bw /= 1000 elif magn == "G": req_bw *= 1000 @@ -180,7 +180,7 @@ def AnalyzeIperf(cliOptions, clientReport, serverReport): reportLine = clientReportLines[l+1] logging.debug(f'found server report: "{reportLine}"') - statusTemplate = '(?:|\[ *\d+\].*) +0\.0-(?P[0-9\.]+) +sec +[0-9\.]+ [KMG]Bytes +(?P[0-9\.]+) (?P[KMG])bits\/sec +(?P[0-9\.]+) ms +(\d+\/ ..\d+) +(\((?P[0-9\.]+)%\))' + statusTemplate = '(?:|\[ *\d+\].*) +0\.0-\s*(?P[0-9\.]+) +sec +[0-9\.]+ [kKMG]Bytes +(?P[0-9\.]+) (?P[kKMG])bits\/sec +(?P[0-9\.]+) ms +(\d+\/ ..\d+) +(\((?P[0-9\.]+)%\))' # if we do not find a server report in the client logs, check the server logs # and use the last line which is typically close/identical to server report if reportLine is None: @@ -201,10 +201,10 @@ def AnalyzeIperf(cliOptions, clientReport, serverReport): duration = float(result.group('duration')) bitrate = float(result.group('bitrate')) magn = result.group('magnitude') - if magn == "K": - bitrate *= 1000 - elif magn == "G": # we assume bitrate in Mbps, therefore it must be G now + if magn == "k" or magn == "K": bitrate /= 1000 + elif magn == "G": # we assume bitrate in Mbps, therefore it must be G now + bitrate *= 1000 jitter = float(result.group('jitter')) packetloss = float(result.group('packetloss'))