MMGenPexpect: new direct_exec param
This commit is contained in:
parent
fe3d4500a2
commit
7b61eccbb7
2 changed files with 13 additions and 9 deletions
|
|
@ -45,7 +45,8 @@ class MMGenPexpect:
|
|||
env = None,
|
||||
pexpect_spawn = False,
|
||||
send_delay = None,
|
||||
timeout = None ):
|
||||
timeout = None,
|
||||
direct_exec = False ):
|
||||
|
||||
self.pexpect_spawn = pexpect_spawn
|
||||
self.send_delay = send_delay
|
||||
|
|
@ -53,10 +54,10 @@ class MMGenPexpect:
|
|||
self.skip_ok = False
|
||||
self.sent_value = None
|
||||
|
||||
if cfg.direct_exec:
|
||||
msg('')
|
||||
from subprocess import run,DEVNULL
|
||||
run([args[0]] + args[1:],check=True,stdout=DEVNULL if no_output else None)
|
||||
if direct_exec or cfg.direct_exec:
|
||||
from subprocess import Popen,DEVNULL
|
||||
redir = DEVNULL if (no_output or not cfg.exact_output) else None
|
||||
self.ep = Popen([args[0]] + args[1:], stderr=redir )
|
||||
else:
|
||||
timeout = int(timeout or cfg.pexpect_timeout or 0) or (60,5)[bool(cfg.debug_pexpect)]
|
||||
if pexpect_spawn:
|
||||
|
|
|
|||
11
test/test.py
11
test/test.py
|
|
@ -579,7 +579,8 @@ class TestSuiteRunner(object):
|
|||
cmd_dir = 'cmds',
|
||||
no_exec_wrapper = False,
|
||||
timeout = None,
|
||||
pexpect_spawn = None ):
|
||||
pexpect_spawn = None,
|
||||
direct_exec = False ):
|
||||
|
||||
desc = self.ts.test_name if cfg.names else self.gm.dpy_data[self.ts.test_name][1]
|
||||
if extra_desc:
|
||||
|
|
@ -624,9 +625,10 @@ class TestSuiteRunner(object):
|
|||
clr2(repr(cmd_disp) if gc.platform == 'win' else cmd_disp)
|
||||
)
|
||||
else:
|
||||
omsg_r('{a}Testing {b}: '.format(
|
||||
omsg_r('{a}Testing {b}: {c}'.format(
|
||||
a = t_pfx,
|
||||
b = desc )
|
||||
b = desc,
|
||||
c = 'OK\n' if direct_exec or cfg.direct_exec else ''))
|
||||
|
||||
if msg_only:
|
||||
return
|
||||
|
|
@ -654,7 +656,8 @@ class TestSuiteRunner(object):
|
|||
env = env,
|
||||
pexpect_spawn = pexpect_spawn,
|
||||
timeout = timeout,
|
||||
send_delay = send_delay )
|
||||
send_delay = send_delay,
|
||||
direct_exec = direct_exec )
|
||||
|
||||
def end_msg(self):
|
||||
t = int(time.time() - self.start_time)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue