On Tue, Apr 05, 2016 at 06:13:09PM +0200, Jan Tluka wrote:
When we changed how the Netperf test module reports results we
silently
broke SCTP_STREAM mode. The reason is that SCTP_STREAM does not have omni
output selection available (checked with both 2.6.0 and 2.7.0).
SCTP_STREAM data must be parsed separately.
Fixes:
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
test_modules/Netperf.py | 67 +++++++++++++++++++++++++++++++++++--------------
1 file changed, 48 insertions(+), 19 deletions(-)
diff --git a/test_modules/Netperf.py b/test_modules/Netperf.py
index 2033c57..89664fb 100644
--- a/test_modules/Netperf.py
+++ b/test_modules/Netperf.py
@@ -18,6 +18,8 @@ class Netperf(TestGeneric):
supported_tests = ["TCP_STREAM", "TCP_RR",
"UDP_STREAM", "UDP_RR",
"SCTP_STREAM", "SCTP_STREAM_MANY",
"SCTP_RR"]
+ omni_tests = ["TCP_STREAM", "TCP_RR", "UDP_STREAM",
"UDP_RR"]
+
def __init__(self, command):
super(Netperf, self).__init__(command)
@@ -52,13 +54,18 @@ class Netperf(TestGeneric):
else:
self._threshold_interval = None
+ def _is_omni(self):
+ return self._testname in self.omni_tests
+
def _compose_cmd(self):
"""
composes commands for netperf and netserver based on xml recipe
"""
if self._role == "client":
- # -P 0 disables banner header of output
- cmd = "netperf -H %s -f k -P 0" % self._netperf_server
+ cmd = "netperf -H %s -f k" % self._netperf_server
+ if self._is_omni():
+ # -P 0 disables banner header of output
+ cmd += " -P 0"
if self._port is not None:
"""
client connects on this port
@@ -112,7 +119,8 @@ class Netperf(TestGeneric):
cmd += " -s 1"
# Print only relevant output
- cmd += ' -- -k "THROUGHPUT, LOCAL_CPU_UTIL, REMOTE_CPU_UTIL,
CONFIDENCE_LEVEL, THROUGHPUT_CONFID"'
+ if self._is_omni():
+ cmd += ' -- -k "THROUGHPUT, LOCAL_CPU_UTIL, REMOTE_CPU_UTIL,
CONFIDENCE_LEVEL, THROUGHPUT_CONFID"'
elif self._role == "server":
cmd = "netserver -D"
@@ -136,27 +144,48 @@ class Netperf(TestGeneric):
def _parse_output(self, output):
res_val = {}
This is basically joining the old parse function with the new one, using
several "if is_new_parse()" statements...
Split this into two: parse_new() and parse_old() and just add a single
if is_new() statement... that'll be more readable...
optionally add a universal parse() method that takes care of the if
statement and calls either the new or the old parse method...
Everything else is ok so I'll ack when this is fixed.
>
> - pattern_throughput = "THROUGHPUT=(\d+\.\d+)"
> - throughput = re.search(pattern_throughput, output)
> + if not self._is_omni():
> + # pattern for SCTP streams and other tests
> + # decimal decimal decimal float (float)
> + pattern = "\d+\s+\d+\s+\d+\s+\d+\.\d+\s+(\d+(?:\.\d+){0,1})"
> + if self._cpu_util:
> + # cpu utilization data in format: float float
> + pattern += "\s+(\d+(?:\.\d+){0,1})\s+(\d+(?:\.\d+){0,1})"
>
> - if throughput is None:
> - rate_in_kb = 0.0
> + r2 = re.search(pattern, output.lower())
> +
> + if r2 is None:
> + rate_in_kb = 0.0
> + else:
> + rate_in_kb = float(r2.group(1))
> + if self._cpu_util:
> + res_val["LOCAL_CPU_UTIL"] = float(r2.group(2))
> + res_val["REMOTE_CPU_UTIL"] = float(r2.group(3))
> +
> + res_val["rate"] = rate_in_kb*1000
> + res_val["unit"] = "bps"
> else:
> - rate_in_kb = float(throughput.group(1))
> + pattern_throughput = "THROUGHPUT=(\d+\.\d+)"
> + throughput = re.search(pattern_throughput, output)
>
> - res_val["rate"] = rate_in_kb*1000
> - res_val["unit"] = "bps"
> + if throughput is None:
> + rate_in_kb = 0.0
> + else:
> + rate_in_kb = float(throughput.group(1))
>
> - if self._cpu_util is not None:
> - if self._cpu_util == "local" or self._cpu_util ==
"both":
> - pattern_loc_cpu_util = "LOCAL_CPU_UTIL=([-]?\d+\.\d+)"
> - loc_cpu_util = re.search(pattern_loc_cpu_util, output)
> - res_val["LOCAL_CPU_UTIL"] = float(loc_cpu_util.group(1))
> + res_val["rate"] = rate_in_kb*1000
> + res_val["unit"] = "bps"
>
> - if self._cpu_util == "remote" or self._cpu_util ==
"both":
> - pattern_rem_cpu_util = "REMOTE_CPU_UTIL=([-]?\d+\.\d+)"
> - rem_cpu_util = re.search(pattern_rem_cpu_util, output)
> - res_val["REMOTE_CPU_UTIL"] = float(rem_cpu_util.group(1))
> + if self._cpu_util is not None:
> + if self._cpu_util == "local" or self._cpu_util ==
"both":
> + pattern_loc_cpu_util =
"LOCAL_CPU_UTIL=([-]?\d+\.\d+)"
> + loc_cpu_util = re.search(pattern_loc_cpu_util, output)
> + res_val["LOCAL_CPU_UTIL"] =
float(loc_cpu_util.group(1))
> +
> + if self._cpu_util == "remote" or self._cpu_util ==
"both":
> + pattern_rem_cpu_util =
"REMOTE_CPU_UTIL=([-]?\d+\.\d+)"
> + rem_cpu_util = re.search(pattern_rem_cpu_util, output)
> + res_val["REMOTE_CPU_UTIL"] =
float(rem_cpu_util.group(1))
>
> if self._confidence is not None:
> confidence = self._parse_confidence(output)
> --
> 2.4.11
> _______________________________________________
> LNST-developers mailing list
> lnst-developers(a)lists.fedorahosted.org
>
https://lists.fedorahosted.org/admin/lists/lnst-developers@lists.fedoraho...