From f54c91942923bc75e8d05c29c9b7ded3f3bc9f85 Mon Sep 17 00:00:00 2001 From: Jose Date: Tue, 11 Aug 2015 23:03:40 +0200 Subject: ICE-6163 - Improve error handling in test scripts --- scripts/Expect.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'scripts/Expect.py') 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: -- cgit v1.2.3