Fri, Jun 01, 2012 at 04:29:32PM CEST, jtluka(a)redhat.com wrote:
If TestIperf is interrupted with kill/intr signal it does not collect
the ShellProcess data. I added signal handler for both client and server
part so that in case of receiving interrupt exception the iperf process'
statistics output will be collected and available for inspection at end
of testing.
---
Tests/TestIperf.py | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/Tests/TestIperf.py b/Tests/TestIperf.py
index c65ed2d..e4fabbb 100644
--- a/Tests/TestIperf.py
+++ b/Tests/TestIperf.py
@@ -11,6 +11,7 @@ from Common.TestsCommon import TestGeneric
from Common.ExecCmd import exec_cmd
from Common.ShellProcess import ShellProcess
import time
+import errno
class TestIperf(TestGeneric):
def _install_iperf(self):
@@ -37,7 +38,13 @@ class TestIperf(TestGeneric):
def run_client(self, cmd):
client = ShellProcess(cmd)
- client.wait()
+ try:
+ client.wait()
+ except OSError as e:
+ # we got interrupted, let's gather data
+ if e.errno == errno.EINTR:
+ client.kill()
+
^^^^^^^^^^^^^^^^
next time please avoid trailing whitespaces
Thanks
client.read_nonblocking()
def run_server(self, cmd):
@@ -48,7 +55,13 @@ class TestIperf(TestGeneric):
server.read_nonblocking()
server.kill()
else:
- server.wait()
+ try:
+ server.wait()
+ except OSError as e:
+ if e.errno == errno.EINTR:
+ server.kill()
+
+ server.read_nonblocking()
def run(self):
self._keep_server_running = True
--
1.7.6.5
_______________________________________________
LNST-developers mailing list
LNST-developers(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/lnst-developers