summaryrefslogtreecommitdiff
path: root/scripts/Expect.py
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2015-08-11 23:03:40 +0200
committerJose <jose@zeroc.com>2015-08-11 23:03:40 +0200
commitf54c91942923bc75e8d05c29c9b7ded3f3bc9f85 (patch)
tree2b108ac49474a711212a37e2ad98c1034c7f215b /scripts/Expect.py
parentFixed ICE-6695 - ensure buffers are not cleared too early for WS/SSL transports (diff)
downloadice-f54c91942923bc75e8d05c29c9b7ded3f3bc9f85.tar.bz2
ice-f54c91942923bc75e8d05c29c9b7ded3f3bc9f85.tar.xz
ice-f54c91942923bc75e8d05c29c9b7ded3f3bc9f85.zip
ICE-6163 - Improve error handling in test scripts
Diffstat (limited to 'scripts/Expect.py')
-rwxr-xr-xscripts/Expect.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/scripts/Expect.py b/scripts/Expect.py
index 2e0c87cf101..c2d816dcd67 100755
--- a/scripts/Expect.py
+++ b/scripts/Expect.py
@@ -107,7 +107,11 @@ class reader(threading.Thread):
try:
while True:
c = self.p.stdout.read(1)
- if not c: break
+ if not c:
+ self.cv.acquire()
+ self.cv.notify()
+ self.cv.release()
+ break
if c == '\r': continue
self.cv.acquire()
@@ -254,6 +258,11 @@ class reader(threading.Thread):
if len(pattern) != olen:
continue
+ # If no match and the process has exited rasise a TIMEOUT
+ if self.p and self.p.poll() is not None:
+ raise TIMEOUT ('timeout exceeded in match\npattern: "%s"\nbuffer: "%s"\n' %
+ (escape(s), escape(buf, False)))
+
if timeout is None:
self.cv.wait()
else: