On Fri, Jul 03, 2015 at 10:07:46AM +0200, Jan Tluka wrote:
Fri, Jul 03, 2015 at 09:08:01AM CEST, olichtne(a)redhat.com wrote:
>From: Ondrej Lichtner <olichtne(a)redhat.com>
>
>* bug in threshold parsing - need to get the testname option first
>
>* formatting error in the result message
>
>* add a better result message for multiple runs where one of the runs
> crashes with a non-zero return code
>
>Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
>---
> test_modules/Netperf.py | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
>diff --git a/test_modules/Netperf.py b/test_modules/Netperf.py
>index 95f88ef..7bc0e64 100644
>--- a/test_modules/Netperf.py
>+++ b/test_modules/Netperf.py
>@@ -113,6 +113,7 @@ class Netperf(TestGeneric):
> # group(1) ... threshold value
> # group(3) ... threshold units
> # group(4) ... bytes/bits
>+ testname = self.get_opt("testname")
This looks suspicious. What happens if the option is not defined? It
is not mandatory (since netperf would run a default test if user does
not specify it) so get_opt() returns None and you will finally bypass
all if-elif branches.
Agreed, I'll send a v2 in a moment.
> if (testname == "TCP_STREAM" or testname == "UDP_STREAM"
or
> testname == "SCTP_STREAM" or testname ==
"SCTP_STREAM_MANY"):
> pattern_stream = "(\d*(\.\d*)?)\s*([
kmgtKMGT])(bits|bytes)\/sec"
>@@ -217,7 +218,7 @@ class Netperf(TestGeneric):
> else:
> res_val = True
> res_data["msg"] = "Measured rate %.2f +-%.2f bps is
higher "\
>- "than threshold %.2f +-.2%f" %\
>+ "than threshold %.2f +-%.2f" %\
> (rate, rate_std_deviation,
> threshold, threshold_std_deviation)
> else:
>@@ -228,12 +229,18 @@ class Netperf(TestGeneric):
> res_data["msg"] = "Measured rate was %.2f +-%.2f
bps" %\
> (rate, rate_std_deviation)
>
>- if rv != 0:
>+ if rv != 0 and runs == 0:
> res_data["msg"] = "Could not get performance throughput!
Are you "\
> "sure netperf is installed on both machines and
"\
> "machines are mutually accessible?"
> logging.info(res_data["msg"])
> return (False, res_data)
>+ elif rv != 0 and runs > 1:
>+ res_data["msg"] = "At least one of the Netperf runs
failed, "\
>+ "check the logs and result data for more "\
>+ "information."
>+ logging.info(res_data["msg"])
>+ return (False, res_data)
> return (res_val, res_data)
>
> def run(self):
>--
>2.1.0
>
>_______________________________________________
>LNST-developers mailing list
>LNST-developers(a)lists.fedorahosted.org
>https://lists.fedorahosted.org/mailman/listinfo/lnst-developers