test.include.pexpect: add timeout param
This commit is contained in:
parent
f58b1e27a2
commit
06f914e2a8
2 changed files with 5 additions and 3 deletions
|
|
@ -40,7 +40,7 @@ NL = '\n'
|
|||
|
||||
class MMGenPexpect:
|
||||
|
||||
def __init__(self,args,no_output=False,env=None,pexpect_spawn=False,send_delay=None):
|
||||
def __init__(self,args,no_output=False,env=None,pexpect_spawn=False,send_delay=None,timeout=None):
|
||||
|
||||
self.pexpect_spawn = pexpect_spawn
|
||||
self.send_delay = send_delay
|
||||
|
|
@ -53,7 +53,7 @@ class MMGenPexpect:
|
|||
from subprocess import run,DEVNULL
|
||||
run([args[0]] + args[1:],check=True,stdout=DEVNULL if no_output else None)
|
||||
else:
|
||||
timeout = int(opt.pexpect_timeout or 0) or (60,5)[bool(opt.debug_pexpect)]
|
||||
timeout = int(timeout or opt.pexpect_timeout or 0) or (60,5)[bool(opt.debug_pexpect)]
|
||||
if pexpect_spawn:
|
||||
self.p = pexpect.spawn(args[0],args[1:],encoding='utf8',timeout=timeout,env=env)
|
||||
else:
|
||||
|
|
@ -198,7 +198,7 @@ class MMGenPexpect:
|
|||
m1 = f'\nERROR. Expect {s!r} timed out. Exiting\n'
|
||||
m2 = f'before: [{self.p.before}]\n'
|
||||
m3 = f'sent value: [{self.sent_value}]' if self.sent_value != None else ''
|
||||
die(2,m1+m2+m3)
|
||||
raise pexpect.TIMEOUT(m1+m2+m3)
|
||||
|
||||
if opt.debug_pexpect:
|
||||
debug_pexpect_msg(self.p)
|
||||
|
|
|
|||
|
|
@ -569,6 +569,7 @@ class TestSuiteRunner(object):
|
|||
no_msg = False,
|
||||
cmd_dir = 'cmds',
|
||||
no_exec_wrapper = False,
|
||||
timeout = None,
|
||||
pexpect_spawn = None ):
|
||||
|
||||
desc = self.ts.test_name if opt.names else self.gm.dpy_data[self.ts.test_name][1]
|
||||
|
|
@ -641,6 +642,7 @@ class TestSuiteRunner(object):
|
|||
no_output = no_output,
|
||||
env = env,
|
||||
pexpect_spawn = pexpect_spawn,
|
||||
timeout = timeout,
|
||||
send_delay = send_delay )
|
||||
|
||||
def end_msg(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue