If threshold is not specified the test will fail with an exception.
The fix is to process threshold values for prettier output only if
it was specified.
Also if threshold is not specified the rates were printed in bps.
Now they are printed using pretty rates.
This patch also fixes pretty print of the deviation.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
test_modules/Netperf.py | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/test_modules/Netperf.py b/test_modules/Netperf.py
index 6c247f4..8848bcd 100644
--- a/test_modules/Netperf.py
+++ b/test_modules/Netperf.py
@@ -407,21 +407,22 @@ class Netperf(TestGeneric):
rate_pretty = self._pretty_rate(rate)
rate_dev_pretty = self._pretty_rate(rate_deviation,
unit=rate_pretty["unit"])
- threshold_pretty = self._pretty_rate(self._threshold["rate"])
- threshold_dev_pretty =
self._pretty_rate(self._threshold_deviation["rate"],
- unit =
threshold_pretty["unit"])
res_val = False
if self._threshold_interval is not None:
result_interval = (rate - rate_deviation,
rate + rate_deviation)
+ threshold_pretty = self._pretty_rate(self._threshold["rate"])
+ threshold_dev_pretty =
self._pretty_rate(self._threshold_deviation["rate"],
+ unit =
threshold_pretty["unit"])
+
if self._threshold_interval[0] > result_interval[1]:
res_val = False
res_data["msg"] = "Measured rate %.2f +-%.2f %s is lower
"\
"than threshold %.2f +-%.2f %s" %\
(rate_pretty["rate"],
- rate_deviation,
+ rate_dev_pretty["rate"],
rate_pretty["unit"],
threshold_pretty["rate"],
threshold_dev_pretty["rate"],
@@ -431,7 +432,7 @@ class Netperf(TestGeneric):
res_data["msg"] = "Measured rate %.2f +-%.2f %s is higher
"\
"than threshold %.2f +-%.2f %s" %\
(rate_pretty["rate"],
- rate_deviation,
+ rate_dev_pretty["rate"],
rate_pretty["unit"],
threshold_pretty["rate"],
threshold_dev_pretty["rate"],
@@ -441,8 +442,10 @@ class Netperf(TestGeneric):
res_val = True
else:
res_val = False
- res_data["msg"] = "Measured rate was %.2f +-%.2f bps" %\
- (rate, rate_deviation)
+ res_data["msg"] = "Measured rate was %.2f +-%.2f %s" %\
+ (rate_pretty["rate"],
+ rate_dev_pretty["rate"],
+ rate_pretty["unit"])
if rv != 0 and self._runs == 1:
res_data["msg"] = "Could not get performance
throughput!"
--
2.4.11