commit 90dd466730bf2a1708eaa3b9680361ea5ec244cd Author: Jan Tluka jtluka@redhat.com Date: Fri Sep 7 16:55:51 2012 +0200
TestIperf: fix scope of the rate variable
Made a mistake in my previous patch and forgot to check the scope of the rate variable. Without the fix in case of test pass the rate variable is not assigned resulting in test crash. With the fix all is working fine.
Signed-off-by: Jan Tluka jtluka@redhat.com
Tests/TestIperf.py | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) --- diff --git a/Tests/TestIperf.py b/Tests/TestIperf.py index e926acb..7cb6663 100644 --- a/Tests/TestIperf.py +++ b/Tests/TestIperf.py @@ -94,14 +94,14 @@ class TestIperf(TestGeneric): logging.info("Iperf connection failed!") return (False, "Iperf connection failed!")
+ m = re.search("[[^0-9]*[0-9]*]\s*0.0-\s*\d*.\d sec\s*\d*(.\d*){0,1}\s*[ kGMT]Bytes\s*(\d*(.\d*){0,1}\s*[ kGMT]bits/sec)", output) + if m is None: + logging.info("Could not get performance throughput!") + return (False, "Could not get performance throughput!") + + rate = m.group(2) if self.threshold is not None: # check if expected threshold is reached - m = re.search("[[^0-9]*[0-9]*]\s*0.0-\s*\d*.\d sec\s*\d*(.\d*){0,1}\s*[ kGMT]Bytes\s*(\d*(.\d*){0,1}\s*[ kGMT]bits/sec)", output) - if m is None: - logging.info("Could not get performance throughput!") - return (False, "Could not get performance throughput!") - - rate = m.group(2) result = self._rate_over_threshold(rate) if result: return (True, "Measured rate (%s) is over threshold (%s)." %
lnst-developers@lists.fedorahosted.org